Created
April 8, 2018 10:39
-
-
Save OKsign/fb61747defd41692aeeb7c838d204cca 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_82.2</name> | |
<url type="shell"> | |
osascript -e ' | |
-- user input | |
set T1 to {"ocr", "hhh","ap"} | |
set T2 to {"optical...", "hello","applescript"} | |
-- end of user input | |
set MaxLen to 0 | |
repeat with x in T1 | |
set Lenx to (length of x) as integer | |
if Lenx > MaxLen then | |
set MaxLen to Lenx | |
end if | |
end repeat | |
repeat MaxLen times | |
tell application "System Events" | |
key code 123 using shift down | |
delay 0.02 | |
end tell | |
end repeat | |
tell application "System Events" | |
keystroke "c" using command down | |
delay 0.5 | |
set CopT to (the clipboard as text) | |
delay 0.03 | |
repeat with x in T1 | |
delay 0.04 | |
if CopT ends with x then | |
set F1 to x | |
set LenF1 to length of F1 | |
repeat with N from 1 to (count T1) | |
delay 0.03 | |
if (item N of T1) is (F1 as text) then | |
set rWith to (item N of T2) | |
end if | |
end repeat | |
set the clipboard to rWith | |
delay 0.03 | |
tell application "System Events" | |
key code 124 | |
delay 0.03 | |
repeat LenF1 times | |
key code 51 | |
delay 0.02 | |
end repeat | |
delay 0.03 | |
keystroke "v" using command down | |
delay 0.03 | |
key code 49 | |
end tell | |
exit repeat | |
end if | |
end repeat | |
if CopT does not end with x then | |
tell application "System Events" | |
key code 124 | |
end tell | |
end if | |
end tell | |
' | |
</url> | |
</vkopenurldef> | |
<item> | |
<name>My Key 82.2: Use Autocorrect in ATOM</name> | |
<item> | |
<name>Press SEMICOLON (;)</name> | |
<identifier>My Key 82.2: Use Autocorrect in ATOM_Press SEMICOLON (;)</identifier> | |
<only>Atom</only> | |
<autogen> | |
--KeyToKey-- | |
KeyCode::SEMICOLON, ModifierFlag::NONE, | |
KeyCode::VK_OPEN_URL_82.2, | |
</autogen> | |
</item> | |
<item> | |
<name>Hold SEMICOLON (;)</name> | |
<identifier>My Key 82.2: Use Autocorrect in ATOM_Hold SEMICOLON (;)</identifier> | |
<only>Atom</only> | |
<autogen> | |
--HoldingKeyToKey-- | |
KeyCode::SEMICOLON, ModifierFlag::NONE, | |
@begin | |
KeyCode::SEMICOLON, | |
@end | |
@begin | |
KeyCode::VK_OPEN_URL_82.2, | |
@end | |
Option::NOREPEAT, | |
</autogen> | |
</item> | |
</item> | |
</root> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment