Last active
July 29, 2019 19:17
-
-
Save kjaymiller/f4c4aead8fbd93c68631cff32cbfdc20 to your computer and use it in GitHub Desktop.
Weekly Update Keyboard Maestro + Quickly Get a Date with Python
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
""" | |
Use Maya and Arrow to Get a date very quickly | |
run like python get_date.py Friday' --> Returns date in DD MMM YYYY format) | |
used with keyboard meastro snippet below. | |
""" | |
import maya | |
import arrow | |
import sys | |
date = arrow.get(maya.parse(sys.argv[1]).datetime()).format('DD MMM YYYY') | |
sys.stdout.write(date) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[[source]] | |
name = "pypi" | |
url = "https://pypi.org/simple" | |
[[source]] | |
name = "pythonhosted" | |
url = "https://files.pythonhosted.org" | |
[dev-packages] | |
[packages] | |
arrow = "*" | |
maya = "*" | |
[requires] | |
python_version = "3.7" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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>DisplayKind</key> | |
<string>Variable</string> | |
<key>IncludeStdErr</key> | |
<false/> | |
<key>MacroActionType</key> | |
<string>ExecuteShellScript</string> | |
<key>Path</key> | |
<string></string> | |
<key>Source</key> | |
<string>Nothing</string> | |
<key>Text</key> | |
<string>cd <PATH TO PYTHON SCRIPT> | |
<PTYHON EXECUTABLE> get_date.py Sunday</string> | |
<key>TimeOutAbortsMacro</key> | |
<true/> | |
<key>TrimResults</key> | |
<true/> | |
<key>TrimResultsNew</key> | |
<true/> | |
<key>UseText</key> | |
<true/> | |
<key>Variable</key> | |
<string>Fri</string> | |
</dict> | |
<dict> | |
<key>DisplayKind</key> | |
<string>Variable</string> | |
<key>IncludeStdErr</key> | |
<false/> | |
<key>MacroActionType</key> | |
<string>ExecuteShellScript</string> | |
<key>Path</key> | |
<string></string> | |
<key>Source</key> | |
<string>Nothing</string> | |
<key>Text</key> | |
<string>cd <PATH TO SCRIPT LOCATION> | |
<PATH to PYTHON> get_date.py now</string> | |
<key>TimeOutAbortsMacro</key> | |
<true/> | |
<key>TrimResults</key> | |
<true/> | |
<key>TrimResultsNew</key> | |
<true/> | |
<key>UseText</key> | |
<true/> | |
<key>Variable</key> | |
<string>Today</string> | |
</dict> | |
<dict> | |
<key>Action</key> | |
<string>ByPasting</string> | |
<key>MacroActionType</key> | |
<string>InsertText</string> | |
<key>Text</key> | |
<string>Weekly Update - %Variable%Today% - %Variable%Fri%</string> | |
</dict> | |
</array> | |
</plist> |
To install with pipenv just copy and then run pipenv install
.
get the pipenv path with which pipenv --> /usr/loca/bin/pipenv
SET <PATH TO PYTHON>
in XML to the full pipenv path.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Variables that you should change in the XML to however you run python things.
<PATH TO PYTHON SCRIPT>
<PTYHON EXECUTABLE>