Hi everyone,
I’m working on streamlining a script a bit and I want it to prompt for a file in a particular folder all the time. Using “choose file” automatically opens up the user’s home directory first. Is there any way around this?
Hi everyone,
I’m working on streamlining a script a bit and I want it to prompt for a file in a particular folder all the time. Using “choose file” automatically opens up the user’s home directory first. Is there any way around this?
Try this(changing the path as appropriate, of course :P)
choose file default location alias "myHardDrive:Users:Username:Desktop:foldername:"
Default location is the key.
Have fun,
Jim Neumann
BLUEFROG
Thanks a lot!
If I could beg one more question, is there a way to pass the selected folders between runnings of the same script?
E.g. Person runs the script, chooses file “MyFile” in folder “MyFolder” from the desktop. Script runs successfully and exits
If they run the script again, can it default to look back in “MyFolder”?
Yep you can do that with properties and here is an example =)
property defaultFolder : path to desktop
set myFile to (choose file default location defaultFolder)
tell application "Finder" to set defaultFolder to ((container of myFile) as alias)
So long as you don’t actually modify or recompile the script it will retain the value of defaultFolder across runs