Open Specific Folder in Specified Application

Hi Everyone!

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

  1. Trigger -- change path to folder you want to watch
  2. Open In -- Change app to Logic Pro X

MACRO:   Open File Using Folder Trigger [Example]

<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.**




If that does not work, then you can use these Actions to open the file:

*  [Activate a Specific Application action](
* [Select or Show a Menu Item action](
* [Type a Keystroke action]( to send ⌘⇧G to Open File Dialog
* [Insert Text by Pasting action]( 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.



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?

Here are a couple of options:

1. Build New File Path

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!"
  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.

Thanks for the ideas. Is there a way to script where you can set the file path to the newest created item in a folder.

For example if I add a new item in that folder, the variable path will be set to that new item (without having to manually select it from finder)?

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.


Actually, KM can now do that for you. See:
Finding the most recently added/modified/created file