file opening with GUI?

Me Again

Could someone please inform me if it is possible to pass a POSIX file path to a file selection dialog box using applescript and have the file selection window open a file without user interaction?

Cheers

David

pass the whole path to the file and press open

how would I do that through GUI ?

By using the control/shift g and the entering the full file path?

thanks again

I take it back, you can only specify folders in the sheet.

Then probably the only way is to parse the rows of the window to find the proper line, select it and press open with GUI scripting
But this is quite complicated

if you would share this with me I would be most grateful!

As I need this automation rather urgently!

Cheers

David

no pressure please. :wink:

This is a public forum, where people try to help voluntarily in their leisure time.

No offense, but if it’s really urgent and (I assume) for commercial purpose, hire a scripter and pay for it.

This works on my machine with Leopard for TextEdit


set theFile to "Read me"

activate application "TextEdit"
tell application "System Events"
    tell process "TextEdit"
        keystroke "o" using command down
        tell window "Open"
            keystroke "g" using {command down, shift down}
            repeat until exists sheet 1
                delay 0.5
            end repeat
            tell sheet 1
                keystroke "/path/to/folder"
                click button "Go"
            end tell
            delay 0.5
            tell (1st row of outline 1 of scroll area 2 of splitter group 1 of group 2 whose value of static text 1 is theFile) to set value of attribute "AXSelected" to true
            click button "Open"
        end tell
    end tell
end tell

but the UI elements

outline 1 of scroll area 2 of splitter group 1 of group 2

could differ