Created
January 7, 2020 20:27
-
-
Save zachgibson/e72f3c5bbe7425e12575c812ac9cee8e to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
on replaceText(find, replace, subject) | |
set prevTIDs to text item delimiters of AppleScript | |
set text item delimiters of AppleScript to find | |
set subject to text items of subject | |
set text item delimiters of AppleScript to replace | |
set subject to subject as text | |
set text item delimiters of AppleScript to prevTIDs | |
return subject | |
end replaceText | |
tell application "Google Chrome" | |
set activeUrl to get URL of active tab of first window | |
end tell | |
set ipAddr to IPv4 address of (get system info) | |
set fullAddr to replaceText("localhost", ipAddr, activeUrl) | |
tell application "Terminal" | |
activate | |
tell application "System Events" | |
keystroke "n" using command down | |
delay 0.1 | |
keystroke "npx qrcode " & fullAddr | |
key code 36 | |
end tell | |
end tell |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment