Re: Newbie FaceSpan/Applescript question
Re: Newbie FaceSpan/Applescript question
- Subject: Re: Newbie FaceSpan/Applescript question
- From: Ted Wood <email@hidden>
- Date: Wed, 13 Dec 2000 17:26:47 -0800
>
> Date: Wed, 13 Dec 2000 14:36:49 -0500
>
> From: Chad Gray <email@hidden>
>
> Subject: Re: Newbie FaceSpan/Applescript question
>
>
> Im trying to make a button in Face Span that will run the Trim
>
> Characters from File Names script i download from apple.com.
>
>
> ... Can i nest On statements?
>
> that is the only thing i can think of...
>
>
No. Copy the "on set_file_name(... end set_file_name" part out
>
of the "on hilighted... end hilighted" part, then paste it to the
>
very top or the very bottom of the script window.
>
>
Handlers, ("on statements"), are all typed at "the same level" as
>
each other. You then "call" on the handlers where needed:
>
>
on doThis()
>
-- do stuff
>
end doThis
>
>
on doThat()
>
-- do stuff
>
end doThat
>
>
on doAll()
>
my doThis()
>
my doThat()
>
end doAll
>
Hi Chad,
Do you know what script objects are? Basically, it's like having
scripts within scripts. This is how you need to nest your 'on'
statements.
Consider the following:
script myScript
on doMyScript()
script yourScript
on doYourScript()
end doYourScript
end script
end doMyScript
end script
As you can see, I've successfully nested on statements within each
other. AppleScript treats each script object (beginning with script)
as a separate script with a separate Run statement. I'm just learning
how to use script objects effectively, so I don't want to confuse you
too much with my jargon. Check out the AppleScript Language Guide for
more details.
Ted.