Using the "Choose Folder..." Dialog from an AppleScript

A

automandc

I am writing a script that needs to prompt the user to select a folder. As a
"cheat" I have a dialog pop up telling the user to select the folder in the
main window, and then after they click the button I get the "displayed
feature" of the main window. This is not ideal for a number of reasons
(e.g., the dialog has to be run outside of the "tell Entourage" block, and if
the executing script gets moved to the background the dialog can be lost).

Entourage has the handy "Choose Folder..." dialog that it uses when you
select, e.g., "Move Message" (Shift-Command-M by default). I am wondering if
there is a way to take advantage of that functionality in my own script. I
am willing to hack in XCode and Obj-C if necessary and provided a good nudge
in the right direction.

If anyone has thoughts on how to accomplish this, or even a good resource I
could refer to, I would be very grateful.

(I sent a "feedback" to MS asking that they expose this dialog through the
scripting interface, but I am not holding my breath for that to come true
anytime soon. I'd love to hear from the developer(s) at the MBU who work on
the AppleScript functionality in Office just to dispel my growing sense that
AppleScript is a dying art form).

TIA
 
W

William Smith [MVP]

automandc said:
I am writing a script that needs to prompt the user to select a folder. As a
"cheat" I have a dialog pop up telling the user to select the folder in the
main window, and then after they click the button I get the "displayed
feature" of the main window. This is not ideal for a number of reasons
(e.g., the dialog has to be run outside of the "tell Entourage" block, and if
the executing script gets moved to the background the dialog can be lost).

Your script relies on a user selecting a folder before execution. Correct?

I suggest just doing a simple check of the currently selected item's
properties and verifying the selected item is a folder. If it's
something other than a folder then simply display a dialog telling the
user to select a folder and then exit the script.
Entourage has the handy "Choose Folder..." dialog that it uses when you
select, e.g., "Move Message" (Shift-Command-M by default). I am wondering if
there is a way to take advantage of that functionality in my own script. I
am willing to hack in XCode and Obj-C if necessary and provided a good nudge
in the right direction.

Sorry, this dialog is not accessible via AppleScript. Application
dialogs other than the Finder's Open, Choose Folder, etc., are rarely,
if ever, available for scripting. You would need to create your own
dialog using something like the "choose from list" command.

Hope this helps!

--

bill

Entourage Help Page <http://entourage.mvps.org/>
Entourage Help Blog <http://blog.entourage.mvps.org/>
YouTalk <http://nine.pairlist.net/mailman/listinfo/youtalk>
Twitter: follow <http://twitter.com/meck>
 
A

automandc

Actually, I want the user to be able to select a folder while the script is
executing. I am creating my own "auto archive" solution, and I want the user
to be able to select the source and destination folders while creating a new
rule.

Having access to that function would be really helpful in making more
interactive scripts.

Thanks for the reply.
 
D

Diane Ross

See if this script will help you.

<http://www.entourage.mvps.org/downloads/scripts/allen/File Msgs in Fo
lder%20v4%5cmocF.zip>

<http://tinyurl.com/6brn6c>

Script description: With one or more messages selected, this lets you type
in a few characters of a folder's name and moves the messages to that
folder. If the match is inconclusive, it presents a listing of the folders
with the first match selected and lets you select the one you want.
Remembers last folder picked for fast repeat operations. Shortcut assigned:
Cmd-Shift-M, and typing the folder name, will accomplish ALMOST the same
thing, and about in the same time.)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top