I'm not quite sure where this action/script came from (the AppleScript looks more complex than one I would write), but I use it all the time and its very handy. It gets the path of the front window in Preview. It should work in pre 10.9, but 10.9 or later is much easier since Preview regained its AppleScript dictionary, so the simple AppleScript:
path of document 1 of window 1 of application "Preview"
is all you really need, but packaged as a plug in is still a bit nicer.
Yes, Keyboard Maestro uses .zip as a package format for Third Party Plug In Actions as well as Status Menu Icons. I could use a different extension, but that is similarly confusing when it’s just a zip file.
That looks like something I wrote long ago and scarfed the vanilla decode routine from here, but I won't swear up and down.
You can make it generic to the front application easily enough:
tell application (get path to frontmost application as text) to set frontApp to its name
tell application "System Events"
tell process frontApp
set thefile to value of attribute "AXDocument" of (first window whose subrole is "AXStandardWindow")
end tell
end tell
if thefile ≠ missing value then
urldecode(POSIX path of POSIX file thefile)
else
error "No file has been saved!"
end if
on urldecode(theText)
# Content omitted
end urldecode
More recently I'd shell out to Perl, Python, or Ruby to do the decode, but at this point it makes more sense to use JXA.
What makes you think you can drag onto the editor?
That doesn’t work, and as far as I know never has.
Dragging to the Keyboard Maestro icon in the Dock works fine.
With .kmmacro and .kmaction files you can double-click them in the Finder or drag and drop them to the Keyboard Maestro editor’s Dock icon.
I usually use the drag and drop method with the ⇧⌃⌥⌘ keys held down, because this ensures the imported items are disabled. (Not necessary for plug-ins.)