Select just .mxf files - GUI scripting

Hi,

I’m writing a script for a GUI and i just want it to select JUST .mxf files. The window that opens when selecting is a standard open/save dialog window.

I’ve managed to get it to select all files in the folder but cant get it to just select the .mxf files.

I also need it to disregard any folders in the that folder where the .mxf files are.

This is urgent and any help is greatful.

Regards

Dan

Hi Dan,

here an example using TextEdit.
The script selects always the first file which ends with “mfx” and presses the “Open” button.
If there is no match, the “Cancel” button will be pressed.
Unfortunately I couldn’t find a way to select multiple files

select (1st row whose value of static text 1 ends with ".mfx")

doesn’t work


set baseFolder to POSIX path of (choose folder)

activate application "TextEdit"
tell application "System Events"
    tell process "TextEdit"
        keystroke "o" using command down
        repeat until exists window "Open"
            delay 0.5
        end repeat
        tell window "Open"
            keystroke "g" using {command down, shift down}
            repeat until exists sheet 1
                delay 0.5
            end repeat
            tell sheet 1
                keystroke baseFolder
                click button "Go"
                delay 0.5
            end tell
            try
                tell outline 1 of scroll area 2 of splitter group 1 of group 2
                    select (1st row whose value of static text 1 ends with ".mfx")
                end tell
                click button "Open"
            on error
                click button "Cancel"
            end try
        end tell
    end tell
end tell

Stefan,

Would

select (all rows whose value of static text 1 ends with ".mfx")

work?

Cheers,

Dan

No, the script won’t even compile. All is no keyword of AppleScript or System Events,
and rows is already a synonym for every row

Stefan,

The script you wrote above doesn’t seem to work. It doesn’t select any file at all…i’m sorry if it seems like im relying on you, but you’re very good at AppleScripting!!

Any other thoughts are also welcome.

Regards,

Dan