• 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
Re: Using a prompt value from another handler
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Using a prompt value from another handler


  • Subject: Re: Using a prompt value from another handler
  • From: kai <email@hidden>
  • Date: Wed, 16 Nov 2005 12:21:04 +0000


On 16 Nov 2005, at 05:50, Brett Conlon wrote:

Basically the script runs the AskTitle handler to prompt the user to enter the movie title, then the AskCatNo handler to prompt for a catalog number. Then the Photoshop Action stuff is run. Inside the DoAllThis handler it prompts for the user to choose a client and packshot method and runs the appropriate PShop Action from the user response.

However I have recently realised that only the client FHE requires the user to enter a catalog number. SPHE doesn't. With the script running the way it is now, the user is prompted for a cat No no matter what client they choose.

I'd like to be able to have the CLIENT prompt first then the AskCatNo handler is run only if the user chooses the client FHE.

There are several ways you might approach this, Brett. If I've understood your description correctly, here's one possibility:


-----------------------

on run
set aFile to choose file with prompt "Please choose a file to process"
set replacement_title to AskTitle(aFile)
-- set replacement_catNo to AskCatNo(replacement_title) (* MOVED FROM HERE *)
DoAllThis(aFile, replacement_title)
ReplaceTitle(replacement_title)
-- ReplaceCatNo(replacement_catNo) (* MOVED FROM HERE *)
end run


on open filelist
repeat with aFile in filelist
set replacement_title to AskTitle(aFile)
-- set replacement_catNo to AskCatNo(replacement_title) (* MOVED FROM HERE *)
DoAllThis(aFile, replacement_title)
ReplaceTitle(replacement_title)
-- ReplaceCatNo(replacement_catNo) (* MOVED FROM HERE *)
end repeat
end open


--DO PHOTOSHOP STUFF
on DoAllThis(aFile, replacement_title)
--Prompt for Client name and Packshot type
set clientName to item 1 of (choose from list clientNames with prompt "Choose the Client:")
set packshotMethod to item 1 of (choose from list PackshotMethods with prompt "Choose Packshot type:")
--Then do this
if clientName is "FHE" then
set replacement_catNo to AskCatNo(replacement_title) (* MOVED TO HERE *)
ReplaceCatNo(replacement_catNo) (* MOVED TO HERE *)
if packshotMethod is "DVD Slick" then
display dialog "FHE DVD Slick Packshots"
--Many other "else" statements in here
end if
end if
end DoAllThis


-----------------------

Here's another (which also eliminates some of the repetition in the run and open handlers):

-----------------------

on run
	DoAllThis(choose file with prompt "Please choose a file to process")
end run

on open filelist
	repeat with aFile in filelist
		DoAllThis(aFile)
	end repeat
end open

--DO PHOTOSHOP STUFF
on DoAllThis(aFile)
set replacement_title to AskTitle(aFile)
--Prompt for Client name and Packshot type
set clientName to item 1 of (choose from list clientNames with prompt "Choose the Client:")
set clientFHE to clientName is "FHE"
if clientFHE then set replacement_catNo to AskCatNo(replacement_title)
set packshotMethod to item 1 of (choose from list PackshotMethods with prompt "Choose Packshot type:")
--Then do this
if clientFHE and packshotMethod is "DVD Slick" then
display dialog "FHE DVD Slick Packshots"
--Many other "else" statements in here
end if
ReplaceTitle(replacement_title)
if clientFHE then ReplaceCatNo(replacement_catNo)
end DoAllThis


-----------------------

---
kai


_______________________________________________ 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
  • Follow-Ups:
    • Re: Using a prompt value from another handler
      • From: Brett Conlon <email@hidden>
References: 
 >Using a prompt value from another handler (From: Brett Conlon <email@hidden>)

  • Prev by Date: Re: Web text to word
  • Next by Date: Re: 10.4.3 changed what?
  • Previous by thread: Using a prompt value from another handler
  • Next by thread: Re: Using a prompt value from another handler
  • Index(es):
    • Date
    • Thread