Automating Browser Bookmarks Import From Chrome to Safari with AppleScript
Are you tired of the repetitive task of importing bookmarks and history from Google Chrome to Safari?
The AppleScript we’re discussing performs several actions: it quits both Safari and Chrome, waits for a moment, then restarts Safari and initiates the import process. Here’s the script in its entirety:
on run {input, parameters}
(* Your script goes here *)
set SecondsDelay1 to 5
set SecondsDelay2 to 1
tell application "Safari" to quit
tell application "Google Chrome" to quit
delay SecondsDelay1
tell application "Safari" to activate
tell application "System Events" to tell process "Safari"
click menu bar item "File" of menu bar 1
click menu item "Import From" of menu "File" of menu bar item "File" of menu bar 1
click menu item "Google Chrome…" of menu "Import From" of menu item "Import From" of menu "File" of menu bar item "File" of menu bar 1
delay SecondsDelay2
if exists window 1 then
click checkbox "Passwords" of sheet 1 of window 1
click checkbox "History" of sheet 1 of window 1
click button "Import" of sheet 1 of window 1
repeat until static text "Finished importing from Google Chrome" of sheet 1 of window "Start Page" exists
end repeat
click button "OK" of sheet 1 of window "Start Page"
keystroke "q" using command down
delay SecondsDelay2
end if
end tell
return input
end run
Automation can save you countless clicks and a significant amount of time. With this script as a starting point, you can begin to explore the vast potential of automating your workflow on macOS.
Happy scripting!