newbie applescript question

dr_gonzo

Registered
hey y'all!

I started to learn a bit of applescript but it's a bit weird. I want to have a GUI frontend to a perl script that I created.

I built the GUI with Interface Builder. It has an NSSearchField called search and an NSTextView called resultArea. I want a search item to be put into the search field, the perl script run with an argument of the search item and then the output of that perl script to be displayed in the resultArea.

The script fails to build with an error message, "Expected end of line but found identifier. (-2741)". The error points to this line, "set searchWord to contents of search field "search" as text". I presume text is not the proper name for the data type. I'd appreciate any help.


Here's the code below:

on action theObject

tell window of theObject

try

set searchWord to contents of search field "search" as text
do shell script "/Users/gary/shell_scripts/idict/search.pl searchWord"
set results to the result
set contents of text view "resultArea" to results
on error

set contents of text view "resultArea" to "Error, something bad happened there, sorry."
end try
end tell
end action

Oh, and another thing. Is it possible to show html instead of plain text inside the NSTextView?
 
I'd really like to get my head 'round appleScript, but have precious little scripting experience (HTML's about it really). Can anyone point me in the right direction for the complete idiot's quickstart?

ta
 
Back
Top