January 28, 200916 yr Is there a simple way to return the result of a "calculated applescript" script step to the originating script? I appreciate this can be done by having the applescript itself write the result into a field on a layout, but i was hoping for something a bit more elegant
January 29, 200916 yr No, you've got to write it to a field. You do not have to be on the layout, if you specify the layout or table occurrence* name. It is easiest to do so with global fields, which do not care about "current record". *AppleScript uses the term "table", but it always means a FileMaker table occurrence (what you see on the relationship graph). Nothing can see the FileMaker "tables", which are better called "base tables", just to avoid confusion. Here's a funny little file I created to test various ways to set a field. [ Fixed database name in AppleScript. Oops! Never make cosmetic last-minute changes :-] AS_Tests2.zip Edited January 29, 200916 yr by Guest Fixed database name in AppleScript
January 29, 200916 yr Author thanks that's really useful... A point for anyone else who's using this: The applescript refers to database "AStest"; this should be "AStests"
January 29, 200916 yr Oops! Last minute changes, as "ATests" seemed a better name for the file. Duh. Fixed it in the download file of my 1st post.
February 2, 200916 yr Author Ok, this bit of code appended to the end of any fm applescript will capture the result: --applecript goes here set the_result to result set the_result to my asUnicodeString(the_result) set the_database to "my database" --change this to the database to write to set the_table to "my table" --change this to the table occurence to write to set the_field to "my field" --change this to the table occurence to write to tell me set field the_field of table the_table of database the_database to the_result end tell --from http://discussions.apple.com/thread.jspa?threadID=1105795 on asUnicodeString(a) local astid, NIL set astid to a reference to AppleScript's text item delimiters set NIL to "" as Unicode text try {«class AAAA»:a}'s «class BBBB» on error t -- t = "Can't get «class BBBB» of {«class AAAA»:a}" try set astid's contents to {"{«class AAAA»:"} set t to NIL & t's text items 2 thru -1 set astid's contents to {"}"} set t to NIL & t's text items 1 thru -2 set astid's contents to {""} return t -- t = a, which is in Unicode text on error errs number errn set astid's contents to {""} error errs number errn end try end try end asUnicodeString Edited February 2, 200916 yr by Guest
Create an account or sign in to comment