Chris, As usual, thanks for all your work on glue. I finally got some time to try out the current version. Right off the bat I noticed the improvements to the aete parsing. The aete's for the main app and all of the plugins are now parsed quickly and correctly! Also, properties of properties now work correctly. With these stumbling blocks removed I was able to succesfully convert some interesting AppleScripts to Glue. Cool. As I pushed things a little bit further I encountered some issues. I am able to work around several of the problems that I will mention. But my goal is to show others how natural it can be to replace AppleScript with perl/glue. So I would like the AppleScript to translate as directly as possible. To communicate these issues I need to show you a part of my Glue dictionary and the original AppleScript. First some dictionary snippets: ##### Place verb $obj->place(fss , autoflowing => ysno, converting_quotes => ysno, destination_layer => obj , on => obj , place_point => fpnt, retaining_formatting => ysno, showing_options => ysno, with_properties => reco) Places an image on a page (K2 /plac) Reply type: obj Parameters: direct object (----): The file to place autoflowing (aflw): Whether to autoflow placed text. converting_quotes (cnqt): Whether to convert straight quotes with typographic quotes for placed text files. destination_layer (pdlr): The layer(s) to place the file on. Only valid if you are telling a page or spread to place. on (insh): Where to place the file, can be a page, spread, master spread, another page item or a text object. place_point (insw): The point where to place the object. Only applicable if you are telling a page or spread to place. retaining_formatting (rtfo): Whether to keep formatting of placed text files. showing_options (imot): Whether to display the import options dialog. with_properties (prdt): Any settable property of the placed object. ##### Window object window (cwin): An window Properties: active_layer (pacl/obj ): Active layer of document active_spread (pacs/obj ): Active spread of document bounds (pbnd/qdrt): bounds of window name (pnam/TEXT): name of window selection (sele/****): List of the selected items in InDesign. zoom_percentage (zoom/fixd): View percentage ##### Spread object spread (sprd): An InDesign spread Properties: inheritance (c@#^/K2bs): All properties and elements of the given class are inherited by this class. island (ilnd/bool): Whether the spread is an island. Notes: It would be convenient to have the POD display which properties are read-only. Also, there is no indication of the allowable elements. Finally, the name of the inherited class could be useful here. All of these are available in Script Editor's view of the dictionary. Second the AppleScript to be converted: #tell application "InDesign" # set myWindow to active window # tell myWindow # set mySpread to active spread # tell mySpread # set myPlacedObject to place "System:Code:Shuksan:QA:TestFile:art1.tif" # tell myPlacedObject # set geometric bounds to {"6p0", "6p0", "18p0", "18p0"} # end tell # end tell # end tell #end tell The nested calls to tell are more than just a formatting decision. In particular, the application has access to mySpread as the 'subject' of the 'place' AppleEvent. This application is unusual in that it actually uses 'subject'. Since there is no apparent mechanism within glue to establish the 'subject' of an AppleEvent I decided to translate the following slightly modified AppleScript instead (taking advantage of the alternate form of the 'place' verb using the 'on' parameter): #tell application "InDesign" # set mySpread to active spread of active window # set myPlacedObject to place "System:Code:Shuksan:QA:TestFile:art1.tif" on mySpread # set geometric bounds of myPlacedObject to {"6p0", "6p0", "18p0", "18p0"} #end tell I wonder if it would be possible to apply verbs to AEObjDescs as well as to Glue e.g.: $doc1 = $myGlue->obj(document=>1); $doc1->set($myGlue->obj(property=>'name'), to=>'newName'); This would allow direct translation of the original version of the AppleScript. Anyway, my first attempt looked something like this: use Mac::Glue; use Mac::Files; use Mac::Types; use Mac::AppleEvents::Simple; $i = new Mac::Glue 'InDesign'; $mySpreadSpec = $i->obj(property=>'active_spread', property=>'active_window'); #$myPlacedObjectSpec = $i->place("System:Code:Shuksan:QA:TestFile:art1.tif", on=>$mySpreadSpec); Here I encountered my next problem. Noting that the 'place' verb expects an FSSpec as it's first parameter I tried passing a plain old string as in AppleScript. The application did receive an FSSpec. But it was invalid. Apparently the string was being directly stuffed into the FSSpec's fields. So I tried: #$myPlacedObjectSpec = $i->place(FSMakeFSSpec("System:Code:Shuksan:QA:TestFile:art1.tif"), on=>$mySpreadSpec); This time the app got a slightly different bad FSSpec. Finally I tried: $myPlacedObjectSpec = $i->place(MacPack('fss ',"System:Code:Shuksan:QA:TestFile:art1.tif"), on=>$mySpreadSpec); This worked. Maybe this is a service that Glue could easily provide? On to the next line. The 'place' verb returns a reference to an object. However I found it difficult to use $myPlacedObjectSpec in a glue expression. My first naive approach was to try: #$i->set($i->obj(property=>'geometric_bounds', $myPlacedObjectSpec ), to=>["6p0", "6p0", "18p0", "18p0"]); This didn't work. After examining the Glue source code I happened on this hack: $myBlessedObjectSpec = bless {DESC=>$myPlacedObjectSpec}, 'AEObjDesc'; $i->set($i->obj(property=>'geometric_bounds', $myBlessedObjectSpec ), to=>["6p0", "6p0", "18p0", "18p0"]); Perhaps Glue could do this blessing for me when an object reference is returned? Then I wouldn't have to worry about wrapper functions or memory management. At last I can jettison AppleScript. With a few minor adjustments I may be able to evangelize this to others. Thanks again for your work. Mat P.S. One more thing. I couldn't get this to translate: ##Applescript: tell application "Indesign" name of document 1 -- this works fine end tell ##Perl: use Mac::Glue ':glue'; use Mac::Files; use Mac::Types; use Mac::AppleEvents::Simple; $i = new Mac::Glue 'InDesign'; print $i->get($i->obj(property=>'name', document=>1)); print $^E; This prints -1728. ===== Want to unsubscribe from this list? ===== Send mail with body "unsubscribe" to macperl-request@macperl.org