[Pythonmac-SIG] obj in MacPython and Appscript

Zhi Peng zhiyong_peng2003 at yahoo.com
Wed Oct 26 05:24:55 CEST 2005


Hi! All 
 
First of all, thanks for all your answers to my qestions. 
 
1. 
When I used appscript, I often try to print out the object or string while I debug the program. For example: 

cs = app('TextEdit').documents[1].paragraphs[1]

print cs

I assumed that cs should be anObject of paragraphs. 

But it print out as 

 

app('TextEdit').documents[1].paragraphs[1]

 

instead of specific python object. If one would like to get the actual 

reference of the paragraphs[1] object, what should I do? Anyone knew?

if one uses following, it may get sth for 'TextEdit'

app('TextEdit').documents[1].paragraphs[1].get()

 

But some other application does not have 'get' for documents[1] or 

paragraphs[1]. In this case, is there way that I can catch the object?

 

For example, in Adobe InDesign CS2, I could have 

 

cs = app('Adobe InDesign CS2')

doc=cs.open("mydoc.indd") <--- just example 

doc = cs.active_document

page = doc.pages[1]

print page                  <----- this does not show object

anObject=page.get()  <----- this may raise exception

 

2. By the way, I get a little confused with following command 

application.make(...) -- Make a 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 initial data for the item 
   [with_properties=Record] -- Initial values for properties of the new object 
   Result: Reference -- The new object(s) 

I guess that 'new' may be sth like new=text_frame or new=document

at=cs.documents[1].sth

What was the with_data=Record and with_properties?  

 

 


		
---------------------------------
 Yahoo! FareChase - Search multiple travel sites in one click.  
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.python.org/pipermail/pythonmac-sig/attachments/20051025/f86e6d22/attachment.html


More information about the Pythonmac-SIG mailing list