Initializing a navigation dialog

What is the preferred way to scriptically direct a navigation box to a certain file so that then opening the box requires only clicking the “open” button? I say “preferred way” to make it sound like I know of several when in fact I don’t know any but I look smarter. :expressionless:

Prefab Player did this nicely in OS9. Is there an obj-C call method that works here? I’ve been slogging through… but I’m not really sure where to look.

(Specifically I want to navigate to a file for a Quark 6 Get Picture… menu selection, not that that’s significant.)

Thanks very much for any assistance…

I need moe specific info to help you.

If you are trying to quickly get an open or get picture dialog box to goto a folder quickly try:
This utility is well worth the cost.


Thanks CarbonQuark. What I’m actually looking for is the ability to specify a particular PDF file (whose location I know) as the picture I want to place in a Quark picture box. Since it’s a PDF file I have to extract a particular page from it, so I can’t just say “set image 1 of picture box 1 of…” because I need the special Get Picture… PDF dialog so I can select the page number of the PDF document.

Sorry, should have been clearer. Thanks for responding.

  • Dan

I’m afraid I can’t really help with the Quark side of things, Dan - but this sort of thing should be possible in theory. All I can really do is outline how I’d probably try to approach it - using the File/Open command from, say, Safari (or TextEdit) by way of demonstration.

The first job is to locate the data that determines the default directory for the navigation dialog. In the case of this example, it’s the value of a property list item labelled NSNavLastCurrentDirectory in the ~/Library/Preferences/ file. (It’s obviously a good idea to store a copy of the plist file before you start messing with it - just in case things go horribly pear-shaped.)

Since the relevant property may not necessarily be present in the file, it might be possible to force its appearance by manually selecting a file a few times in the application. The demo routine below should create the property (if missing) - or simply modify the existing one.

From there, it’s just a matter of calling the navigation dialog and selecting the required file (both of which are achieved here using a little UI keystroke subterfuge):

to open_file from a at f
    activate application a
    set p to POSIX path of (path to preferences) & "" & a & ".plist"
    tell application "System Events"
        tell property list file p to set value to {|NSNavLastCurrentDirectory|:POSIX path of f's container} & value
        keystroke "o" using command down
        keystroke (ASCII character 29) & f's displayed name
    end tell
end open_file

open_file from "Safari" at alias "full:path:to:required:file" (* modify path as required *)

The specific approach will normally vary between individual applications, depending on their general behaviour and plist name/location/structure. However, as indicated earlier, the above routine should also work if the last line is changed to:

open_file from "TextEdit" at alias "full:path:to:required:file"

Thanks Kai - excellent response as usual. Coincidentally, in the intervening hours since my post it occurred to me that I might be able to use Quark’s .plist file to direct things with something like

but even though I specified the filename the dialog would open with only the containing folder “/path/to/” selected. Not surprisingly, though, I still learn something from your example - I didn’t know about the “tell property list…” syntax you provide. I’ll try the approach you suggest now.

I think you (we?) are on the right track.

Again, much obliged…(and thanks for sending me to Wikepedia - don’t you know that once I’m there I start following other links and, well, my self-discipline is pear-shaped! ;))

  • Dan

I sometimes throw in stuff like that if I suspect a phrase I’ve used might be specific to this corner of the globe, Dan. I’m a bit like you, I’m afraid - following links all over the place. (So much to learn, so little time…) :wink:

Good luck with the plist stuff. I’ll try and check in later to see how you’re doing. :slight_smile: