GDP If Statements

Technical support and scripting issues

Moderators: JRL, Dorian (MJT support)

Post Reply
Jerry Thomas
Macro Veteran
Posts: 267
Joined: Mon Sep 27, 2010 8:57 pm
Location: Seattle, WA

GDP If Statements

Post by Jerry Thomas » Mon Nov 19, 2012 4:35 pm

Just wondering if there is a cleaner way to do this...

I have a dialog with checkboxes for 16 languages and another section with checkboxes for 22 specific tests.

Then in my code I have to check to see which languages and tests the user wants to run. Currently I have this approach for each language and test:

(Note, I do abbreviate GetDialogProperty to GDP, but expanded here so newer users are not wondering what the heck I am doing.)

Code: Select all

GetDialogProperty>MyDialog,cbGerman,Checked,IsChecked
If>IsChecked=True
 GoSub>LanguageTest,German
Endif
It works fine, but I am thinking there may be a better approach.
Any suggestions?
Thanks,
Jerry

[email protected]

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

Post by JRL » Mon Nov 19, 2012 6:31 pm

Something like this?

Code: Select all

Let>Language_1=English
Let>Language_2=German
Let>Language_3=French
Let>NumberOfLanguages=3

Let>kk=0
Repeat>kk
  Add>kk,1
  Let>Language=Language_%kk%
  GetDialogProperty>MyDialog,cb%Language%,Checked,IsChecked
  If>IsChecked=True
    GoSub>LanguageTest,Language
  Endif
Until>kk=NumberOfLanguages

Jerry Thomas
Macro Veteran
Posts: 267
Joined: Mon Sep 27, 2010 8:57 pm
Location: Seattle, WA

Post by Jerry Thomas » Tue Nov 20, 2012 4:25 pm

Actually that will work quite well.
I already have an array of languages that I can use by just renaming the checkbox fields.

Sometimes we are just too close to the code to see something this obvious!

Thanks JRL!
Thanks,
Jerry

[email protected]

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