Applescript execution error under Rev but not Script Editor

Joel Guillod joel.guillod at net2000.ch
Thu Jan 5 19:51:04 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?

Thanks.
Joël


More information about the use-livecode mailing list