text
stringlengths 0
15.7k
| source
stringlengths 6
112
|
---|---|
else if caseIndex is 3 then
|
keyboard.applescript
|
logger's infof("Option Pressed: {}", checkModifier("option"))
|
keyboard.applescript
|
logger's infof("Shift Pressed: {}", checkModifier("shift"))
|
keyboard.applescript
|
logger's infof("Command Pressed: {}", checkModifier("command"))
|
keyboard.applescript
|
script KeyboardInstance
|
keyboard.applescript
|
on checkModifier(keyName)
|
keyboard.applescript
|
if keyName = "option" then
|
keyboard.applescript
|
set theMask to NSAlternateKeyMask
|
keyboard.applescript
|
else if keyName = "control" then
|
keyboard.applescript
|
set theMask to NSControlKeyMask
|
keyboard.applescript
|
else if keyName = "command" then
|
keyboard.applescript
|
set theMask to NSCommandKeyMask
|
keyboard.applescript
|
else if keyName = "shift" then
|
keyboard.applescript
|
set theMask to NSShiftKeyMask
|
keyboard.applescript
|
set theFlag to NSEvent's modifierFlags() as integer
|
keyboard.applescript
|
if ((theFlag div theMask) mod 2) = 0 then
|
keyboard.applescript
|
end checkModifier
|
keyboard.applescript
|
on modifiersDown()
|
keyboard.applescript
|
set theKeys to {}
|
keyboard.applescript
|
if ((theFlag div NSAlternateKeyMask) mod 2) is not 0 then
|
keyboard.applescript
|
set end of theKeys to "option"
|
keyboard.applescript
|
if ((theFlag div NSControlKeyMask) mod 2) is not 0 then
|
keyboard.applescript
|
set end of theKeys to "control"
|
keyboard.applescript
|
if ((theFlag div NSCommandKeyMask) mod 2) is not 0 then
|
keyboard.applescript
|
set end of theKeys to "command"
|
keyboard.applescript
|
if ((theFlag div NSShiftKeyMask) mod 2) is not 0 then
|
keyboard.applescript
|
set end of theKeys to "shift"
|
keyboard.applescript
|
return theKeys
|
keyboard.applescript
|
end modifiersDown
|
keyboard.applescript
|
on isDvorak()
|
keyboard.applescript
|
getLayout() contains "DVORAK"
|
keyboard.applescript
|
end isDvorak
|
keyboard.applescript
|
on getLayout()
|
keyboard.applescript
|
do shell script "defaults read ~/Library/Preferences/com.apple.HIToolbox.plist \\
|
keyboard.applescript
|
AppleSelectedInputSources | \\
|
keyboard.applescript
|
egrep -w 'KeyboardLayout Name' | sed -E 's/^.+ = \"?([^\"]+)\"?;$/\\1/'"
|
keyboard.applescript
|
end getLayout
|
keyboard.applescript
|
on pressKey(keyToPress)
|
keyboard.applescript
|
key code my _charToKeycode(keyToPress)
|
keyboard.applescript
|
delay 0.01
|
keyboard.applescript
|
end pressKey
|
keyboard.applescript
|
on pressCommandKey(keyToPress)
|
keyboard.applescript
|
key code my _charToKeycode(keyToPress) using {command down}
|
keyboard.applescript
|
end pressCommandKey
|
keyboard.applescript
|
on pressCommandControlKey(keyToPress)
|
keyboard.applescript
|
key code my _charToKeycode(keyToPress) using {command down, control down}
|
keyboard.applescript
|
end pressCommandControlKey
|
keyboard.applescript
|
on pressCommandShiftKey(keyToPress)
|
keyboard.applescript
|
key code my _charToKeycode(keyToPress) using {command down, shift down}
|
keyboard.applescript
|
end pressCommandShiftKey
|
keyboard.applescript
|
on pressCommandOptionKey(keyToPress)
|
keyboard.applescript
|
key code my _charToKeycode(keyToPress) using {command down, option down}
|
keyboard.applescript
|
end pressCommandOptionKey
|
keyboard.applescript
|
on pressControlKey(keyToPress)
|
keyboard.applescript
|
key code my _charToKeycode(keyToPress) using {control down}
|
keyboard.applescript
|
end pressControlKey
|
keyboard.applescript
|
on pressControlShiftKey(keyToPress)
|
keyboard.applescript
|
key code my _charToKeycode(keyToPress) using {control down, shift down}
|
keyboard.applescript
|
end pressControlShiftKey
|
keyboard.applescript
|
on pressOptionKey(keyToPress)
|
keyboard.applescript
|
key code my _charToKeycode(keyToPress) using {option down}
|
keyboard.applescript
|
end pressOptionKey
|
keyboard.applescript
|
on typeText(theText)
|
keyboard.applescript
|
tell application "System Events" to keystroke theText
|
keyboard.applescript
|
end typeText
|
keyboard.applescript
|
on insertTextByPasting(theText)
|
keyboard.applescript
|
set origClipboard to the clipboard
|
keyboard.applescript
|
set origClipboard to ""
|
keyboard.applescript
|
repeat
|
keyboard.applescript
|
set the clipboard to theText
|
keyboard.applescript
|
if (the clipboard) is equal to theText then
|
keyboard.applescript
|
logger's debugf("The clipboard now equal to text to paste: {}", the clipboard)
|
keyboard.applescript
|
pressCommandKey("v") -- There's issue where incorrect value is
|
keyboard.applescript
|
delay 0.1 -- Increase the value if failure is still encountered.
|
keyboard.applescript
|
set the clipboard to origClipboard
|
keyboard.applescript
|
typeText(theText)
|
keyboard.applescript
|
end insertTextByPasting
|
keyboard.applescript
|
std's applyMappedOverride(result)
|
keyboard.applescript
|
on _charToKeycode(key)
|
keyboard.applescript
|
if key is "A" or key is "a" then return 0
|
keyboard.applescript
|
if key is "B" or key is "b" then return 11
|
keyboard.applescript
|
if key is "C" or key is "c" then return 8
|
keyboard.applescript
|
if key is "D" or key is "d" then return 2
|
keyboard.applescript
|
if key is "E" or key is "e" then return 14
|
keyboard.applescript
|
if key is "F" or key is "f" then return 3
|
keyboard.applescript
|
if key is "G" or key is "g" then return 5
|
keyboard.applescript
|
if key is "H" or key is "h" then return 4
|
keyboard.applescript
|
if key is "I" or key is "i" then return 34
|
keyboard.applescript
|
if key is "J" or key is "j" then return 38
|
keyboard.applescript
|
if key is "K" or key is "k" then return 40
|
keyboard.applescript
|
if key is "L" or key is "l" then return 37
|
keyboard.applescript
|
if key is "M" or key is "m" then return 46
|
keyboard.applescript
|
if key is "N" or key is "n" then return 45
|
keyboard.applescript
|
if key is "O" or key is "o" then return 31
|
keyboard.applescript
|
if key is "P" or key is "p" then return 35
|
keyboard.applescript
|
if key is "Q" or key is "q" then return 12
|
keyboard.applescript
|
if key is "R" or key is "r" then return 15
|
keyboard.applescript
|
if key is "S" or key is "s" then return 1
|
keyboard.applescript
|
if key is "T" or key is "t" then return 17
|
keyboard.applescript
|
if key is "U" or key is "u" then return 32
|
keyboard.applescript
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.