-
1. Re: [JS CS3] Making the #includepath work
[Jongware] Dec 17, 2010 2:00 PM (in response to Tom Tomasko)1 person found this helpfulI'm guessing, but don't worry -- it's an educated guess!
Lines starting with '#' are not really part of Javascript-the-language, so you cannot use Javascript command syntax in them. Concatenating two strings this way is Javascript syntax, as is looking up a string value from a variable.
Since this line doesn't get parsed and evaluated, everything inside the "quotes" is treated as being the path name, and the path name
myPath+'/FormatResources/'
is not found on your system.
[Edit] I forgot to add a solution. Since the script will (presumably) be run from the Scripts panel, you can use this variable
app.activeScript.fullName
to get the effective path of the script that's running. You can tack on "FormatResources" to get to your data.
-
2. Re: [JS CS3] Making the #includepath work
Kasyan Servetsky Dec 18, 2010 2:50 AM (in response to Tom Tomasko)Tom,
You can add one or more paths after the #include statement separating them by the semicolon (;)
Try this:
#includepath "~/Library/Preferences/Adobe InDesign/Version 5.0/Scripts/Scripts Panel;~/Application Data/Adobe/InDesign/Version 5.0/Scripts/Scripts Panel" #include "_firstScript.jsxinc"
Kasyan
-
3. Re: [JS CS3] Making the #includepath work
Harbs. Dec 18, 2010 2:46 PM (in response to Tom Tomasko)If I'm not mistaken, "#include" is relative to Folder.current which by default is the folder of the active script...
Harbs
-
4. Re: [JS CS3] Making the #includepath work
Tom Tomasko Dec 20, 2010 10:56 AM (in response to Harbs.)Thanks everyone. Kasyan's solution works just fine.
-
5. Re: [JS CS3] Making the #includepath work
Kasyan Servetsky Jan 26, 2011 12:25 AM (in response to Tom Tomasko)I was leafing through the InDesign and xml technical reference and remembered another way to get the glue code:
// Locate and run the glue code.jsx file var myFilePath = app.filePath + "/Scripts/xml rules/glue code.jsx"; if(File(myFilePath).exists == false){ myFilePath = File.openDialog("Locate the file: glue code.jsx"); } if(myFilePath != null){ var myFile = File(myFilePath); app.doScript(myFile); main(); } function main() { // do something here }