Hi! All
 
I strongly believe that MacPython can be used to write similar code to perform Applescript code functions. I try to find corresponding MacPython code for apple script. For example following adobe apple script code
 
tell application "Adobe InDesign CS2"
    set myDoc to make document
    tell myDoc
        tell page 1
        set myTextFrame to make text frame
        set geometric bounds of myTextFrame to {"6p0","6p0","18p0","18p0"}
        set contents of myTextFrame to "HELLO"
       end tell
    end tell
end tell
 
I can run this script and set text frame on ID document. Now the questions are:
1. we can create MacPython obj say cs = app("Adobe InDesign CS2")
2. Then from cs we could have myDoc=cs.open(filename)
    How do we make a new document by using MacPython code??
    From appscript help, we can get some description like :
 
    application.make(...) ---- make new element
    [new=Type]  ---- The class of the item to be created
    [at =InsertionRef] ----The location at which to insert the item
    [with_data=record] --- the initialial data for the item
    [with_properties=Record] -- Initialial value for the properties of the new object
    result reference
 
    The question is "Do I need fill all 4 paramters in order to create a item?" I kew the type could be k.document, etc.
    On Adobe InDesign manual, there is no make method for application, I wonder if application will accept the commands.
 
3. I can write something like
 
     cs.active_document.pages[1].text_frames[1]
 
   and execute it without error.
 
   But how can one get the information from
        cs.active_document.pages[1].text_frames[1].contents
   here cs is app("Adobe InDesign CS2")
 
 
  If I print cs.active_document.pages[1].text_frames[1].contents, it should print out empty string or some string based on content. But it print out
 app("Adobe InDesign CS2").active_document.pages[1].text_frames[1].contents
 
 
 
   In TextEdit, we can use get() and set(). I do not know what command one needs to send cs.active_document.pages[1].text_frames[1].contents
 
in order to get the information.
 
Thanks for all your help.

__________________________________________________
Do You Yahoo!?
Tired of spam? Yahoo! Mail has the best spam protection around
http://mail.yahoo.com

_______________________________________________
Pythonmac-SIG maillist  -  Pythonmac-SIG@python.org
http://mail.python.org/mailman/listinfo/pythonmac-sig

Reply via email to