• 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: Prompt to open file or folder
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Prompt to open file or folder


  • Subject: Re: Prompt to open file or folder
  • From: "J. Stewart" <email@hidden>
  • Date: Mon, 24 Jul 2006 07:13:10 -0400

On 7/24/06 at +1100 Brett Conlon said this

>Is there syntax to allow a user to choose a file OR folder from the one
>navigation window and then have the result tested for its class or do I
>have to have the user answer a question first like "Do you want to check a
>file or a folder?" with appropriate buttons?

Look at the 'choose file' and 'choose folder' commands in the StandardAdditions.osax as a place to start.

here's an example that's a bit simplistic.

--> Cut <--
display dialog "Pick \"File\" or \"Folder\"" buttons {"File", "Folder"}
if button returned of result is "File" then
	set picked to (choose file with prompt "Choose a file")
else
	set picked to (choose folder with prompt "Choose a folder")
end if

log (info for of picked)
--> Cut <--

Run this with event logging turned on in your script editor and take a look at the properties returned by this line of code -

log (info for of picked)

"info for" is also in the StandardAdditions.osax.

JBS
--
How do you tell when you're out of invisible ink?
 _______________________________________________
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: Prompt to open file or folder
      • From: Emmanuel <email@hidden>
References: 
 >Prompt to open file or folder (From: Brett Conlon <email@hidden>)

  • Prev by Date: Re: Choose Application
  • Next by Date: Re: Choose Application
  • Previous by thread: Prompt to open file or folder
  • Next by thread: Re: Prompt to open file or folder
  • Index(es):
    • Date
    • Thread