Re: Display Dialog handling trouble
Re: Display Dialog handling trouble
- Subject: Re: Display Dialog handling trouble
- From: kai <email@hidden>
- Date: Mon, 19 Mar 2007 10:40:12 +0000
On 19 Mar 2007, at 05:25, W. Thomas Leroux wrote:
I'm puttering around in Applescript again and seem to have gotten
stuck - the code:
if warn_before_sending is "yes" then set the_reply to display dialog
"Is this working: " & "" buttons {"No", "Yes"}
if the_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 & "reply:" &
the_reply
end if
Remember that AppleScript also has a built-in boolean class, Thomas.
It's generally more efficient to use this, rather making comparisons
between text values (from which Boolean values are then derived).
This simply means using true/false directly, rather than comparison
values such as "Yes"/"No".
In the following variation of your script, I've inserted some initial
code to set the variables 'warn_before_sending' (as boolean, rather
than string) and 'the_reply'. However, with the additional use of the
logical operator 'and', the dialog routine itself could be
abbreviated somewhat.
---------------------
-- initial setup code (not included in original) --
set warn_before_sending to true (* or false *)
set the_reply to "Whatever the reply was."
-- dialog routine --
if warn_before_sending and "Yes" is button returned of ¬
(display dialog "Is this working?" buttons {"No", "Yes"}) then ¬
display dialog "UPDATING YES!: " & return & "reply: " & the_reply
---------------------
---
kai
_______________________________________________
Do not post admin requests to the list. They will be ignored.
AppleScript-Users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
Archives: http://lists.apple.com/archives/applescript-users
This email sent to email@hidden