• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Reading contents of a text field from Interface Builder
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Reading contents of a text field from Interface Builder


  • Subject: Reading contents of a text field from Interface Builder
  • From: John Hoogstrate <email@hidden>
  • Date: Wed, 31 Dec 2008 23:18:22 +0100

Hello everybody,

I am trying to build my first Applescript application using Xcode and
Interface builder on Mac OS X 10.5. I have made a simple window that
contains a single text field and button with Interface Builder. In the
last tab of the inspector titled "AppleScript" I have given the window,
the text field and the button a unique name and selected the script
TestApp.applescript which is my only script until now.

My script contains the following code:
-- begin --

on clicked theObject

    display dialog "name " & name of theObject as text

    beep

    set contents of text field "textInput" of window "testWindow" to
"testing!!!"

end clicked

-- end --

The script compiles and runs perfectly. The event handler is triggered
when the button is clicked, it then displays a dialog with its name,
beeps, and then fails when I try to set the contents of the text field.

A window pops up with the following message:

AppleScript Error

Can’t set «class texF» "textInput" of window "testWindow" to
"testing!!!". (-10006)

I have no idea why this is not working, I have tried many variations and
double checked everything, the error code 10006 is not in Apple's online
list of AppleScript error codes. My code is based on examples of

http://developer.apple.com/documentation/applescript/conceptual/StudioBuildingApps/chapter06/chapter_6_section_6.html

and
http://homepage.mac.com/simx/technonova/publications/learning_to_refer_to_objects_in_applesc.html

These examples are based on older versions of Mac OS X, but I can't find
anything more recent.

I would also like to have some documentation that would tell me which
properties I can read and write from which objects, the compiler also
allows non-existing properties but then I get an error while running the
application.

I would be very thankful for anybody who can offer me any advice on how
to get this working.

Kind regards,

John
 _______________________________________________
Do not post admin requests to the list. They will be ignored.
AppleScript-Users mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
Archives: http://lists.apple.com/archives/applescript-users

This email sent to email@hidden

  • Prev by Date: Re: Duplicates files in iTunes after running applescript
  • Next by Date: AppleScript and Java
  • Previous by thread: Re: Duplicates files in iTunes after running applescript
  • Next by thread: AppleScript and Java
  • Index(es):
    • Date
    • Thread