Skip to content

Commit 83cd01b

Browse files
author
anttiharju
committed
Inline applescript
1 parent 33bcc5e commit 83cd01b

File tree

3 files changed

+14
-17
lines changed

3 files changed

+14
-17
lines changed

gpr

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -58,11 +58,20 @@ fi
5858
SCRIPT_DIR=$(dirname "$(realpath "$0")")
5959

6060
# Get urls of open Safari tabs via AppleScript.
61-
bin="$SCRIPT_DIR/helpers/get_safari_urls.scpt"
62-
if [ ! -e "$bin" ]; then
63-
osacompile -o "$bin" "$SCRIPT_DIR/helpers/get_safari_urls.applescript"
64-
fi
65-
urls=$(osascript "$bin")
61+
urls=$(osascript << 'EOA'
62+
tell application "Safari"
63+
set windowList to every window
64+
set urlList to {}
65+
repeat with aWindow in windowList
66+
set tabList to every tab in aWindow
67+
repeat with aTab in tabList
68+
set end of urlList to URL of aTab
69+
end repeat
70+
end repeat
71+
return urlList
72+
end tell
73+
EOA
74+
)
6675
IFS=', ' # Convert the output to a list
6776

6877
for url in $urls; do

helpers/.gitignore

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1 @@
1-
get_safari_urls.scpt
21
gclone.cache

helpers/get_safari_urls.applescript

Lines changed: 0 additions & 11 deletions
This file was deleted.

0 commit comments

Comments
 (0)