Created
April 4, 2018 08:59
-
-
Save OKsign/dacbffc77023cea263c01e14ffb5ac78 to your computer and use it in GitHub Desktop.
This file contains 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"?> | |
<root> | |
<vkopenurldef> | |
<name>KeyCode::VK_OPEN_URL_90</name> | |
<url type="shell"> | |
osascript -e ' | |
set sName to "90" | |
tell application "System Events" | |
tell process "SystemUIServer" | |
click (menu bar item 1 of menu bar 1 whose description is "AppleScript") | |
end tell | |
delay 0.2 | |
tell application "System Events" | |
keystroke sName | |
delay 0.2 | |
key code 36 | |
end tell | |
end tell | |
' | |
</url> | |
</vkopenurldef> | |
<item> | |
<name>My Key 90: Insert Date and Time_Hold /</name> | |
<identifier>My Key 90: Insert Date and Time_Hold /</identifier> | |
<autogen> | |
--HoldingKeyToKey-- | |
KeyCode::SLASH, ModifierFlag::NONE, | |
@begin | |
KeyCode::SLASH, | |
@end | |
@begin | |
<!-- run via script menu --> | |
KeyCode::VK_OPEN_URL_90, | |
@end | |
Option::NOREPEAT, | |
</autogen> | |
</item> | |
</root> | |
<!-- script-insert date and time | |
-- Choose format | |
-- 1: 2018-12-03_06.24.37 | |
-- 2: 12-30-2018_06.24.37 | |
-- 3: Date 2018-12-30 Time 06.24.37 | |
-- 4: Date 12-30-2018 Time 06.24.37 | |
-- 5: 2018-12-30 | 06.24.37 | |
-- 6: 12-30-2018 | 06.24.37 | |
-- 7: 2018-12_06.24 | |
-- 8: 12-2018_06.24 | |
-- 9: 2018-12 | 06.24 | |
-- 10: 12-2018 | 06.24 | |
-- user input | |
set format to 1 | |
-- end of user input | |
if format is 1 then | |
set DT to do shell script "date +%Y-%m-%d_%H.%M.%S" | |
end if | |
if format is 2 then | |
set DT to do shell script "date +%m-%d-%Y_%H.%M.%S" | |
end if | |
if format is 3 then | |
set DateTime to do shell script "date +%Y-%m-%d_%H.%M.%S" | |
set AppleScript's text item delimiters to the "_" | |
set D to "Date " & text item 1 of DateTime | |
set T to "Time " & text item 2 of DateTime | |
set DT to D & " " & T | |
end if | |
if format is 4 then | |
set DateTime to do shell script "date +%m-%d-%Y_%H.%M.%S" | |
set AppleScript's text item delimiters to the "_" | |
set D to "Date " & text item 1 of DateTime | |
set T to "Time " & text item 2 of DateTime | |
set DT to D & " " & T | |
end if | |
if format is 5 then | |
set DateTime to do shell script "date +%Y-%m-%d_%H.%M.%S" | |
set AppleScript's text item delimiters to the "_" | |
set D to text item 1 of DateTime | |
set T to text item 2 of DateTime | |
set DT to D & " | " & T | |
end if | |
if format is 6 then | |
set DateTime to do shell script "date +%m-%d-%Y_%H.%M.%S" | |
set AppleScript's text item delimiters to the "_" | |
set D to text item 1 of DateTime | |
set T to text item 2 of DateTime | |
set DT to D & " | " & T | |
end if | |
if format is 7 then | |
set DT to do shell script "date +%Y-%m_%H.%M" | |
set AppleScript's text item delimiters to the "_" | |
set D to text item 1 of DT | |
set T to text item 2 of DT | |
set DT to D & "_" & T | |
end if | |
if format is 8 then | |
set DT to do shell script "date +%m-%Y_%H.%M" | |
set AppleScript's text item delimiters to the "_" | |
set D to text item 1 of DT | |
set T to text item 2 of DT | |
set DT to D & "_" & T | |
end if | |
if format is 9 then | |
set DT to do shell script "date +%Y-%m_%H.%M" | |
set AppleScript's text item delimiters to the "_" | |
set D to text item 1 of DT | |
set T to text item 2 of DT | |
set DT to D & " | " & T | |
end if | |
if format is 10 then | |
set DT to do shell script "date +%m-%Y_%H.%M" | |
set AppleScript's text item delimiters to the "_" | |
set D to text item 1 of DT | |
set T to text item 2 of DT | |
set DT to D & " | " & T | |
end if | |
if format is 9 then | |
set DT to do shell script "date +%Y-%m_%H.%M" | |
set AppleScript's text item delimiters to the "_" | |
set D to text item 1 of DT | |
set T to text item 2 of DT | |
set DT to D & " | " & T | |
end if | |
if format is 10 then | |
set DT to do shell script "date +%m-%Y_%H.%M" | |
set AppleScript's text item delimiters to the "_" | |
set D to text item 1 of DT | |
set T to text item 2 of DT | |
set DT to D & " | " & T | |
end if | |
delay 0.2 | |
tell application "System Events" | |
keystroke DT | |
end tell | |
--> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment