Wiki Suggested Update: Add Method to Retrieve plug-in Parameters

On the wiki page for plug-ins lists 2 methods for retrieving Keyboard Maestro plug-in parameters from the environment variables, a 3rd way probably needs to be added.

  1. Use AppleScript set myText to System Attribute "KMPARAM_My_Text"
    • As noted this method is "not safe for international characters" (and emoji)
  2. Use set myText to do shell script "echo $KMPARAM_My_Text"
    • This method works with emoji and international characters but multi-line text (as from a TokenText form field) will be flattened into a single line
  3. use set myText to do shell script "printenv KMPARAM_My_Text"
    • This works with emoji, international characters and multi-line text however printenv returns an error if KMPARAM_My_Text doesn't exist. You can catch this error with a try command. Final result:
try
	set myText to do shell script "printenv KMPARAM_My_Text"
on error
	set myText to ""
end try

Thanks for your suggestion.

I have made a major update to the wiki Plug In Actions.
See Wiki Update: Plug In Actions

Please review.

Looks pretty good. I didn't know about the zip install method. I was just looking at how to get GitHub to automatically create a new zip for downloading whenever I push an update. Once I figure that out I'll update my instructions. (Does it also work with updates? If I drag a zip onto the KM icon will it overwrite the existing?)

Not sure how much you want to get into debugging but for the Reload commands at the end, you can put that reload right in the your test macro right before calling your PIA and it will kick in the new code immediately and the macro will keep running.

On the parameters for the #3 printenv option you have "on error -- Parameter does NOT exit" I assume that last word should be exist?

Nope. From the Wiki article:

How to Install

PIA Install Files are .zip Archive Files

  1. Initial Install: Drop on the Keyboard Maestro app Dock icon
    • This will create a PIA sub-folder by the same name as the .zip file
    • Do not unzip the file
  2. To Update An Existing PIA
    1. ==First Manually Delete or Move the PIA Sub-Folder== from:
      ~/Library/Application Support/Keyboard Maestro/Keyboard Maestro Actions/ folder
    2. Then Drop the .zip file onto the Dock Icon

Good tip, but if you changed your form (Plist), then I think a reload before running the macro would be needed.

Good catch -- fixed.