At 14.48 1998.02.09, Peter Prymmer wrote: >mac-perl@iis.ee.ethz.ch >Subj: Re: [MacPerl] MacPerl->Applescript > >Shyam Hegde wrote: > >!Thanks for such a quick response. The option above sounds like a good >!quick fix - I'm not that profficient in AppleScript and I was hoping you >!might be able to give me some pointers in how to do this. From the little >!I understand about AppleScript, I must use a list data structure in the >!form of {"a","b","c","d"} >! >!This would mean that MacPerl would have to write variables into a string in >!the format above. I tried to implement this using the construct: >! >! $myreply = qq({"$var1","$var2","$var3","$var4"}); >! >!But MacPerl seems to escape these characters when passing back to >!AppleScript with "\"?? >! >!If you have any ideas then they are greatly appreciated. > >Depending on whether or not you want $var1 et al interpolated you could >try one of these: > > $myreply = "{\"\$var1\",\"\$var2\",\"\$var3\",\"\$var4\"}"; > > $myreply = "{\"$var1\",\"$var2\",\"$var3\",\"$var4\"}"; > > $myreply = q({"$var1","$var2","$var3","$var4"}); This is not the AppleScript list :), but I should mention that AppleScript will not treat a string as a data structure. i.e., if you want: {"a","b","c","d"} then telling MacPerl to give you that in one string will actually give you: "{\"a\",\"b\",\"c\",\"d\"}" This is a string, not a data structure. One more time: tell application "MacPerl" set y to Do Script "MacPerl::Reply('{1,2,3,4,5}')" y end tell That gives you: "{1,2,3,4,5}" That is one string. While: tell application "MacPerl" set x to Do Script " $reply = join ('|', (1..5)); MacPerl::Reply ($reply); " end tell set AppleScript's text item delimiters to "|" set y to text items of x set AppleScript's text item delimiters to "" y gives you: {"1", "2", "3", "4", "5"} Which is what you want to have in y; a data structure of five strings. More to add to my chapter on Apple Events/AppleScript ... :) -- Chris Nandor mailto:pudge@pobox.com http://pudge.net/ %PGPKey=('B76E72AD',[1024,'0824 090B CE73 CA10 1FF7 7F13 8180 B6B6']) #== New Book: MacPerl: Power and Ease ==# #== Publishing Date: Early 1998. http://www.ptf.com/macperl/ ==# ***** Want to unsubscribe from this list? ***** Send mail with body "unsubscribe" to mac-perl-request@iis.ee.ethz.ch