Applescript global variable in Calculated Applescript in FileMaker 11

I have a calculated script in FileMaker 11 Advanced:
property theImg : {}
tell application “Image Events”
set theImg to open alias “H-DSpudConte38374S.jpg” of folder “H-D_Spud_Contest” of folder “04” of folder “2011” of folder “biker_events_rallies” of folder “Articles” of folder “WEB-TPI-LiveSite” of disk “MothraShare”
set imgInfo to dimensions of theImg as text
close theImg
end tell
imgInfo → {dimensions:{981.0, 922.0}}
tell application “FileMaker Pro Advanced”
set cell “ImageDimensions” of current record to imgInfo
end tell

the image name and file path are all calculated on a per record basis and it runs on a loop through a series of records…
It works great… some of the time… but periodically, I get an error -2753 “The variable is not defined. (-2753)” except that the variable IS defined globally in the line “property theImg : {}”
I’ve occasionally gotten the same error when testing the exact same script through Applescript (as in copy/paste from a calculation field in FileMaker getting the exact info the script would receive as it runs through its loop), but if I quit Applescript and relaunch it and paste the same script into a new script window it will run fine. Because of this I’m not sure if it’s a FileMaker issue, an Applescript issue, or even possibly an issue with my computer itself… any input would be MUCH appreciated!
Thanks
Zeyhra
2(Mac Mini OSX 10.5.8 with FileMaker Pro 11) + Mac Mini OSX 10.5.8 with FileMaker Pro Advanced 11 + Mac Mini OSX Server 10.6.7 with FileMaker Server Advanced 11

The file path of theImg you are supplying is a Finder style path. You do not have this path inside of a Finder tell block so maybe you’re getting errors because Image Events does not understand that path type. You could first use the Finder to convert that path type into a type Image events could use.

Second, why are you using “as text” at the end of you “set imgInfo” line? That doesn’t make sense. I also see a couple other minor errors. Finally you do not need the property. Property values are remembered between script launches and I don’t think you want that. You don’t need it and that could cause an error if the image is deleted from your computer. Try this…

tell application "Finder"
set theImg to ("H-DSpudConte38374S.jpg" of folder "H-D_Spud_Contest" of folder "04" of folder "2011" of folder "biker_events_rallies" of folder "Articles" of folder "WEB-TPI-LiveSite" of disk "MothraShare") as alias
end tell

tell application "Image Events"
set thisImage to open theImg
set imgInfo to dimensions of thisImage
close thisImage
end tell

set imgDimensions to "{" & ((item 1 of imgInfo) as text) & ", " & ((item 2 of imgInfo) as text) & "}"

tell application "FileMaker Pro Advanced"
set cell "ImageDimensions" of current record to imgDimensions
end tell