How do I get a “choose folder/file with prompt” dialog to change its default sort column? I cannot find the right syntax to identify the “Choose a Folder” window.
I’ve tried the following, substituting various terms for the [bracketed terms], but nothing seems to work.
tell application “Finder”
choose folder with prompt “Select the folder you want to attach.”
set sort column of list view options of [front window] to modification date column
set sort direction of column id modification date column of list view options of [front window] to reversed
end tell
The script above runs (without the brackets, of course), but does nothing.
TIA,
S. Lehman
Misakimachi, Japan
Hi, I guess you will have to open the chosen folder first.
This works for me:
tell application "Finder"
set myFolder to (choose folder)
open myFolder
set current view of window 1 to list view
set sort column of list view options of window 1 to modification date column
set sort direction of column (modification date column) of list view options of window 1 to reversed
end tell
Good scripting
Farid
Farid,
Thanks for the reply. Unfortunately, setting the sort columns for the selected folder isn’t my problem. (That’s handled later in what is actually a longer script called from a FileMaker database.)
My problem is that the “Choose” dialog always opens with the default sort order, which means that the user invariably has to scroll through a very long list to find the target folder. If I could just get the Choose dialog to sort by Name Reversed or Modification Date Reversed, then the target folder will always be somewhere near the top of the list.
I’m begining to think that the Choose dialog is simply not scriptable… (You can call it, but you can’t change any of the default parameters.)
If there’s a way to get the window ID of the Choose dialog, then maybe I could at least get the script to focus on the correct window…
Any other ideas, anyone?
TIA,
Scott Lehman
Misakimachi, Japan