I'm trying to make code which allows me to open my favourite websites with the click of a button, and with all my passwords saved on my mac log in at the same time, i keep experiencing a problem i cant fix when i try to run this all it says is "Can't get button returned of {{button returned:"Facebook"}}." I'm very new to this so can someone help me fix this problem?
tell application "Finder"
set x to {display dialog "Which site would you like to visit?" buttons {"Facebook", "Twitter", "Gmail"} default button 1}
if button returned of the result is "Facebook" then
tell application "Safari"
activate
open location "http://facebook.com/"
tell application "System Events"
activate
keystroke return
end tell
end tell
end if
end tell
tell application "Finder"
set x to {display dialog "Which site would you like to visit?" buttons {"Facebook", "Twitter", "Gmail"} default button 1}
if button returned of the result is "Facebook" then
tell application "Safari"
activate
open location "http://facebook.com/"
tell application "System Events"
activate
keystroke return
end tell
end tell
end if
end tell