Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Prompt to open file or folder



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:
http://lists.apple.com/mailman/options/applescript-users/email@hidden

This email sent to email@hidden

References: 
 >Prompt to open file or folder (From: Brett Conlon <email@hidden>)



Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.