Mac Help Forums


Reply
Thread Tools Display Modes

Problem with Ford's "AppleScript Studio Programming..."

 
New Member
Join Date: Jan 2007
Location: Questa, NM
Posts: 1
 
      5th January 2007
As an experienced Objective-C programmer, but a complete beginner with AppleScript Studio, I'm stumped on page 57. My test program, "Fortune Teller" compiles and begins to run, but when I enter a question, "What's up, doc?" and push the "Ask" button, I get an alert:
AppleScript Error
NSReceiverEvaluationScriptError: 4(1)

Duh! What do I do now?
--rollos <(E-Mail Removed)>
 
Reply With Quote
 
 
 
 
New Member
Join Date: Jan 2007
Posts: 1
 
      26th January 2007
Hi Rollos, I know you posted that two weeks ago but I've only just seen your post.

It's nothing you've done that's causing the script to fail- there are huge holes in what the book is telling you (that you'll notice if you keep working through it).

If I'm honest I'm amazed the book was published in the state its in- and you may have noticed if you go onto the website to download the sourcecode (as advised within the book) it downloads a WINDOWS executable. For a book on MAC OS PROGRAMMING.

Thanks.

Anyway back to your question- the problem with the script as it stands is that:

1 - neither the main window, nor the text field, are defined as having anything to do with the applescript,
2 - neither are named.

what you need to do is go to Interface Builder and click anywhere on the main window. Select the inspector window from the tools menu. On the dropdown at the top of the inspector window select Applescript. In the Name field type "Main", and then click the checkbox for xxxx.applescript at the bottom of the window (where xxxx is your script name- most probably 'Fortune Teller' or something like that.

then, go back to your window and, this time, click the text box. On the inspector window, go to Applescript and type 'textbox' as the name and, once again, click the xxxx.applescript at the bottom of the inspector.

Now hopefully your script should work (I don't have Xcode in front of me right now so I hope I've not missed anything- let me know if it works).

Also I hope you can see from what we've done, what was missing. Everything has to link in Applescript Studio- and you'll notice in Ford's script he has

'.... contents of text field "textbox" of window "main" ....' but he doesn't explain the need to name the text field or window- and nor does he link them to any Applescript event. The error you're receiving is from the script not knowing what to do with the 'set question to....' line.

Anyway good luck - Applescript Studio is a superb (and fun) way to make Apps so it's worth persevering. It does, also, deserve a much better book that Ford's to open it up to people.

Jamie.
 
Reply With Quote
 
 
 
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Applescript Studio - How to... Ric AppleScript Studio 26 26th November 2010 06:54 AM
M4868 Apple Studio display 21" problem Frank Perrey Hardware 0 8th May 2006 07:30 AM
EyeTV 410 export to DVD Studio Problem. Paul Reading Video Hardware 1 25th January 2005 12:03 AM
? LP to CD & Sound Studio problem Anti-spam Mac 7 13th January 2005 05:33 AM
Formac Studio output problem - purple screen!? Jim Witte Video Hardware 0 11th May 2004 03:47 AM


All times are GMT +1. The time now is 01:48 AM.
Mac-Help.com is an independent website and is not affiliated with Apple Inc.


Welcome!
Welcome to the Mac Help Forums
 


Latest Threads
Flash software cant be viewed in new macs
vivhope (9 Hours Ago, 03:51 PM)

can't text certain contacts
hannahroseviolin (14 Hours Ago, 11:14 AM)

iMac user running Logic 9, slow and sluggish across the board...
EddieBanda (23 Hours Ago, 02:08 AM)

Equals sign won't type
frisbeecat (1 Day Ago, 01:01 AM)

help with external hard drive transfer
Marilyn (1 Day Ago, 11:19 PM)