From 005194f90201d4d5fc144210fa41d2c87a8bbcc7 Mon Sep 17 00:00:00 2001 From: Hamid Ghadyani Date: Thu, 12 Mar 2020 01:12:39 -0400 Subject: [PATCH] more :retab for AppleScript - God damn it, Script Editor... --- res/workflow/get-current-url.applescript | 112 +++++++++++------------ 1 file changed, 56 insertions(+), 56 deletions(-) diff --git a/res/workflow/get-current-url.applescript b/res/workflow/get-current-url.applescript index 10e1cc3..8f1e9be 100644 --- a/res/workflow/get-current-url.applescript +++ b/res/workflow/get-current-url.applescript @@ -100,7 +100,7 @@ on run set theURL to item 1 of theResult set theText to item 2 of theResult - else if theApplication is "Microsoft Edge.app" and appIsRunning("Microsoft Edge") then + else if theApplication is "Microsoft Edge.app" and appIsRunning("Microsoft Edge") then set theResult to run script "tell application id \"com.microsoft.edgemac\" set theText to title of active tab of first window set theURL to get URL of active tab of first window @@ -111,80 +111,80 @@ on run else if theApplication is "qutebrowser.app" and appIsRunning("qutebrowser") then set theResult to run script "tell application id \"org.qt-project.Qt.QtWebEngineCore\" - activate - end tell - tell application \"System Events\" - set myApp to name of first application process whose frontmost is true - end tell - if myApp is \"qutebrowser\" then - tell application \"System Events\" - key code 53 -- ESC - delay 0.5 + activate end tell - tell application \"System Events\" -- yank url - keystroke \"y\" - delay 0.4 - keystroke \"y\" + tell application \"System Events\" + set myApp to name of first application process whose frontmost is true end tell - delay 0.5 - set theURL to (get the clipboard as Unicode text) + if myApp is \"qutebrowser\" then + tell application \"System Events\" + key code 53 -- ESC + delay 0.5 + end tell + tell application \"System Events\" -- yank url + keystroke \"y\" + delay 0.4 + keystroke \"y\" + end tell + delay 0.5 + set theURL to (get the clipboard as Unicode text) - tell application \"System Events\" -- yank title - keystroke \"y\" - delay 0.4 - keystroke \"t\" - end tell - delay 0.5 - set theTitle to (the clipboard as Unicode text) - end if - do shell script \"pbcopy < /dev/null\" - return {theURL, theTitle}" + tell application \"System Events\" -- yank title + keystroke \"y\" + delay 0.4 + keystroke \"t\" + end tell + delay 0.5 + set theTitle to (the clipboard as Unicode text) + end if + do shell script \"pbcopy < /dev/null\" + return {theURL, theTitle}" set theURL to item 1 of theResult set theText to item 2 of theResult else if theApplication is "Firefox.app" and appIsRunning("Firefox") then set theResult to run script "tell application id \"org.mozilla.firefox\" - activate - set w to item 1 of window 1 - set theText to name of w - end tell - tell application \"System Events\" - set myApp to name of first application process whose frontmost is true - if myApp is \"Firefox\" then + activate + set w to item 1 of window 1 + set theText to name of w + end tell tell application \"System Events\" - key code 97 + set myApp to name of first application process whose frontmost is true + if myApp is \"Firefox\" then + tell application \"System Events\" + key code 97 + delay 0.5 + keystroke \"c\" using command down + end tell + delay 0.5 + end if delay 0.5 - keystroke \"c\" using command down end tell - delay 0.5 - end if - delay 0.5 - end tell - set theURL to get the clipboard - return {theURL, theText}" + set theURL to get the clipboard + return {theURL, theText}" set theURL to item 1 of theResult set theText to item 2 of theResult else if {"Firefox Developer Edition.app", "FirefoxDeveloperEdition.app"} contains theApplication and appIsRunning("Firefox") then set theResult to run script "tell application id \"org.mozilla.firefoxdeveloperedition\" - activate - set w to item 1 of window 1 - set theText to name of w - end tell - tell application \"System Events\" - set myApp to name of first application process whose frontmost is true - if myApp is \"Firefox\" then + activate + set w to item 1 of window 1 + set theText to name of w + end tell tell application \"System Events\" - keystroke \"l\" using command down + set myApp to name of first application process whose frontmost is true + if myApp is \"Firefox\" then + tell application \"System Events\" + keystroke \"l\" using command down + delay 0.5 + keystroke \"c\" using command down + end tell + delay 0.5 + end if delay 0.5 - keystroke \"c\" using command down end tell - delay 0.5 - end if - delay 0.5 - end tell - set theURL to get the clipboard - return {theURL, theText}" + set theURL to get the clipboard + return {theURL, theText}" set theURL to item 1 of theResult set theText to item 2 of theResult