Created
October 30, 2018 09:19
-
-
Save OKsign/170f8f30156221cf8326e09c464868c0 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_75.6-1</name> | |
<url type="shell"> | |
osascript -e ' | |
try | |
if application "Firefox" is not running then | |
do shell script "> ~/Desktop/mykey75checkfirefox12345678987654321.txt" | |
end if | |
end try | |
' | |
</url> | |
</vkopenurldef> | |
<vkopenurldef> | |
<name>KeyCode::VK_OPEN_URL_75.6-2</name> | |
<url type="shell"> | |
osascript -e ' | |
tell application "System Events" | |
set activeApp to (get name of first process where it is frontmost) | |
end tell | |
delay 2 | |
-- added 2018-10-21_07.55.16 | |
set theFile to (path to desktop as text) & "mykey75checkfirefox12345678987654321.txt" | |
delay 0.9 | |
tell application "Finder" | |
if exists file theFile then | |
delay 0.5 | |
do shell script "rm ~/Desktop/mykey75checkfirefox12345678987654321.txt" | |
delay 0.5 | |
if application "Firefox" is running then | |
tell application "Firefox" | |
activate | |
delay 1.5 | |
quit | |
end tell | |
end if | |
end if | |
end tell | |
-- end added 2018-10-21_07.55.16 | |
delay 1.5 | |
tell application activeApp | |
activate | |
delay 1 | |
end tell | |
if activeApp is "Google Chrome" then | |
tell application "System Events" | |
tell process "Google Chrome" | |
click (menu item 1 where its name starts with "Clear Browsing") of menu 1 of menu bar item "Chrome" of menu bar 1 | |
end tell | |
end tell | |
delay 0.02 | |
tell application "Google Chrome" | |
repeat 200 times | |
set TW to (get title of front window) | |
delay 0.02 | |
if TW is "Settings" then | |
exit repeat | |
end if | |
end repeat | |
set TW to (get title of front window) | |
delay 0.02 | |
if TW is not "Settings" then | |
return | |
end if | |
end tell | |
delay 4 | |
-- clear basic | |
tell application "System Events" | |
key code 36 | |
end tell | |
-- end clear basic | |
-- clear advan | |
tell application "System Events" | |
delay 4 | |
key code 51 using {command down, shift down} | |
delay 3 | |
repeat 1 times | |
delay 0.03 | |
key code 48 | |
end repeat | |
key code 124 | |
delay 0.03 | |
key code 36 | |
delay 0.03 | |
repeat 12 times | |
delay 0.04 | |
key code 48 | |
end repeat | |
delay 0.2 | |
key code 36 | |
-- end clear advan | |
delay 1.5 | |
-- back to basic tab | |
key code 51 using {command down, shift down} | |
delay 3 | |
repeat 1 times -- changed | |
delay 0.03 | |
key code 48 | |
end repeat | |
delay 0.03 | |
key code 123 | |
delay 0.03 | |
key code 36 | |
delay 0.03 | |
key code 53 | |
delay 0.03 | |
keystroke "w" using command down | |
-- end back to basic tab | |
end tell | |
tell application "Google Chrome" | |
if (count window) is not equal to 0 then | |
repeat 200 times | |
set TW to (get title of front window) | |
delay 0.02 | |
if TW is not "Settings" then | |
exit repeat | |
end if | |
end repeat | |
set TW to (get title of front window) | |
delay 0.02 | |
if TW is "Settings" then | |
return | |
end if | |
else | |
display notification "Done!" with title "My Key 75.6: Clear Browsing Data" | |
end if | |
end tell | |
tell application "System Events" | |
delay 0.03 | |
display notification "Done!" with title "My Key 75.6: Clear Browsing Data" | |
end tell | |
set theFile to (path to desktop as text) & "mykey75checkfirefox12345678987654321.txt" | |
delay 0.9 | |
tell application "Finder" | |
if exists file theFile then | |
delay 0.5 | |
do shell script "rm ~/Desktop/mykey75checkfirefox12345678987654321.txt" | |
delay 0.5 | |
if application "Firefox" is running then | |
tell application "Firefox" | |
quit | |
end tell | |
end if | |
end if | |
end tell | |
end if -- activeApp is "Google Chrome" | |
if activeApp is "Safari" then | |
tell application "System Events" | |
keystroke "c" using {command down, option down, shift down, control down} -- set keyboard shortcut in System Preferences | |
delay 0.5 | |
repeat 3 times | |
key code 48 | |
delay 0.04 | |
end repeat | |
delay 0.5 | |
key code 49 | |
delay 0.03 | |
display notification "Done!" with title "My Key 75.6: Clear Browsing Data" | |
end tell | |
set theFile to (path to desktop as text) & "mykey75checkfirefox12345678987654321.txt" | |
delay 0.9 | |
tell application "Finder" | |
if exists file theFile then | |
delay 0.5 | |
do shell script "rm ~/Desktop/mykey75checkfirefox12345678987654321.txt" | |
delay 0.5 | |
if application "Firefox" is running then | |
tell application "Firefox" | |
quit | |
end tell | |
end if | |
end if | |
end tell | |
end if -- activeApp is "Safari" | |
if activeApp is "Firefox" then | |
tell application "System Events" | |
keystroke "c" using {command down, option down, shift down, control down} -- set keyboard shortcut in System Preferences | |
end tell | |
delay 0.02 | |
tell application "Firefox" | |
repeat 200 times | |
set TW to (get name of front window) | |
delay 0.02 | |
if TW is "Clear All History" or TW is "Clear Recent History" then | |
exit repeat | |
end if | |
end repeat | |
set WinList to {"Clear All History", "Clear Recent History"} | |
set TW to (get name of front window) | |
delay 0.02 | |
if TW is not in WinList then | |
return | |
end if | |
end tell | |
delay 0.5 | |
tell application "System Events" | |
key code 36 | |
end tell | |
tell application "Firefox" | |
repeat 200 times | |
set WinList to {"Clear All History", "Clear Recent History"} | |
set TW to (get name of front window) | |
delay 0.02 | |
if TW is not in WinList then | |
exit repeat | |
end if | |
end repeat | |
set WinList to {"Clear All History", "Clear Recent History"} | |
set TW to (get name of front window) | |
delay 0.02 | |
if TW is in WinList then | |
return | |
end if | |
delay 0.03 | |
display notification "Done!" with title "My Key 75.6: Clear Browsing Data" | |
end tell | |
end if -- activeApp is "Firefox" | |
if activeApp is "Opera" then | |
tell application "System Events" | |
tell process "Opera" | |
click (menu item 1 where its name starts with "Clear Browsing") of menu 1 of menu bar item "Opera" of menu bar 1 | |
end tell | |
end tell | |
delay 0.02 | |
set TW to "Preferences - Clear Browsing Data" | |
tell application "System Events" | |
tell process "Opera" | |
repeat 200 times | |
if menu item TW of menu 1 of menu bar item "Window" of menu bar 1 exists then | |
exit repeat | |
end if | |
delay 0.02 | |
end repeat | |
if menu item TW of menu 1 of menu bar item "Window" of menu bar 1 exists then | |
delay 0.01 | |
else | |
return | |
end if | |
end tell | |
end tell | |
delay 0.5 | |
tell application "System Events" | |
key code 36 | |
end tell | |
tell application "System Events" | |
tell process "Opera" | |
set TW to "Preferences - Clear Browsing Data" | |
repeat 200 times | |
if menu item TW of menu 1 of menu bar item "Window" of menu bar 1 exists then | |
delay 0.01 | |
else | |
exit repeat | |
end if | |
delay 0.01 | |
end repeat | |
if menu item TW of menu 1 of menu bar item "Window" of menu bar 1 exists then | |
return | |
end if | |
end tell | |
end tell | |
delay 0.02 | |
tell application "System Events" | |
keystroke "w" using command down | |
delay 0.03 | |
display notification "Done!" with title "My Key 75.6: Clear Browsing Data" | |
end tell | |
set theFile to (path to desktop as text) & "mykey75checkfirefox12345678987654321.txt" | |
delay 0.9 | |
tell application "Finder" | |
if exists file theFile then | |
delay 0.5 | |
do shell script "rm ~/Desktop/mykey75checkfirefox12345678987654321.txt" | |
delay 0.5 | |
if application "Firefox" is running then | |
-- added | |
tell application "Firefox" | |
activate | |
delay 1.5 | |
-- end added | |
quit | |
end tell | |
tell application "Firefox" | |
quit | |
end tell | |
end if | |
end if | |
end tell | |
end if -- activeApp is "Opera" | |
' | |
</url> | |
</vkopenurldef> | |
<item> | |
<name>My Key 75.6: Clear Browsing Data in Safari,Chrome,Firefox,Opera_Hold C</name> | |
<identifier>My Key 75.6: Clear Browsing Data in Safari,Chrome,Firefox,Opera_Hold C</identifier> | |
<only>OPERA,GOOGLE_CHROME,SAFARI,FIREFOX</only> | |
<autogen> | |
--HoldingKeyToKey-- | |
KeyCode::C, ModifierFlag::NONE, | |
@begin | |
KeyCode::C, | |
@end | |
@begin | |
KeyCode::VK_OPEN_URL_75.6-1, | |
KeyCode::VK_OPEN_URL_75.6-2, | |
@end | |
Option::NOREPEAT, | |
</autogen> | |
</item> | |
</root> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment