First time poster here, and user of KM for the past year and a half and love it!
I was wondering if it is possible to use any actions to navigate to a folder within a specific application, for example I use Logic Pro X, and I want to import a file from a folder every time there is a new item added in the folder. This is the current workflow I want:
Trigger: New item added in specific folder
Open/Activate Logic Pro X
Import Video File
*Navigate to that specific folder
*import new file
I can't figure out how to get KM to open the specific folder path WITHIN Logic Pro X, and then even select the specific new file that was added in the path.
Can you manually select the file, right-click, and then open in Logic Pro X? If so, then this simple macro should work.
Before You Run, Make these changes
Trigger -- change path to folder you want to watch
Open In -- Change app to Logic Pro X
MACRO: Open File Using Folder Trigger [Example]
#### DOWNLOAD:
<a class="attachment" href="/uploads/default/original/3X/1/8/188682c2bc976c5e0d8620264b8b2359ab3c1237.kmmacros">Open File Using Folder Trigger [Example].kmmacros</a> (2.3 KB)
**Note: This Macro was uploaded in a DISABLED state. You must enable before it can be triggered.**
---
![image|459x539](upload://rZT01UKa7ZiJF9d74WYZeczrmtg.jpg)
---
If that does not work, then you can use these Actions to open the file:
* [Activate a Specific Application action](https://wiki.keyboardmaestro.com/action/Activate_a_Specific_Application)
* [Select or Show a Menu Item action](https://wiki.keyboardmaestro.com/action/Select_or_Show_a_Menu_Item)
* [Type a Keystroke action](https://wiki.keyboardmaestro.com/action/Type_a_Keystroke) to send ⌘⇧G to Open File Dialog
* [Insert Text by Pasting action](https://wiki.keyboardmaestro.com/action/Insert_Text_by_Pasting) the `%Local__NewFilePath%` variable
* Type a Keystroke action to send RETURN
Those are the basics. You may need to tweak by adding a pause or pause until after some Actions.
---
Questions?
Thank you for the response! My goal was to have the application actually navigate to the folder and import, not open, the file at the destination, so the second half of the macro worked out really nicely with the Command + Shift + G, but is there a way to have it automatically select the new file?
How do I create a variable for the new file that was added to the folder?
If the new file in the Import Folder has the same name, you could use this.
Be sure to change the Import Folder path in the second Action.
2. Get Path from Finder Selection
If the new file in the Import Folder is selected in the Finder when it is created, then you could use
tell application "Finder" to set fitemList to selection as alias list
if length of fitemList = 0 then
set scriptResults to "[ERROR] No files were selected in the Finder!"
else
set scriptResults to POSIX path of (item 1 of fitemList)
end if
return scriptResults
It may also be possible to use AppleScript to get the file path of the current object selected in Logic Pro X, but I don't have the app so I can't be sure or test.
You can probably use AppleScript, or Shell Script, using mdfind to get the most recent file added. Seems like that has been posted in another topic in this forum. You might try searching the forum.