I'd like to trigger a specific deck when a certain Finder window is open, for tasks that I use frequently that are related to the folder shown in that window. I tried to get the name of the window from the UI but it doesn't seem to show the name.
sf.ui.finder.mainWindow.getElement("AXTitleUIElement").elementClick();
I'm looking for the name or path of the window itself (not selected items in the folder). For example if I'm working in the browser and then switch to Finder and that specific window is front and active, I want a certain deck to trigger. Sometimes I have a Finder window open (selected in the sidebar) but no items are selected in the folder; I still want to access the folder name.
Is there a way to achieve this? Perhaps using command line, or applescript, or a better way? I see that the Finder menu shows the names of the current windows with a tick next to the active one.
- Christian Scheuer @chrscheuer2024-06-13 11:27:21.994Z
Try this:
log(sf.appleScript.finder.firstWindow.targetPath);
- AAndrew Sherman @Andrew_Sherman
Excellent, that gives the path just as I'm looking for. Now, is there a way to trigger a specific deck, when that specific Finder window is the front window and Finder is the front active application? I have different decks that I use for Finder that are normally used; I only want this deck to appear with that folder.
Christian Scheuer @chrscheuer2024-06-13 11:44:41.279Z
It might be easier to use a Window Trigger for that and use a "Contains" filter on the title
- AAndrew Sherman @Andrew_Sherman
Superb! Very simple, don't know how I missed the Window triggers. For somebody wanting to do this, you set up a new window trigger, When Finder is active, Window title match "ends with", and include the name of your folder in "Window title". There may be multiple folders with the same name so you may need to modify the folder name if you need it to be unique. But it works perfectly for my need.