How do i make applescript type certain things such as urls into the url bar? I've been trying to set up my computers so I don't take 9 years to set everything up when I need to work. I have most of it ready but I can't figure this part out... Can someone help me?
This works with following AppleScript lines:
tell application "Safari" open location "https://google.ch" activate end tell
In my case browser, Safari, I do the following: 1. Set Safari to open new windows with favorite
Now when you launched Safari or when you write an AppleScript to activate Safari.app, Safari opens with URL box ready. From then you can just type in your desired URL.
My example script below will open a new tab by pressing Command+T (key code 17), then started typing in "google.com"
tell application "Safari" to activate tell application "System Events" key code 17 using command down keystroke "google.com
If your computer is slower, you may find adding delays (denoted in seconds) between command lines helpful:
tell application "Safari" to activate tell application "System Events" delay 0.5 key code 17 using command down delay 0.1 keystroke "google.com