Skip to content

Instantly share code, notes, and snippets.

@OKsign
Created April 11, 2018 07:47
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save OKsign/07c988c3405a6c2562a9eade4ae9667c to your computer and use it in GitHub Desktop.
Save OKsign/07c988c3405a6c2562a9eade4ae9667c to your computer and use it in GitHub Desktop.
<?xml version="1.0"?>
<root>
<vkopenurldef>
<name>KeyCode::VK_OPEN_URL_92</name>
<url type="shell">
osascript -e '
-- user input ('OnOff'-> 0 = Off, 1 = On)
-- group1
set OnOff_G1 to 0
set contain1 to {"item1"}
set search1 to "search"
-- group2
set OnOff_G2 to 0
set contain2 to {"item1"}
set search2 to "search"
-- group3
set OnOff_G3 to 0
set contain3 to {"item1"}
set search3 to "search"
-- group4
set OnOff_G4 to 0
set contain4 to {"item1"}
set search4 to "search"
-- group5
set OnOff_G5 to 0
set contain5 to {"item1"}
set search5 to "search"
-- group6
set OnOff_G6 to 0
set contain6 to {"item1"}
set search6 to "search"
-- group7
set OnOff_G7 to 0
set contain7 to {"item1"}
set search7 to "search"
-- group8
set OnOff_G8 to 0
set contain8 to {"item1"}
set search8 to "search"
-- group9
set OnOff_G9 to 0
set contain9 to {"item1"}
set search9 to "search"
-- group10
set OnOff_G10 to 0
set contain10 to {"item1"}
set search10 to "search"
-- end of user input
tell application "System Events"
keystroke "l" using command down
delay 0.5
keystroke "c" using command down
end tell
delay 0.5
set copURL to the clipboard
delay 0.02
-- group1
if OnOff_G1 = 1 then
set ans to 0
repeat with j in contain1
if copURL contains j then
set y to 1
set ans to ans + y
if ans is equal to (count contain1) then
tell application "Keychain Access"
activate
end tell
delay 0.2
repeat 100 times
tell application "System Events"
set activeApp to (get name of first process where it is frontmost)
end tell
if activeApp is "Keychain Access" then
exit repeat
end if
end repeat -- 100 times
delay 0.07
tell application "System Events"
tell process "Keychain Access"
try
click menu item "Keychain Access" of menu 1 of menu bar item "Window" of menu bar 1
end try
end tell
delay 0.2
keystroke "f" using {command down, option down}
delay 0.2
keystroke search1
return
end tell
end if -- ans is equal to (count contain1)
end if -- copURL contains j
end repeat
end if -- OnOff_G1 = 1
-- group2
if OnOff_G2 = 1 then
set ans to 0
repeat with j in contain2
if copURL contains j then
set y to 1
set ans to ans + y
if ans is equal to (count contain2) then
tell application "Keychain Access"
activate
end tell
delay 0.2
repeat 100 times
tell application "System Events"
set activeApp to (get name of first process where it is frontmost)
end tell
if activeApp is "Keychain Access" then
exit repeat
end if
end repeat -- 100 times
delay 0.07
tell application "System Events"
tell process "Keychain Access"
try
click menu item "Keychain Access" of menu 1 of menu bar item "Window" of menu bar 1
end try
end tell
delay 0.2
keystroke "f" using {command down, option down}
delay 0.2
keystroke search2
return
end tell
end if -- ans is equal to (count contain2)
end if -- copURL contains j
end repeat
end if -- OnOff_G2 = 1
-- group3
if OnOff_G3 = 1 then
set ans to 0
repeat with j in contain3
if copURL contains j then
set y to 1
set ans to ans + y
if ans is equal to (count contain3) then
tell application "Keychain Access"
activate
end tell
delay 0.2
repeat 100 times
tell application "System Events"
set activeApp to (get name of first process where it is frontmost)
end tell
if activeApp is "Keychain Access" then
exit repeat
end if
end repeat -- 100 times
delay 0.07
tell application "System Events"
tell process "Keychain Access"
try
click menu item "Keychain Access" of menu 1 of menu bar item "Window" of menu bar 1
end try
end tell
delay 0.2
keystroke "f" using {command down, option down}
delay 0.2
keystroke search3
return
end tell
end if -- ans is equal to (count contain3)
end if -- copURL contains j
end repeat
end if -- OnOff_G3 = 1
-- group4
if OnOff_G4 = 1 then
set ans to 0
repeat with j in contain4
if copURL contains j then
set y to 1
set ans to ans + y
if ans is equal to (count contain4) then
tell application "Keychain Access"
activate
end tell
delay 0.2
repeat 100 times
tell application "System Events"
set activeApp to (get name of first process where it is frontmost)
end tell
if activeApp is "Keychain Access" then
exit repeat
end if
end repeat -- 100 times
delay 0.07
tell application "System Events"
tell process "Keychain Access"
try
click menu item "Keychain Access" of menu 1 of menu bar item "Window" of menu bar 1
end try
end tell
delay 0.2
keystroke "f" using {command down, option down}
delay 0.2
keystroke search4
return
end tell
end if -- ans is equal to (count contain4)
end if -- copURL contains j
end repeat
end if -- OnOff_G4 = 1
-- group5
if OnOff_G5 = 1 then
set ans to 0
repeat with j in contain5
if copURL contains j then
set y to 1
set ans to ans + y
if ans is equal to (count contain5) then
tell application "Keychain Access"
activate
end tell
delay 0.2
repeat 100 times
tell application "System Events"
set activeApp to (get name of first process where it is frontmost)
end tell
if activeApp is "Keychain Access" then
exit repeat
end if
end repeat -- 100 times
delay 0.07
tell application "System Events"
tell process "Keychain Access"
try
click menu item "Keychain Access" of menu 1 of menu bar item "Window" of menu bar 1
end try
end tell
delay 0.2
keystroke "f" using {command down, option down}
delay 0.2
keystroke search5
return
end tell
end if -- ans is equal to (count contain5)
end if -- copURL contains j
end repeat
end if -- OnOff_G5 = 1
-- group6
if OnOff_G6 = 1 then
set ans to 0
repeat with j in contain6
if copURL contains j then
set y to 1
set ans to ans + y
if ans is equal to (count contain6) then
tell application "Keychain Access"
activate
end tell
delay 0.2
repeat 100 times
tell application "System Events"
set activeApp to (get name of first process where it is frontmost)
end tell
if activeApp is "Keychain Access" then
exit repeat
end if
end repeat -- 100 times
delay 0.07
tell application "System Events"
tell process "Keychain Access"
try
click menu item "Keychain Access" of menu 1 of menu bar item "Window" of menu bar 1
end try
end tell
delay 0.2
keystroke "f" using {command down, option down}
delay 0.2
keystroke search6
return
end tell
end if -- ans is equal to (count contain6)
end if -- copURL contains j
end repeat
end if -- OnOff_G6 = 1
-- group7
if OnOff_G7 = 1 then
set ans to 0
repeat with j in contain7
if copURL contains j then
set y to 1
set ans to ans + y
if ans is equal to (count contain7) then
tell application "Keychain Access"
activate
end tell
delay 0.2
repeat 100 times
tell application "System Events"
set activeApp to (get name of first process where it is frontmost)
end tell
if activeApp is "Keychain Access" then
exit repeat
end if
end repeat -- 100 times
delay 0.07
tell application "System Events"
tell process "Keychain Access"
try
click menu item "Keychain Access" of menu 1 of menu bar item "Window" of menu bar 1
end try
end tell
delay 0.2
keystroke "f" using {command down, option down}
delay 0.2
keystroke search7
return
end tell
end if -- ans is equal to (count contain7)
end if -- copURL contains j
end repeat
end if -- OnOff_G7 = 1
-- group8
if OnOff_G8 = 1 then
set ans to 0
repeat with j in contain8
if copURL contains j then
set y to 1
set ans to ans + y
if ans is equal to (count contain8) then
tell application "Keychain Access"
activate
end tell
delay 0.2
repeat 100 times
tell application "System Events"
set activeApp to (get name of first process where it is frontmost)
end tell
if activeApp is "Keychain Access" then
exit repeat
end if
end repeat -- 100 times
delay 0.07
tell application "System Events"
tell process "Keychain Access"
try
click menu item "Keychain Access" of menu 1 of menu bar item "Window" of menu bar 1
end try
end tell
delay 0.2
keystroke "f" using {command down, option down}
delay 0.2
keystroke search8
return
end tell
end if -- ans is equal to (count contain8)
end if -- copURL contains j
end repeat
end if -- OnOff_G8 = 1
-- group9
if OnOff_G9 = 1 then
set ans to 0
repeat with j in contain9
if copURL contains j then
set y to 1
set ans to ans + y
if ans is equal to (count contain9) then
tell application "Keychain Access"
activate
end tell
delay 0.2
repeat 100 times
tell application "System Events"
set activeApp to (get name of first process where it is frontmost)
end tell
if activeApp is "Keychain Access" then
exit repeat
end if
end repeat -- 100 times
delay 0.07
tell application "System Events"
tell process "Keychain Access"
try
click menu item "Keychain Access" of menu 1 of menu bar item "Window" of menu bar 1
end try
end tell
delay 0.2
keystroke "f" using {command down, option down}
delay 0.2
keystroke search9
return
end tell
end if -- ans is equal to (count contain9)
end if -- copURL contains j
end repeat
end if -- OnOff_G9 = 1
-- group10
if OnOff_G10 = 1 then
set ans to 0
repeat with j in contain10
if copURL contains j then
set y to 1
set ans to ans + y
if ans is equal to (count contain10) then
tell application "Keychain Access"
activate
end tell
delay 0.2
repeat 100 times
tell application "System Events"
set activeApp to (get name of first process where it is frontmost)
end tell
if activeApp is "Keychain Access" then
exit repeat
end if
end repeat -- 100 times
delay 0.07
tell application "System Events"
tell process "Keychain Access"
try
click menu item "Keychain Access" of menu 1 of menu bar item "Window" of menu bar 1
end try
end tell
delay 0.2
keystroke "f" using {command down, option down}
delay 0.2
keystroke search10
return
end tell
end if -- ans is equal to (count contain10)
end if -- copURL contains j
end repeat
end if -- OnOff_G10 = 1
'
</url>
</vkopenurldef>
<item>
<name>My Key 92: Search in Keychain Access Based on URL_Hold K</name>
<identifier>My Key 92: Search in Keychain Access Based on URL_Hold K</identifier>
<only>FIREFOX,SAFARI,GOOGLE_CHROME,OPERA</only>
<autogen>
--HoldingKeyToKey--
KeyCode::K, ModifierFlag::NONE,
@begin
KeyCode::K,
@end
@begin
KeyCode::VK_OPEN_URL_92,
@end
Option::NOREPEAT,
</autogen>
</item>
</root>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment