Skip to content

Instantly share code, notes, and snippets.

@2shortplanks
Created January 24, 2014 14:27
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save 2shortplanks/8598262 to your computer and use it in GitHub Desktop.
Save 2shortplanks/8598262 to your computer and use it in GitHub Desktop.
KeyboardMaestro macro to insert the YYYY-MM-DD n days hence
<?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>IsActive</key>
<true/>
<key>Macros</key>
<array>
<dict>
<key>Actions</key>
<array>
<dict>
<key>IsActive</key>
<true/>
<key>IsDisclosed</key>
<true/>
<key>MacroActionType</key>
<string>SetVariableToText</string>
<key>Text</key>
<string>%TriggerValue%</string>
<key>Variable</key>
<string>WhatWasTyped</string>
</dict>
<dict>
<key>DisplayKind</key>
<string>Typing</string>
<key>IsActive</key>
<true/>
<key>IsDisclosed</key>
<true/>
<key>MacroActionType</key>
<string>ExecuteShellScript</string>
<key>Path</key>
<string></string>
<key>Text</key>
<string>#!/usr/bin/perl
use DateTime;
my ($days) = $ENV{KMVAR_WhatWasTyped} =~ /(\d+)/;
print +(DateTime-&gt;today + DateTime::Duration-&gt;new( days =&gt; $days ))-&gt;ymd;</string>
<key>TimeOutAbortsMacro</key>
<true/>
<key>TrimResults</key>
<true/>
<key>TrimResultsNew</key>
<true/>
<key>UseText</key>
<true/>
</dict>
</array>
<key>IsActive</key>
<true/>
<key>ModificationDate</key>
<real>412143056.28799897</real>
<key>Name</key>
<string>hence</string>
<key>Triggers</key>
<array>
<dict>
<key>Case</key>
<string>Match</string>
<key>MacroTriggerType</key>
<string>TypedString</string>
<key>OnlyAfterWordBreak</key>
<false/>
<key>SimulateDeletes</key>
<true/>
<key>TypedString</key>
<string>hence\d+qq</string>
</dict>
</array>
<key>UID</key>
<string>D5F77F79-7D5C-4202-A41C-47FA4366489B</string>
</dict>
</array>
<key>Name</key>
<string>Time</string>
<key>UID</key>
<string>FF813DC1-9121-49ED-B553-F2569E87F855</string>
</dict>
</array>
</plist>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment