Can someone upload a macro that demonstraights this? I am trying to get my head wrapped around all the things that %TriggerValue% can do and this one has me stumped I have tried from multiple angles triggering the macro from another macro returning different values from the AppleScript, running the AppleScript in the macro itself. All i get is empty quotes for what is being returned for the %TriggerValue%.
Also it seems that there is no way to see what is returned for this in the Value Inspector if I am not mistaken. I have just been displaying it larger with
Also I have no idea what the following means.
"Status Menu or Palette The current modifiers (Note that Option means “edit this macro instead of triggering it”)."
Here I've triggered my web search macro, after adding the Display Text action, and you can see the trigger display in the text window. (This also works when set to "Display text large," but that leads to a messier screen shot :).
Thank you for the reply. I have been able to get the option to show for a hotkey trigger but not for anything returned from an AppleScript.
Script trigger Although not technically a trigger, when a Macro is executed via AppleScript the %TriggerValue% token will contain the passed parameter.
Are you saying you're triggering a macro with an AppleScript, and that's returning nothing in %TriggerValue% when you add a Display Text action to the triggered macro?
I think the "Script Trigger" entry is talking about KMEngine's "do script".
Try this:
Make a macro with a display in window %TriggerValue%
Make sure it is selected in the Editor
Go to Script Editor. Paste, save and run this:
use AppleScript version "2.4" -- Yosemite (10.10) or later
use scripting additions
set currentMacroID to ""
tell application id "com.stairways.keyboardmaestro.editor"
try
set currentMacroID to id of (item 1 of (selected macros as list))
on error
display dialog "please select a macro in the Keyboard Maestro Editor"
return ""
end try
end tell
tell application id "com.stairways.keyboardmaestro.engine"
do script currentMacroID with parameter "do script sez, \"Sender:\"" & (POSIX path of (path to me))
end tell
Your macro should display: "do script sez, Sender: file path to your AppleScript
Can you explain what you mean by "anything returned from an AppleScript"?
When you execute a macro via AppleScript the %TriggerValue% token will contain whatever parameter the AS passed to the macro. So for the macro "Display TriggerValue" containing
running the script
tell application "Keyboard Maestro Engine"
do script "Display TriggerValue" with parameter "3"
end tell