Posted on 03-22-2012 07:08 AM
Can anyone give advice on how to display a dialog/notification to users which includes a clickable URL?
displayMessage and jamfHelper are not working out for me, unless I'm not using the right syntax or formatting. AppleScript?
thanks,
Darrin
Solved! Go to Solution.
Posted on 03-28-2012 11:05 PM
So I created something like this, and just posted and open source version of it
You can find a compiled example below
https://github.com/acidprime/ClickDialog/downloads
It could be integrated into scripts like so
#!/bin/bash
declare -x ClickDialog="/Applications/ClickDialog.app/Contents/MacOS/ClickDialog"
if "$ClickDialog" ; then
echo "User clicked OK"
else
echo "User clicked cancel"
fi
Xcode Project (very basic 10 mins don't judge) below
https://github.com/acidprime/ClickDialog
Technical Details
Basically I just load a web.html file from the bundle ,matched the colors so it looks like a native element and then added a delegate method to catch the url click and redirect it to the default workspace. I added an "activate" and told it that it was a UI element so it will not show the dock icon, much like a display dialog in AppleScript
You can play with the Xcode project ( with no code changes ) if you want to make the window bigger ( in fact you can probably just edit the raw .xib file in interface builder
Posted on 03-22-2012 01:38 PM
I'm not sure there's a way to do this outside of writing a custom app. I've tried, tried and tried again to get some way for clickable URLs inside dialogs and came up empty.
In my searching, I did find some kludgy methods posted on the interwebs, such as using Applescripts with buttons that when clicked on open a URL, or even showing a list inside an Applescript and allowing the user to choose one, which then opens it.
Neither method is very good, but I'm not sure how else it can be done. But I'd love to know too!
Posted on 03-28-2012 11:05 PM
So I created something like this, and just posted and open source version of it
You can find a compiled example below
https://github.com/acidprime/ClickDialog/downloads
It could be integrated into scripts like so
#!/bin/bash
declare -x ClickDialog="/Applications/ClickDialog.app/Contents/MacOS/ClickDialog"
if "$ClickDialog" ; then
echo "User clicked OK"
else
echo "User clicked cancel"
fi
Xcode Project (very basic 10 mins don't judge) below
https://github.com/acidprime/ClickDialog
Technical Details
Basically I just load a web.html file from the bundle ,matched the colors so it looks like a native element and then added a delegate method to catch the url click and redirect it to the default workspace. I added an "activate" and told it that it was a UI element so it will not show the dock icon, much like a display dialog in AppleScript
You can play with the Xcode project ( with no code changes ) if you want to make the window bigger ( in fact you can probably just edit the raw .xib file in interface builder