Check Boxes in Forms

Hints, tips and tricks for newbies

Moderators: Dorian (MJT support), JRL

Post Reply
Dexter1
Pro Scripter
Posts: 64
Joined: Mon Jun 19, 2006 3:28 pm

Check Boxes in Forms

Post by Dexter1 » Tue Sep 19, 2006 7:58 pm

I have a form with check boxes and an OK button. That was easy.

Code: Select all

Dialog>Dialog3
   Caption=Dialog3
   Width=445
   Height=250
   Top=104
   Left=16
   Label=Select a database to distribute.,32,8,true
   CheckBox=msCheckBox1,Clarify Research,32,24,97,False
   CheckBox=msCheckBox2,OA Change,32,48,97,False
   Button=OK,32,72,75,25,5
EndDialog>Dialog3
I want to base an IF>THEN statement on which check box is selected on the form which, in itself, is easy.

However, I'm having trouble bridging the gap between the two. I don't know how to store the info from the form so I can use it later on in the code.

Any help will be greatly appreciated as always.
Thanks,
Josh

User avatar
JRL
Automation Wizard
Posts: 3526
Joined: Mon Jan 10, 2005 6:22 pm
Location: Iowa

Post by JRL » Tue Sep 19, 2006 10:40 pm

Something like this?

Later,
Dick

Code: Select all

Dialog>Dialog3
   Caption=Dialog3
   Width=445
   Height=250
   Top=104
   Left=16
   Label=Select a database to distribute.,32,8,true
   CheckBox=msCheckBox1,Clarify Research,32,24,97,False
   CheckBox=msCheckBox2,OA Change,32,48,97,False
   Button=OK,32,72,75,25,5
EndDialog>Dialog3

Show>dialog3,r3

If>r3=2,finish
If>%Dialog3.mscheckbox1%=True
  Let>SaveOAChangeVariableForLaterUse=True
Else
  Let>SaveOAChangeVariableForLaterUse=False
EndIF
If>%Dialog3.mscheckbox2%=True
  Let>SaveClarifyResearchVariableForLaterUse=True
Else
  Let>SaveClarifyResearchVariableForLaterUse=False
EndIF

//Do more stuff

MDL>It is %SaveOAChangeVariableForLaterUse% that OA Change was checked%CRLF%It is %SaveClarifyResearchVariableForLaterUse% that Clarify Research was checked
Label>finish
[/code]

Dexter1
Pro Scripter
Posts: 64
Joined: Mon Jun 19, 2006 3:28 pm

Post by Dexter1 » Wed Sep 20, 2006 2:57 pm

That seems to be the ticket. But I'm having a tough time calling the saved variable. Shouldn't I be able to do something like this?

Code: Select all

If>%SaveOAChangeVariableForLaterUse%=TRUE
Message>WIN!!
EndIf
Thanks,
Josh

User avatar
Marcus Tettmar
Site Admin
Posts: 7395
Joined: Thu Sep 19, 2002 3:00 pm
Location: Dorset, UK
Contact:

Post by Marcus Tettmar » Wed Sep 20, 2006 3:23 pm

Dexter1 wrote:That seems to be the ticket. But I'm having a tough time calling the saved variable. Shouldn't I be able to do something like this?

Code: Select all

If>%SaveOAChangeVariableForLaterUse%=TRUE
Message>WIN!!
EndIf
Yes, but Dick's script sets the value to either "True" or "False", never "TRUE". So change it to:

Code: Select all

If>%SaveOAChangeVariableForLaterUse%=True
Message>WIN!!
EndIf
Marcus Tettmar
http://mjtnet.com/blog/ | http://twitter.com/marcustettmar

Did you know we are now offering affordable monthly subscriptions for Macro Scheduler Standard?

User avatar
Marcus Tettmar
Site Admin
Posts: 7395
Joined: Thu Sep 19, 2002 3:00 pm
Location: Dorset, UK
Contact:

Post by Marcus Tettmar » Wed Sep 20, 2006 3:24 pm

Also, use MessageModal not Message. Message is non modal and will therefore disappear when the script completes or get overwritten with another Message call. Use MessageModal to ensure you always see it as MessageModal is modal and therefore holds up the script until you press OK.
Marcus Tettmar
http://mjtnet.com/blog/ | http://twitter.com/marcustettmar

Did you know we are now offering affordable monthly subscriptions for Macro Scheduler Standard?

Dexter1
Pro Scripter
Posts: 64
Joined: Mon Jun 19, 2006 3:28 pm

Post by Dexter1 » Wed Sep 20, 2006 5:48 pm

Ah, those pesky CAPS!!! It works now.

I was only using the Message as a way to test the rest of the code. I will actually be sending emails using the If statements. But I'll remember to use MDL in the future.
Thanks,
Josh

Post Reply
cron
Sign up to our newsletter for free automation tips, tricks & discounts