Howdy!
I’ve just started doing some applescripting today and I’m finding it a bit strange. I’m trying to build a simple GUI to a perl script that I have.
Right now I have created one window with a text field called searchField, a button which has a binding to the return key and a text area called resultArea which is non editable but has a hidden scroll bar.
I have written code for the button:
on clicked theObject
tell window of theObject
try
set searchWord to contents of text field "searchField" as string
set output to do shell script "/Users/gary/shell_scripts/idict/search.pl " & searchWord
set contents of text view "resultArea" to output
on error
set contents of text view "resultArea" to "Error, something bad happened there, sorry."
end try
end tell
end clicked
Everything works in this code except for displaying code in the resultArea. I usually get a NSReceiverEvaluationScriptError: 4 with this. From googling it seems that this error is gotten from naming variables wrong but I’ve checked my code and there aren’t any errors that I can see.
What’s strange is that when I save in the Interface Builder, this bit gets written into the editor:
on action theObject
(*Add your script here.*)
end action
This is strange as I only have two handlers set in the Interface Builder. The bit for using the perl script and for exiting the app when the window is closed.
What’s really wierd is that I cannot even run the script, it exits with errors:
2004-07-18 21:06:50.587 iDict[3764] An uncaught exception was raised
2004-07-18 21:06:50.610 iDict[3764] Cannot create BOOL from object <_NSControllerObjectProxy: 0x3369b0> of class _NSControllerObjectProxy
2004-07-18 21:06:50.623 iDict[3764] *** Uncaught exception: Cannot create BOOL from object <_NSControllerObjectProxy: 0x3369b0> of class _NSControllerObjectProxy
iDict has exited due to signal 5 (SIGTRAP).
Sorry about the big post and sorry if I’m not making myself clear but all this applescript stuff is pretty new to me. Any help would be appreciated cheers!