URL Trigger ⇢ AppleScript With Parameter

I would like to create a macro who will be trigged by local URL and pass a parameter to an Applescript.

This is the trigger URL
http://127.0.0.1:4490/action.html?macro=4A91C4B8-CAC0-4850-B37B-6F1F0F0619E2&value=123456

This is the macro:

Triggered by any of the following:
Via Public Web Access
Will execute the following actions:
Set Variable “var” to Text %TriggerValue%
Execute AppleScript
Tell Application "Keyboard Maestro Engine"
if variable var exists then
set myTestString to get value of variable var
end if
end tell

But this doesn’t work. How I can pass the value “123456” to an applescript?

1 Like

See Using Keyboard Maestro Variables in an AppleScript.

I think the OP is asking "How can I run an AppleScript with different input variables"

I.E.

Clean up the mailbox "GameDeals"

~/repos/AppleScripts/apple mail scripts/move_email_older_than_date.scpt $KMVAR_GameDealsSrcMailbox $KMVAR_GameDealsDstMailbox $KMVAR_GameDealsMaxAge

Now use the same script to cleanup a different mailbox,"Deals"

Clean up the mailbox "GameDeals" 
`~/repos/AppleScripts/apple mail scripts/move_email_older_than_date.scpt $KMVAR_DealsSrcMailbox $KMVAR_DealsDstMailbox $KMVAR_DealsMaxAge`

These AppleScript actions won't work, however, since you cannot specify input variable into the script action.