AnsweredAssumed Answered

AppleScript compile error "Expected end of line, etc. but found class name"

Question asked by DavidH_1 on Dec 29, 2011

Title

AppleScript compile error "Expected end of line, etc. but found class name"

Post

The script below compiles fine in AppleScript editor. If I have a FM record open with a valid Apple serial number

in the "Serial Number" cell, and run the AppleScript from within the editor, it works and inserts the desired info in the other cells.

 

(If you're interested, see https://github.com/rustymyers/warranty )

When I try to create a Native AppleScript within Filemaker (again, FM Pro v11.03),

FM returns the error, "Expected end of line, etc. but found class name" on: file

for the line: set myText to read file myFile using delimiter {","} 

I'd like to know precisely why this is a problem for Filemaker, and how I can get it to accept a working AppleScript, please & thank-you :-)

The AppleScript is as follows, with the "tell application "FileMaker Pro Advanced" and corresponding "end tell"

commented out as they're not necessary once the script is (to be) setup within FM:

--tellapplication "FileMaker Pro Advanced"

tell current record

setSNLookuptocellValueofcell "Serial Number"

endtell

--endtell

 

do shell script "/Library/Scripts/WarrantyCheck/checkwarranty" & " -s " & SNLookup & " -f csv" & " -o /Library/Scripts/WarrantyCheck/"

setmyFiletoPOSIX file "/Library/Scripts/WarrantyCheck/warranty.csv" astext

set myText to read file myFile using delimiter {","}

set PurchaseDate to item 2 of myText

set ModelInfo to item 5 of myText

setWarrExptoitem 3 ofmyText

 

ifWarrExpcontains "Out of Coverage" then

set WarrStatus to WarrExp & " Est. DOP " & PurchaseDate

else

set ACareStatus to item 4 of myText

set WarrStatus to ACareStatus & " " & WarrExp

endif


--tellapplication "FileMaker Pro Advanced"

tell current record

setcell "Warranty" toWarrStatus

setcell "Computer Model" toModelInfo

endtell

--endtell

Outcomes