Skip to content

Instantly share code, notes, and snippets.

@haschdl
Created September 12, 2023 20:55
Show Gist options
  • Save haschdl/0187b9068c27f16a7b731cc67b0ff827 to your computer and use it in GitHub Desktop.
Save haschdl/0187b9068c27f16a7b731cc67b0ff827 to your computer and use it in GitHub Desktop.
Reload web pages to different windows and set their location using Rectangle Pro
-- List of URLs and layout keys
set urlLayoutList to {¬
{URL:"https://nok.se", layout:"left-half"}, ¬
{URL:"https://translate.google.com/?sl=en&tl=sv", layout:"top-right"}, ¬
{URL:"https://translate.google.com/?sl=sv&tl=en", layout:"bottom-right"} ¬
}
repeat with i from 1 to length of urlLayoutList
set urlLayout to item i of urlLayoutList
set urlItem to URL of urlLayout
set layoutItem to layout of urlLayout
-- display dialog "Page: " & urlItem & " Layout: " & layoutItem
tell application "Safari"
make new document with properties {URL:urlItem}
activate
delay 1
end tell
set layoutStr to "rectangle-pro://execute-action?name=" & layoutItem
do shell script "open -g \"" & layoutStr & "\""
end repeat
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment