Copy link to clipboard
Copied
Hello,
I am new to Indesing Scripting. Studying through "InDesignCS3_ScriptingGuide_JS" (page no 12).
I am using Mas OS.
My file saved in Desktop in the name "aa.indd". It open correctly.
Running Sucessfully below code:
var myOpen = app.open(File("~/Desktop/aa.indd"));
But if i saved my file in "Macintosh HD/Users/Shared/TEST/aa.indd" or some other path it not open properly.
Failure code is:
var myOpen1 = app.open(File("Users/Shared/TEST/aa.indd)
Please find the attachment.
Kindly let me know in case of any clarification.
Thanks in advance
BEGINNER
Copy link to clipboard
Copied
var myOpen1 = app.open(File("Users/Shared/TEST/aa.indd"));
maby that is your problem?
Copy link to clipboard
Copied
I think you might also need.
~/user.........
P.
Copy link to clipboard
Copied
Your path is not correct. It's not what Pickory says, because your "Users" folder is not somewhere inside your local folder (which is indicated by the tilde). To use an absolute path, you have to start with a root folder:
/Users/Shared/TEST/aa.indd
.. This assumes the root folder of your Mac is called plain '/'. Can't test right now; it depends on your OS X version (? perhaps on local settings? time of day?), perhaps you have to start with /Volumes, or possibly with /siraj's\ Mac\ mini
Anyway, it's the path that you supply that is wrong, and you should use the right one.
Copy link to clipboard
Copied
A-ha, you don't even need to know the root path. This also works on Windows(!):
path = '~/../All Users';
alert (Folder(path).getFiles().join('\r'));
i.e., the '~' directs you to your own root folder, and with '..' you navigate one 'level' up (so you are in the "Users" folder) and you can go down again into any other's Users folder.
So you could try this instead:
var myOpen1 = app.open(File("~/../Shared/TEST/aa.indd"));
Copy link to clipboard
Copied
Hi Jongware and All,
It working fine.
Thanks a lot!!!
But i placed a file in different path(Application folder).
It not works
//var myOpen1 = app.open(File("~/Applications/TEST/aa.indd"));
//var myOpen1 = app.open(File("~/../Applications/TEST/aa.indd"));
//var myOpen1 = app.open(File("Macintosh HD/Applications/TEST/aa.indd"));
Copy link to clipboard
Copied
Your first one actually does work but you have placed your test… in the system level applications folder…
// This one points to your current user account applications folder
// This is valid you just didn't put the file there…
var myOpen1 = app.open( File( "~/Applications/TEST/aa.indd" ) );
// This one points to your main system level applications folder
// These are apps available to all user accounts…
var myOpen1 = app.open( File( "/Applications/TEST/aa.indd" ) );