[python-win32] JavaScript - Python

Boc Tom boctom at hotmail.com
Mon Dec 12 19:56:26 CET 2011


Hi,

I want to use Python to automate InDesign,
There is very little help on that subject !
I would like to use some of the sample scripts provided in the  InDesign Sripting documentation,
So I translate them from VBScript to Python which is ok except there are some parts written in JavaScript as well :

Quote from the tutorial "Importing a graphic" :
""" VBScript does not have the ability to do this, so we'll use a JavaScript to get a file name.
We'll run the JavaScript using InDesign's DoScript feature.
myJavaScriptString = "var myTextFile = File.openDialog(""Choose a graphicfile"");myTextFile.fsName;"
Run the JavaScript using DoScript.
myGraphicFileName = myInDesign.DoScript(myJavaScriptString, idScriptLanguage.idJavascript) """

So my question would be :
- how to import a graphic into Indesign using Python Win32 ?
- Should I try to make the doScript command work, the following command doesn't work :
myGraphicFileName = myInDesign.DoScript(myJavaScriptString, language = Javascript)


Thanks for your help,

Regards,

Thomas


 		 	   		  
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-win32/attachments/20111212/53e08503/attachment.html>


More information about the python-win32 mailing list