I'm just getting started playing around with Applescript and I seem to have run into a small problem.
I'm asking a yes/no question and I want to do either continue the script or return to the main loop depending on the answer, but I'm not sure what I'm doing wrong - any suggestions would be most welcome.
The code:
if warn_before_sending is "yes" then display dialog "does this work: " & "" buttons {"No", "Yes"}
if dialog reply is "No" then
set update to "No"
else
set update to "Yes"
end if
if update is equal to "yes" then
display dialog "UPDATING YES! : " & update & return
end if
Any ideas what I'm missing?
Thanks!
I'm asking a yes/no question and I want to do either continue the script or return to the main loop depending on the answer, but I'm not sure what I'm doing wrong - any suggestions would be most welcome.
The code:
if warn_before_sending is "yes" then display dialog "does this work: " & "" buttons {"No", "Yes"}
if dialog reply is "No" then
set update to "No"
else
set update to "Yes"
end if
if update is equal to "yes" then
display dialog "UPDATING YES! : " & update & return
end if
Any ideas what I'm missing?
Thanks!
-
Re: Applescript dialog trouble
Mon, March 19, 2007 - 2:51 PMI'm not AppleScript fluent, so this might be off-base, but I do notice that you set update to "Yes" (uppercase Y) then check for "yes" (lowercase y).
-
Re: Applescript dialog trouble
Mon, March 19, 2007 - 11:21 PMIn case anyone was wondering...
Original:
if warn_before_sending is "yes" then display dialog "does this work: " & "" buttons {"No", "Yes"}
Fixed:
if warn_before_sending is "yes" then set the_reply to display dialog button returned of "Is this working: " buttons {"No", "Yes"}
However, in the end I changed the variable warn_before_sending to boolean, which changed the line again
set warn_before_sending to true (* at the top of the script where I declare my variables *)
if warn_before_sending and "Yes" is button returned of (display dialog "Is this working: " & the_status & return & "" buttons {"No", "Yes"}) then ...