Creating an Alias of a File Selected in Path Finder

How can I create an alias of a file using KM and move it to a specified folder?

The way I want it to work is:

  • I select a file in path finder
  • I press a shortcut
  • An alias for the selected file/folder is created and it is put in a specified folder in the KM’s macro.

Something like that ?
Alias in Folder.kmmacros (5.2 KB)

Change the hot key and the destination folder as you like ...

I think the scripts in this topic are well worth a closer look, especially this one.

Hey @nexgen,

If you want an alias rather than a symlink the simplest way is:

------------------------------------------------------------
set targetFolder to alias ((path to home folder as text) & "test_directory:KM_TEST:")

tell application "Path Finder"
  set selectedItemList to selection
  repeat with theItem in selectedItemList
    set (contents of theItem) to POSIX path of theItem
  end repeat
end tell

repeat with theItem in selectedItemList
  set (contents of theItem) to alias POSIX file theItem
end repeat

tell application "Finder"
  repeat with theItem in selectedItemList
    make new alias file at targetFolder to theItem
  end repeat
end tell
------------------------------------------------------------

This will handle one or more items selected in Path Finder.

The scripts Tom has pointed to use ASObjC and the File Manager and will be faster for multiple items, although they'll take some modification to do what you want.

-Chris

1 Like