Set selection in Default Folder X

I wonder if anyone has found a way to tell Default Folder X to select a specific file.

My aim is to get a list of files in KBM and then tell another application (in this case LiquidText) to open them in turn.

LiquidText is not scriptable, but I can select the menu item telling it to read in a document. At that point a Default Folder X selection window opens.

Telling Default Folder X to go to a specific folder is straightforward.

set theFolder to POSIX file "/Users/name/dir"
tell application "Default Folder X"
    SwitchToFolder theFolder
end tell

I have not, however, figured out how to get Default Folder X to select a specific file. Thoughts?

Have you tried using the KM Open a File or Folder Action and specifying LiquidText as the App to use to open the file? (I.E. this would be instead of trying to open the file using LiquidText’s menu and would bypass Default Folder X.)

https://wiki.keyboardmaestro.com/action/Open_a_File_Folder_or_Application

2 Likes

Amazingly enough, that works. I tried it some time ago with an earlier version of the app and it didn't. You could knock me over with a feather. Anyway, thanks!

Although I would still love to be able to select a file in Default Folder X...

This is how I do that:

Go To Path DFX.kmactions (1.9 KB)

Screenshot

1 Like

Default Folder X usually makes really clear distinctions between files and folders.

The Default Folder X AppleScript dictionary reads:

SwitchToFolder v : show a folder in an open file dialog
   SwitchToFolder file : the folder

And yet, it works! SwitchToFolder will select a file and not just a folder. So much for documentation!

Thanks!

1 Like