3

I am trying to open a file in a not so scriptable area of an application.

I got halfway there by using UI scripting to select the proper menu item, but this opens a standard file dialog.

How can I set the destination of the file dialog with Applescript?

4
  • what app is it can we see what you have tried ? Commented Mar 19, 2010 at 12:21
  • Safari, the import bookmarks dialog under file. So far I have done nothing more than a simple click "item" of "menu" of "bar", or something similar, which is working fine. Commented Mar 19, 2010 at 14:27
  • What are you trying to do? Import bookmarks into Safari? If so, you're better off importing the .plist directly into the user's directory rather than going through Safari's GUI. Commented Mar 19, 2010 at 18:17
  • How would I do the plist thing? That sounds good... Commented Mar 21, 2010 at 19:55

1 Answer 1

9

ahh ok this should get you going on the right path

   tell application "Safari"
    activate
    -- do menu select gui script first
    set posixpath to "/path/to/a/folder/that/exists"
    tell window 1
        tell application "System Events"
            keystroke "g" using {shift down, command down}
            keystroke posixpath
            delay 1
            keystroke return
        end tell
    end tell
   end tell
Sign up to request clarification or add additional context in comments.

1 Comment

I agree wiht songdogtech but this is how you set the destination folder

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.