I have a button for which I want to, when it’s pressed, open a website. I have the cod as
set VisitWebSite to "http://firestar-hosting.com/mac"
set the button_pressed to the button returned of the result
if the button_pressed is VisitWebSite then
Open location VisitMyWebsite
end if
The error I get is in the subject, but for a recap, the message is
Can’t get button returned of “http://firestar-hosting.com/mac”.
Not sure what I’ve done wrong.
Model: MacBookPro
AppleScript: 2.3.2
Operating System: Other
display dialog or display alert returns button returned as one of the record keys
set VisitWebSite to "http://firestar-hosting.com/mac"
display alert "Open Website" buttons {"Cancel", VisitWebSite}
set the button_pressed to the button returned of the result
if the button_pressed is VisitWebSite then
open location VisitMyWebsite
end if
I posted 3 buttons at the end of my script.
1 is to file a bug report
2 is to open the application’s website
3 is to quit
Here is my code
#Buttons
set VisitApplicationWebSite to "http://firestar-hosting.com/mac"
set FileBugReport to "http://firestar-hosting.com/mac/bugs"
display alert "Thank you for using this application. If you liked using this application, please consider donating by visiting the application website and clicking on donate. Any amount donated would be greatly appreciated.
Would you like to file a bug report? Visit the main application website?Or quit?" buttons {"FileBugReport", "VisitApplicationWebSite", "Quit"}
set the button_pressed to the button returned of the result
if the button_pressed is VisitApplicationWebSite then
open location VisitApplicationWebSite
else
if the button_pressed is FileBugReport then
open location FileBugReport
else
if the button_pressed is (quit) then
end if
end if
end if
I get the error
No result was returned from some part of this expression.
When i click on either of the 3 buttons.
You have to test for the text of the buttons, not the variables with the same names ” eg. if the button_pressed is “VisitApplicationWebSite” ., not if the button_pressed is VisitApplicationWebSite ..
#Buttons
set VisitApplicationWebSite to "http://firestar-hosting.com/mac"
set FileBugReport to "http://firestar-hosting.com/mac/bugs"
display alert "Thank you for using this application. If you liked using this application, please consider donating by visiting the application website and clicking on donate. Any amount donated would be greatly appreciated.
Would you like to file a bug report? Visit the main application website?Or quit?" buttons {"FileBugReport", "VisitApplicationWebSite", "Quit"}
set the button_pressed to the button returned of the result
if the button_pressed is "VisitApplicationWebSite" then
open location VisitApplicationWebSite
else if the button_pressed is "FileBugReport" then
open location FileBugReport
else
if the button_pressed is "Quit" then
error number -128
end if
end if