• 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: multi input form
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: multi input form


  • Subject: Re: multi input form
  • From: Paul Skinner <email@hidden>
  • Date: Tue, 09 Mar 2010 09:50:44 -0500

On Mar 8, 2010, at 2:20 PM, Michele (Mike) Hjorleifsson wrote:

What is the best / easiest way to do a multi-field input form in applescript ?



What about just doing a dialog series?

set fieldNameList to {"First Name", "Last Name", "City", "State"}
set userData to getMultiFieldUserInput(fieldNameList)


on getMultiFieldUserInput(fieldNameList)
set inputValues to {}
--prepare a list to hold user values.
repeat length of fieldNameList times
set the end of inputValues to ""
end repeat
--Loop through fields 
repeat with i from 1 to length of fieldNameList
set fieldName to item i of fieldNameList
set dataSummary to ""
--Build current data summary
repeat with ii from 1 to length of fieldNameList
set dataSummary to dataSummary & (item ii of fieldNameList & " : " & item ii of inputValues & return)
end repeat
--Build data request prompt
set promptText to "Please provide the " & fieldName & return & return & dataSummary
set defaultAnswer to item i of fieldNameList
set userInput to ""
--Ask for data and Don't take no for an answer
repeat while userInput is in {"", defaultAnswer}
set userInput to text returned of (display dialog promptText default answer defaultAnswer)
end repeat
--Store valid user data
set item i of inputValues to userInput
set userInput to ""
end repeat
--Maybe ask user to confirm their completed data?
return inputValues
end getMultiFieldUserInput

 _______________________________________________
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

References: 
 >multi input form (From: "Michele (Mike) Hjorleifsson" <email@hidden>)

  • Prev by Date: KosmicTask 1.0 released
  • Next by Date: Write image data to file
  • Previous by thread: Re: multi input form
  • Next by thread: Re: multi input form
  • Index(es):
    • Date
    • Thread