Skip to content

Instantly share code, notes, and snippets.

@foeken
Last active November 5, 2023 11:40
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save foeken/c2c65c34191a1f513859ad8410802412 to your computer and use it in GitHub Desktop.
Save foeken/c2c65c34191a1f513859ad8410802412 to your computer and use it in GitHub Desktop.
Replace with reference (Tana)
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<array>
<dict>
<key>Activate</key>
<string>Normal</string>
<key>CreationDate</key>
<real>720648428.60664701</real>
<key>Macros</key>
<array>
<dict>
<key>Actions</key>
<array>
<dict>
<key>ActionUID</key>
<integer>2326</integer>
<key>MacroActionType</key>
<string>SetVariableToText</string>
<key>Text</key>
<string>;;</string>
<key>Variable</key>
<string>Postfix</string>
</dict>
<dict>
<key>ActionUID</key>
<integer>2339</integer>
<key>IsDisclosed</key>
<false/>
<key>MacroActionType</key>
<string>Comment</string>
<key>StyledText</key>
<data>
cnRmZAAAAAADAAAAAgAAAAcAAABU
WFQucnRmAQAAAC7rAQAAKwAAAAEA
AADjAQAAe1xydGYxXGFuc2lcYW5z
aWNwZzEyNTJcY29jb2FydGYyNzU3
Clxjb2NvYXRleHRzY2FsaW5nMFxj
b2NvYXBsYXRmb3JtMHtcZm9udHRi
bFxmMFxmc3dpc3NcZmNoYXJzZXQw
IEhlbHZldGljYTt9CntcY29sb3J0
Ymw7XHJlZDI1NVxncmVlbjI1NVxi
bHVlMjU1O1xyZWQwXGdyZWVuMFxi
bHVlMDt9CntcKlxleHBhbmRlZGNv
bG9ydGJsOztcY3NzcmdiXGMwXGMw
XGMwXGM4NDcwNlxjbmFtZSBjb250
cm9sVGV4dENvbG9yO30KXHBhcmRc
dHg1NjBcdHgxMTIwXHR4MTY4MFx0
eDIyNDBcdHgyODAwXHR4MzM2MFx0
eDM5MjBcdHg0NDgwXHR4NTA0MFx0
eDU2MDBcdHg2MTYwXHR4NjcyMFxw
YXJkaXJuYXR1cmFsXHBhcnRpZ2h0
ZW5mYWN0b3IwCgpcZjBcZnMyNiBc
Y2YyIENvcHkvUGFzdGUgYSBsaXN0
IG9mIFRhbmEgUGFzdGUgbm9kZXMg
aW4gdGhlIHRleHQgZmllbGQgYmVs
b3csIHJlbW92ZSBldmVyeXRoaW5n
IGJ1dCB0aGUgbGluZXMgd2l0aCBu
b2Rlcy59AQAAACMAAAABAAAABwAA
AFRYVC5ydGYQAAAAiQREZbYBAAAA
AAAAAAAAAA==
</data>
<key>Title</key>
<string>Aliases</string>
</dict>
<dict>
<key>ActionUID</key>
<integer>2325</integer>
<key>MacroActionType</key>
<string>SetVariableToText</string>
<key>Text</key>
<string></string>
<key>Variable</key>
<string>Aliases</string>
</dict>
<dict>
<key>ActionUID</key>
<integer>2324</integer>
<key>IsDisclosed</key>
<false/>
<key>MacroActionType</key>
<string>SetVariableToText</string>
<key>Text</key>
<string>%TriggerValue%</string>
<key>Variable</key>
<string>VarMatch</string>
</dict>
<dict>
<key>ActionUID</key>
<integer>2322</integer>
<key>DisplayKind</key>
<string>None</string>
<key>HonourFailureSettings</key>
<true/>
<key>IncludeStdErr</key>
<false/>
<key>IncludedVariables</key>
<array>
<string>9999</string>
</array>
<key>MacroActionType</key>
<string>ExecuteAppleScript</string>
<key>Path</key>
<string></string>
<key>Text</key>
<string>tell application "Keyboard Maestro Engine" to set postfix to getvariable "Postfix"
set postfixLength to count characters of postfix
tell application "Keyboard Maestro Engine" to set textData to getvariable "Aliases"
set textLines to paragraphs of textData
tell application "Keyboard Maestro Engine" to set originalMatch to getvariable "VarMatch"
tell application "Keyboard Maestro Engine" to setvariable "Count" to length of originalMatch
set varMatch to text 1 thru (-1 - postfixLength) of originalMatch
repeat with i from 1 to count of textLines
set currentLine to item i of textLines
set AppleScript's text item delimiters to "^"
set tmp to text items of currentLine
set AppleScript's text item delimiters to " ^"
set currentLine to tmp as text
set position to offset of varMatch in currentLine
if position &gt; 0 then
set AppleScript's text item delimiters to "^"
set textItems to text items of currentLine
set foundID to second item of textItems
set AppleScript's text item delimiters to ""
set foundID to text 1 thru -3 of foundID
set rawHTML to "&lt;meta charset=\"utf-8\"&gt;&lt;span data-inlineref-node=\"" &amp; foundID &amp; "\"&gt;&lt;/span&gt;"
set escapedData to do shell script "echo " &amp; (quoted form of rawHTML) as «class HTML»
set the clipboard to escapedData
return
end if
end repeat
set the clipboard to originalMatch</string>
<key>TimeOutAbortsMacro</key>
<true/>
<key>TrimResults</key>
<true/>
<key>TrimResultsNew</key>
<true/>
<key>UseText</key>
<true/>
</dict>
<dict>
<key>ActionUID</key>
<integer>2338</integer>
<key>Actions</key>
<array>
<dict>
<key>ActionUID</key>
<integer>2331</integer>
<key>KeyCode</key>
<integer>51</integer>
<key>MacroActionType</key>
<string>SimulateKeystroke</string>
<key>Modifiers</key>
<integer>0</integer>
<key>ReleaseAll</key>
<false/>
<key>TargetApplication</key>
<dict/>
<key>TargetingType</key>
<string>Front</string>
</dict>
</array>
<key>CountExpression</key>
<string>Count</string>
<key>MacroActionType</key>
<string>Repeat</string>
<key>TimeOutAbortsMacro</key>
<true/>
</dict>
<dict>
<key>Action</key>
<string>Paste</string>
<key>ActionUID</key>
<integer>2327</integer>
<key>IsDisclosed</key>
<false/>
<key>MacroActionType</key>
<string>CutCopyPaste</string>
<key>TimeOutAbortsMacro</key>
<true/>
</dict>
<dict>
<key>ActionUID</key>
<integer>2330</integer>
<key>KeyCode</key>
<integer>49</integer>
<key>MacroActionType</key>
<string>SimulateKeystroke</string>
<key>Modifiers</key>
<integer>0</integer>
<key>ReleaseAll</key>
<false/>
<key>TargetApplication</key>
<dict/>
<key>TargetingType</key>
<string>Front</string>
</dict>
</array>
<key>CreationDate</key>
<real>720609174.55788696</real>
<key>CustomIconData</key>
<string>KMEP-ToolbarLabels</string>
<key>ModificationDate</key>
<real>720870208.73424697</real>
<key>Name</key>
<string>Replace with reference in Tana</string>
<key>Triggers</key>
<array>
<dict>
<key>Case</key>
<string>Match</string>
<key>MacroTriggerType</key>
<string>TypedString</string>
<key>SimulateDeletes</key>
<false/>
<key>TypedString</key>
<string>[\w-]+;;</string>
</dict>
</array>
<key>UID</key>
<string>1FC1FDE5-0639-4393-A5DF-BD9956EBAD76</string>
</dict>
</array>
<key>Name</key>
<string>Tana</string>
<key>Targeting</key>
<dict>
<key>Targeting</key>
<string>Included</string>
<key>TargetingApps</key>
<array>
<dict>
<key>BundleIdentifier</key>
<string>company.thebrowser.Browser</string>
<key>Name</key>
<string>Arc</string>
<key>NewFile</key>
<string>/Applications/Arc.app</string>
</dict>
</array>
</dict>
<key>ToggleMacroUID</key>
<string>CC920045-0424-4B10-9189-688649676470</string>
<key>UID</key>
<string>DABDEB18-56DD-460D-B27E-E2240FDC1F29</string>
</dict>
</array>
</plist>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment