Use AppleScript to Login

Sep 25, 2019

applescript

Why#

I clean history of browsers very often. This makes my self-hosted services tiresome to login every time. Another reason to do this is because I want to open these services based on my Wi-Fi SSID. For example, Jellyfin will use http://192.168.1.230:8096 for home Wi-Fi, http://111.111.111.111:5002 for outside Wi-Fi. If you don't have the need to login using different url, use Keychain or 1Password to autofill the login information as other websites.

Code#

Get Wi-Fi SSID#

Set url to open#

Login#

Gitea and Nextcloud puts the cursor in username textbox by default. This makes things easier than Jellyfin.

For Jellyfin, we have to locate the UI element and click it, then it will give us the login page.

For complete key code list, check here.

Demo#

After combining those code snippets above, I create a keyword triggered workflow in Alfred. All you have to do is input the keyword "jellyfin", then everything runs automatically. Here is what it looks like.


Last Edited on Sep 25, 2019