Re: Getting a handler to use a value from a different handler?
Re: Getting a handler to use a value from a different handler?
- Subject: Re: Getting a handler to use a value from a different handler?
- From: Eric C Saunders <email@hidden>
- Date: Tue, 18 Oct 2005 08:36:46 -0400
Brett Conlon wrote on 10/18/2005 01:15:57 AM:
> G'day,
>
> Here goes my first question...
>
> I have a droplet script that has a number of handlers in it.
>
> The script first calls a handler to prompt the user to enter the
> title of the DVD they are creating packshots of (eg. "Aliens").
It
> then asks them for the catalogue number of the DVD title (eg. "12345").
>
> After the script has told Photoshop to run a series of actions and
> save the resulting files into a folder on the desktop called
> PACKSHOTS another handler is called that searches the folder and
> replaces the word "Title" with the prompt results at the
> beginning... and similar for the catalogue number.
>
> When I first added the "replace" handler code the prompt
was part of
> it but I wanted to put the prompt at the very beginning of running
> the script, not at the end, and of course the replace handler has
to
> be run after the files are all created. So I created a new handler
> [AskTitle()] to run at the beginning of the on run etc.
>
> Now that the prompt is separated from the "replace" handler
I can't
> figure how to get the variable replacement_string defined in the
> first handler to be associated with the replacement_string of the
> replacement handler.
>
> I hope my explanation makes sense...
>
> Thoughts?
>
> Cheers,
>
> Cojcolds
I can think of a couple of methods. I don't know which
is most appropriate, but here is my 2 cents:
First glance indicates that you need to return the
value to the main level. To get the title, you could:
set replace_string
to AskTitle()
on AskTitle()
-- get theinfo
and check for validity here. Throw error or force compliance...
end AskTitle
Alternately, you could define replace_string as a
Global or a property at the beginning of the body of the script:
global replace_string
--OR--
property replace_string
: "" -- or whatever it initially should be set at.
on AskTitle()
-- set replace_string
to the tested and validated info you need
end AskTitle
I am not one of the gurus of the list, but have worked
on similar projects. Alas, I can not indicate which method is preferred
or more efficient, just that they work. I can tell you that defining a
property causes the value to stick (usually) between runs, so you may wish
to explore that. If you choose property, be aware that the setting you
use in the defining line is only valid until it is set somewhere else.
Eric
________________________________________________________________________
This email has been scanned for all viruses by the MessageLabs SkyScan
service._______________________________________________________________
This electronic message contains information from MeadWestvaco
Corporation or subsidiary companies, which may be confidential,
privileged or otherwise protected from disclosure. The
information is intended to be used solely by the recipient(s)
named. If you are not an intended recipient, be aware that
any review, disclosure, copying, distribution or use of this
transmission or its contents is prohibited. If you have
received this transmission in error, please notify MeadWestvaco
immediately at email@hidden.
_______________________________________________________________________
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Applescript-users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden