Copy link to clipboard
Copied
Hello, I was wondering if it would be possible to grab the current parent folder path without the folder path listed within the Javascript file.
For example, I have about 63 shortcut files that are located within a folder in location A.
C:\Users\USERNAME\OneDrive\Backup\Shortcuts\TEMPLATES
Within each script (indesign script files are within the scripts panel appdata file location) lists a path for each shortcut in location A:
var templateFile = new File("C:/Users/USERNAME/OneDrive/Backup/Shortcuts/TEMPLATES/template01.lnk");
var template = app.open(templateFile);
This being said, I think it would be super tedious to have to go through over 60+ files to change each file path in case I have to switch computers or have someone else use these files - thus resulting in a completely new file path.
Is there any way of grabbing the local URL of the parent folder path of the shortcut without having to have it manually typed out like it currently is on each file? Maybe having the local URL of the parent folder path listed in a separate file?
The final product would preferably look something like this:
var templateFile = new File(TEMPLATE_PATH + "template01.lnk");
var template = app.open(templateFile);
Thank you!
Hi,
but my sample already includes the current user folder.
Folder("~/")
From that on you easily should get on to OneDrive with:
var templateFolder =
Folder("~/"+"OneDrive/Backup/Shortcuts/TEMPLATES/");
var templateFile =
File( templateFolder + "template01.lnk" );
Wouldn't that work for you?
Always test if it exists like that:
Folder("~/"+"OneDrive").exists
Should return true…
Regards,
Uwe Laubender
( ACP )
Copy link to clipboard
Copied
Hi,
I wonder what the "current parent folder path" should be?
The folder that comes with the current user?
For example this would return ~/AppData/Roaming on Windows 10:
Folder.userData
Regards,
Uwe Laubender
( ACP )
Copy link to clipboard
Copied
That would be helpful if I'm trying to use part of the AppData/Roaming url to grab the script location, but I'm trying to grab the location of the shortcut files. Currently the parent folder path for the shortcut files are stored within OneDrive. That location may change, depending on the situation. I should also mention that with each template file, there is a script file to match. This was done so that way then I didn't need to go digging through folders to find each template file, where I could just open the file directly without dealing with a dialog box either. Now there's the issue of having individual script files with slightly different filepaths.
Copy link to clipboard
Copied
Hi,
but my sample already includes the current user folder.
Folder("~/")
From that on you easily should get on to OneDrive with:
var templateFolder =
Folder("~/"+"OneDrive/Backup/Shortcuts/TEMPLATES/");
var templateFile =
File( templateFolder + "template01.lnk" );
Wouldn't that work for you?
Always test if it exists like that:
Folder("~/"+"OneDrive").exists
Should return true…
Regards,
Uwe Laubender
( ACP )
Copy link to clipboard
Copied
Not exactly what I was looking for, but this work. Thank you for your help!