I have built an AppleScript for this action, what is does:
-
Gets a link from a KM variable.
The target URL may be extracted from xpath using @JmichaelTX's script Copy the url address of the xPath -
Opens target URL in a new Safari tab, on the right after current active tab
-
If KM variable with the target link is blank then a new tab won't be opened
The code:
tell application "Keyboard Maestro Engine"
set myASVar to getvariable "Link"
tell application "Safari"
activate
tell window 1 of application "Safari"
get index of current tab
set myActiveTab to current tab
if myASVar is not "" then
set myTab to make new tab at after myActiveTab with properties {URL:myASVar}
end if
end tell
end tell
end tell