I’m not running this query at this point, it is just breaking on trying to form the string. Is there a restriction to how long a string can be in AS-S? It will run if the string is set to this:
set queryString to "INSERT INTO photorecord VALUES ('" & logNum & "', '" & fileNum & "', '" & facName & "', '" & facCity & "', '"
Your string looks fine to me. I don’t think that is your problem but I’m no expert.
In my experience with this error - a NSReceiverEvaluationScriptError is usually a syntax error in the way you are targeting an item. For example:
This will return a NSReceiverEvaluationScriptError error if you dont use a tell or specify the window of theObject
set MY_TEXT to contents of text field “MY_TEXT_FIELD”
Solutions
set MY_TEXT to contents of text field “MY_TEXT_FIELD” of window “MAIN”
or
tell window “MAIN”
set MY_TEXT to contents of text field “MY_TEXT_FIELD”
end tell
or
set MY_TEXT to contents of text field “MY_TEXT_FIELD” of window of theObject
Check your code for this kind of problem. It could also be a misspelling (i.e. of window “MIAN” instead of “MAIN”
Off topic: I don’t see any imediate answers to your problem, but I thought I would offer something that may make the above line a little easier to read.
implode("', '", {logNum, fileNum, facName, facCity, facState, thisLocation, model, empStatus, punCode, punName, punFreq, photographer, photoType, issueDate, theKeywords, restrictions, resDesc})
set queryString to "INSERT INTO photorecord VALUES ('" & result & "')"
on implode(separator, pieces)
try
set ASTID to AppleScript's text item delimiters
set AppleScript's text item delimiters to {separator}
set pieces to "" & pieces
set AppleScript's text item delimiters to ASTID
end try
return pieces
end implode
Assuming that this popup button exists in a window only add the window at the end of your code line (see below). If it exists in a drawer, custom view or anything else you will need to add the path for these as well.
try:
set facState to current menu item of popup button "ddFacState" of window of theObject
or
set facState to current menu item of popup button "ddFacState" of window "YOUR_WINDOW_NAME_HERE"
or (use this if you are collecting more than one item; put all items within tell block)
tell window of theObject -- or - tell window "YOUR_WINDOW_NAME_HERE"
set facState to current menu item of popup button "ddFacState"
end tell