Thread View: adobe.scripting.indesign
7 messages
7 total messages
Started by matt_p_stone
Wed, 07 Jan 2009 19:06
Access Standard InDesign Menu
Author: matt_p_stone
Date: Wed, 07 Jan 2009 19:06
Date: Wed, 07 Jan 2009 19:06
11 lines
1322 bytes
1322 bytes
Trying to write a series of scripts that, bottom line, do the following. Open existing files > Import existing XML > Data merge from existing txt > save as > export each page as individual pdf per specific settings I have the save as and the pdf part scripted but can figure out the first three. I would imagine the simplest way is the launch a menu item using the script rather than re-script it since I want the dialog box so I can choose the right files. There are multiple ID files that all get the same XML but not all get the same data merge. And it will be a script that is purposed for many versions of this same action. The scripting guide states that you can access menu items but the methods it provides do not work. Any help is greatly appreciated.
Re: Access Standard InDesign Menu
Author: loic_aigon
Date: Wed, 07 Jan 2009 21:18
Date: Wed, 07 Jan 2009 21:18
14 lines
1240 bytes
1240 bytes
Open files can be get at least by two ways.
1. Open files regarding to an array of files.
var myFiles = [File(".../file1.indd"),File(".../file2.indd"),etc.]
for(i=0; i<myFiles.length; i++) { app.open(myFilesArr[i]); }
2. Open files located in a folder
var myFolder = Folder.selectDialog("Choose a folder");
var myFiles = myFolder.getFiles ("Indesign: *.indd") //Always forget how to express filters :-%
for(i=0; i<myFiles.length; i++) { app.open(myFilesArr[i]); }
For me you have a confusion between xml and datamerge. For me you use one of both techniques but not twice at a time. But you may know what you want to do.
Loic
Re: Access Standard InDesign Menu
Author: matt_p_stone
Date: Wed, 07 Jan 2009 21:40
Date: Wed, 07 Jan 2009 21:40
11 lines
1310 bytes
1310 bytes
loic_aigon, Thank you very much for your response. Couple of things though; 1. When I tried your first snippet I got a syntax error for the first line, didn't like the [] 2. The second snippet works great except that all files are greyed out, I can't select any of them. Am I missing something? 3. XML is to import content and pictures that are the same for every version (just using different size templates, same content) the Datamerge is for versions within each size but that text data for the versions comes later down the process. But, if you see a better way I am certainly all ears! Thanks again!
Re: Access Standard InDesign Menu
Author: matt_p_stone
Date: Thu, 08 Jan 2009 15:35
Date: Thu, 08 Jan 2009 15:35
11 lines
1476 bytes
1476 bytes
Update:
Last night I figured out how to invoke menu actions by name using the key string. This code returns the key string then I can use it to invoke an action. But this doesn't work for all menu items. I ran the script to find all menu actions by name so that I could use this one to find the key string. But, "ImportXML..." returns no results, just a blank box. As do several others.
Any ideas/help, please?
var myString = "";
var myMenuAction = app.menuActions.item("Open...");
var myKeyStrings = app.findKeyStrings(myMenuAction.name);
if(myKeyStrings.constructor.name == "Array"){
for(var myCounter = 0; myCounter < myKeyStrings.length; myCounter ++){ myString += myKeyStrings[myCounter] + "\r"; } } else{ myString = myKeyStrings; } alert(myString);
Re: Access Standard InDesign Menu
Author: Dave_Saunders
Date: Thu, 08 Jan 2009 16:18
Date: Thu, 08 Jan 2009 16:18
13 lines
1176 bytes
1176 bytes
Matt, You really shouldn't be invoking menu actions when the functionality is available via the object model. The change tools example is not available and so being able to invoke that command can be useful. But importing XML is something you should be directly scripting. It is a tough area to start a scripting career with, though. Have you looked through this forum for other topics on XML? There's been quite a few discussions. You should also look at the resources on this page: <http://www.adobe.com/products/indesign/scripting/> under XML resources. Dave
Re: Access Standard InDesign Menu
Author: loic_aigon
Date: Thu, 08 Jan 2009 22:04
Date: Thu, 08 Jan 2009 22:04
16 lines
1479 bytes
1479 bytes
Hi,
Way 1:
var myFiles = [File(".../file1.indd"),File(".../file2.indd"),etc.]
for(i=0; i<myFiles.length; i++) { app.open(myFilesArr[i]); }
Error was generated from the variable mismatch name (myFiles/myFilesArr)
var myFiles = [File(".../file1.indd"),File(".../file2.indd"),etc.]
for(i=0; i<myFiles.length; i++) { app.open(myFiles[i]); } This works.
Way 2:
var myFolder = Folder.selectDialog("Choose a folder");
var myFiles = Folder(myFolder).getFiles("*.indd")
for(i=0; i<myFiles.length; i++) { app.open(myFiles[i]); } This works more or less. You don't really care about the files being greyed cause you are not requested to select files but a folder which contains indesign files. If there is any, they will be opened. However, this method works weirdly on mac and was deeply detailed By Dave Saunders on his blog.
Re: Access Standard InDesign Menu
Author: matt_p_stone
Date: Thu, 08 Jan 2009 23:47
Date: Thu, 08 Jan 2009 23:47
7 lines
916 bytes
916 bytes
Thank you both very much, yes it is a tough place to start. I always like a challenge though. This is really a direct cost saving need, but thankfully of my own making right now. Not skilled enough to tout anything yet and get in over my head. Thanks again, I will search more and visit the link posted above. -M
Thread Navigation
This is a paginated view of messages in the thread with full content displayed inline.
Messages are displayed in chronological order, with the original post highlighted in green.
Use pagination controls to navigate through all messages in large threads.
Back to All Threads