Bifogar lite AppleScript Studio-kod som får det hela att fungera:
-- MySQL Test.applescript
on clicked theObject
set the_window to window of theObject
set sql_bin to "/usr/local/mysql-standard-4.0.21-apple-darwin7.5.0-powerpc/bin/mysql"
set sql_connect to " -h192.168.0.3 -uwire -ptomtenisse --skip-column-names"
set sql_query to " -e\"show databases;\""
set sql_result to do shell script sql_bin & sql_connect & sql_query
set contents of text view "sql_result" of scroll view "sql_result" of window of theObject to sql_result
end clicked
MainMenu.nib innehåller bara 2 Cocoaobjekt: NSTextView (innesluten i NSScrollView) och en NSButton. Knappen kopplas till scriptet via 'Action>clicked' event handler.
Appen känns riktigt rapp, faktiskt.