Created
April 13, 2018 07:44
-
-
Save OKsign/b57ca1d74b290147f6cae0e1371c5f8b 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_93</name> | |
<url type="shell"> | |
osascript -e ' | |
set sName to "93" | |
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 93: Remove Empty Lines_Hold E</name> | |
<identifier>My Key 93: Remove Empty Lines_Hold E</identifier> | |
<autogen> | |
--HoldingKeyToKey-- | |
KeyCode::E, ModifierFlag::NONE, | |
@begin | |
KeyCode::E, | |
@end | |
@begin | |
KeyCode::VK_OPEN_URL_93, | |
@end | |
Option::NOREPEAT, | |
</autogen> | |
</item> | |
</root> | |
<!-- script-Remove Empty Lines | |
set oldClip to the clipboard | |
delay 0.02 | |
tell application "System Events" | |
keystroke "c" using command down | |
end tell | |
delay 0.7 | |
set copT to the clipboard | |
set AppleScript's text item delimiters to return | |
set a to every text item of copT | |
set ans to 0 | |
repeat with j from 1 to (count a) | |
if (text item j of a) is not "" then | |
delay 0.02 | |
set makeFirst to j | |
set y to 1 | |
set ans to ans + y | |
exit repeat | |
end if | |
end repeat | |
if ans is not equal to 0 then | |
set myT to text item makeFirst of copT | |
try | |
repeat with k from (makeFirst + 1) to (count a) | |
if (text item k of a) is not "" then | |
delay 0.02 | |
set myT to myT & " | |
" & (text item k of a) | |
end if | |
end repeat | |
end try | |
set the clipboard to myT | |
delay 0.02 | |
tell application "System Events" | |
keystroke "v" using command down | |
end tell | |
delay 0.5 | |
set the clipboard to oldClip | |
else | |
set the clipboard to oldClip | |
end if -- ans is not equal to 0 | |
--> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment