Applescript execution error under Rev but not Script Editor

Sarah Reichelt sarah.reichelt at gmail.com
Thu Jan 5 21:02:17 EST 2006


> The following Applescript does work successfully when run in the
> Script Editor but return an execution error when run with «do fld
> "theScript" as Applescript»:
>
> THE SCRIPT:
> try
>         tell application "Address Book"
>                 activate
>                 set theCard to person id "808C7253-74EA-4619-
> BC2D-3D030DEA63D9:ABPerson"
>                 tell me to assignPersonToGroup(theCard, "Patients")
>                 save addressbook
>         end tell
> on error myError
>         return myError
> end try
>
> on assignPersonToGroup(thePerson, theGroup)
>         if (theGroup is not equal to "") then
>                 tell application "Address Book"
>                         set nameOfEveryGroup to name of every group
>                         if nameOfEveryGroup contains theGroup then
>                                 set theGroupByID to group named theGroup
>                                 add thePerson to theGroupByID
>                         else
>                                 set newGroup to make new group with properties {name:theGroup}
>                                 add thePerson to newGroup
>                         end if
>                 end tell
>         end if
> end assignPersonToGroup
>
>
> THE ERROR:
> "Impossible de rendre «class azf4» id \"808C7253-74EA-4619-
> BC2D-3D030DEA63D9:ABPerson\" of application \"Address Book\" dans le
> type attendu."
> translated in english: "impossible to render «class azf4» id
> \"808C7253-74EA-4619-BC2D-3D030DEA63D9:ABPerson\" of application
> \"Address Book\" in the expected type".
>
> MY QUESTION: Any clue to be able to execute the Applescript also in Rev?
>

Hi Joel,

I have found that you can't use separate functions in AppleScripts run
through Rev. Embeb the function's script in the main AppleScript
handler and I think it will work.

Cheers,
Sarah



More information about the use-livecode mailing list