Thanks for sharing.
AppleScript is still a bit confusing to me so let me ask you:
1 - I want this macro to allow me to pick a different destination, instead of having it set to Desktop. So in this case I would create a variable using the %FrontWindowName% token that I could then use with AS when creating the alias (this would be the destination folder)
2 - I want the macro to pause after copying the path of the file/folder and only when I hit the shortcut (in this case Control+V) will it create the alias
I still have a hard time understanding the whole POSIX thing. Sometimes I see it using "as alias" at the end, sometimes without... so I can't really change your script to match what I want.
Also, when I add the section at the top
tell application "Keyboard Maestro Engine"
set inst to system attribute "KMINSTANCE"
end tell
Do I need to add an extra line per variable I'm using? For example if I have 2 variables I want to use that come from previous actions (let's say Local__Var1 and Local__Var2), will my initial code be like this?
tell application "Keyboard Maestro Engine"
set inst1 to system attribute "KMINSTANCE"
set inst2 to system attribute "KMINSTANCE"
end tell
Or that single line is enough and then I just set multiple variables? Like this:
tell application "Keyboard Maestro Engine"
setvariable "Local__Var1" instance inst to variable1
setvariable "Local__Var2" instance inst to variable2
end tell
Also, I noticed that you used this "Local__Selection" variable, but there's nothing on the script or the macro itself mentioning it, so I wonder if this is a typo?
setvariable "Local__Selection" instance inst to filePath
I'm also a bit confused about the first and last macros. What are they supposed to do?
What about this? What's the goal here?
-- Simulate Cmd+C to copy the file
tell application "System Events" to keystroke "c" using command down
-- Delete the alias after copying
delete newAlias
I was thinking something like this:
Copy as Alias Macro (v11.0.1)
Copy as Alias.kmmacros (30 KB)