I am trying to make an AppleScript which creates a notification when I receive a specific email.
Rules are set up, and I have a script which launches an app with the following code:
display notification "A newBuild is now available!" with title "New Build"
tell application "Safari"
activate
tell window 1
set current tab to (make new tab with properties URL:"https://latestSuccessful")
end tell
tell application "System Events"
set visible of process "Safari" to true
end tell
end tell
This launches safari and take to the the web page as soon as the notification is displayed.
Ideally I would display the notification as an Alert, with an action on the 'Show' button which then takes me to the web page. The 'Close button' naturally closes the alert.
Is this possible? Thanks in advance for any pointers.
Do you mean something like this?
set alertReply to display alert "New Build" message "A new build is now available!" buttons ["Cancel", "Show"] default button 2 giving up after 5
if button returned of alertReply is equal to "Show" then
tell application "Safari"
activate
tell window 1
set current tab to make new tab with properties {URL:"http://www.google.com"}
end tell
end tell
end if
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With