Don't forget about your chain-of-reference:
on setAllHidden()
set hidden of image view "hunter" of window "main" to true
set hidden of image view "conrad" of window "main" to true
end setAllHidden
on clicked theObj
if title of theObject is "conrad" then
setAllHidden()
set hidden of image view "conrad" of window "main" to false
end if
end clicked
If you are going to have more and more image views that you need to
make false in the setAllHidden() subroutine, you can make your code
cleaner by using this:
on setAllHidden()
set hidden of every image view of window "main" to true
end setAllHidden()
However, the main problem with your code was that A- it didn't
reference the window (an extremely common beginner's trip-up) and
B- the thing in a window is an "image view" (that then, contains an
"image"). The AppleScript Studio Reference Guide, whilst long, is
very detailed. As well, the example applications included in /
Developer/Examples/AppleScript Studio are quite helpful, as they
show you many different techniques and samples using all the
different widgets.
HTH
Matthew Stuckwisch
Senior, Spanish and New Media
University of Alabama
On Apr 30, 2005, at 10:37 AM, Gary Beberman wrote:
My 9-year old is learning Applescript at his school. He is eager
to add an interface to his apps. I have experience building
applications in Script Editor and Facespan. But, Xcode and
Interface Builder are completely new to me.
We have started with a simple application which:
- has hidden pictures of friend of his.
- a button for each friend.
- clicking a button should hide all of the images and show the one
for his friend.
But, when we click on a button, we get this error:
Applescript Error: NSCannotCreateScriptCommandError(10)
The images are defined as hidden in interface builder. The
starting version of the script is below. Two questions:
1) What are we doing wrong?
2) Can you resource for me I can exploit to avoid dumping
similarly basic questions to this list?
on setallhidden()
set hidden of image "hunter" to true
set hidden of image "conrad" to true
end setallhidden
on clicked theObj
if title of theObj is "conrad" then
--setallhidden()
set hidden of image "conrad" to false
end if
end clicked
Thanks much!
Gary
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Applescript-studio mailing list (Applescript-
email@hidden)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/applescript-studio/guifa%
40charter.net
This email sent to email@hidden
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Student-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/student-dev/email@hidden
This email sent to email@hidden