Problems with GetCheckBox

Technical support and scripting issues

Moderators: Dorian (MJT support), JRL

Post Reply
adroege
Automation Wizard
Posts: 438
Joined: Tue Dec 07, 2004 7:39 pm

Problems with GetCheckBox

Post by adroege » Wed Jul 27, 2005 8:17 pm

I have been having weird problems with GetCheckBox
and have written this sample code to illustrate the
problem. Run the sample, and notice that even though
the checkbox has been checked, the program reports it
as NOT checked.


//*******************************************
//** This example illustrates a problem **
//** with the GetCheckBox command **
//** **
//** MS PRO 7.3.11.4 **
//** **
//*******************************************
Dialog>FinTests
Caption=GUI Tests Manager
Top=197
Width=245
Left=98
Height=204
Label=Select Tests To Run,62,12
CheckBox=Test1,Test1,72,40,97,%Chk1%
CheckBox=Test2,Test2,72,72,97,%Chk2%
Button=Go,64,120,75,25,3
EndDialog>FinTests

// I am only using the dialog feature to build an example form
// with a checkbox to illustrate the problem. The real problem
// I am trying to solve involves a form window with checkboxes
// generated from an external program. The same problem exists.
//
Show>FinTests

Let>myspace={" "}

// Get checkbox states
GetCheckBox>GUI Tests Manager,Test1,CBB1
GetCheckBox>GUI Tests Manager,Test1,CBB2

Let>WF_TYPE=2
SetFocus>GUI Tests Manager
Wait>1

// This toggles the Test1 checkbox to checked
Send Character/Text>%myspace%
Wait>1

// Get checkbox states
GetCheckBox>GUI Tests Manager,Test1,CBB1
GetCheckBox>GUI Tests Manager,Test1,CBB2


// Checkbox Test1 shows as checked, but the getcheckbox command
// does not report it as such.
If>%CBB1%=0
Let>CBW1=unchecked
else
Let>CBW1=checked
endif

If>%CBB2%=0
Let>CBW2=unchecked
else
Let>CBW2=checked
endif

MessageModal>Checkbox Test1 is %CBW1%%CRLF%Checkbox Test2 is %CBW2%

User avatar
support
Automation Wizard
Posts: 1450
Joined: Sat Oct 19, 2002 4:38 pm
Location: London
Contact:

Post by support » Wed Jul 27, 2005 8:37 pm

You have identified a problem. Not with GetCheckBox in itself but you've identified that the result var for GetCheckBox is incorrectly being resolved as a variable. Step through and you'll see what I mean. The following version of your script works fine:

//*******************************************
//** This example illustrates a problem **
//** with the GetCheckBox command **
//** **
//** MS PRO 7.3.11.4 **
//** **
//*******************************************
Dialog>FinTests
Caption=GUI Tests Manager
Top=197
Width=245
Left=98
Height=204
Label=Select Tests To Run,62,12
CheckBox=Test1,Test1,72,40,97,%Chk1%
CheckBox=Test2,Test2,72,72,97,%Chk2%
Button=Go,64,120,75,25,3
EndDialog>FinTests

// I am only using the dialog feature to build an example form
// with a checkbox to illustrate the problem. The real problem
// I am trying to solve involves a form window with checkboxes
// generated from an external program. The same problem exists.
//
Show>FinTests

Let>myspace={" "}

// Get checkbox states
GetCheckBox>GUI Tests Manager,Test1,CBB1
GetCheckBox>GUI Tests Manager,Test1,CBB2

Let>WF_TYPE=2
SetFocus>GUI Tests Manager
Wait>1

// This toggles the Test1 checkbox to checked
Send Character/Text>%myspace%
Wait>1

// Get checkbox states
// I've changed these lines using new variable
GetCheckBox>GUI Tests Manager,Test1,CBB1_2
GetCheckBox>GUI Tests Manager,Test1,CBB2_2


// Checkbox Test1 shows as checked, but the getcheckbox command
// does not report it as such.
// Use the new variables
If>CBB1_2=0
Let>CBW1=unchecked
else
Let>CBW1=checked
endif

If>CBB2_2=0
Let>CBW2=unchecked
else
Let>CBW2=checked
endif

MessageModal>Checkbox Test1 is %CBW1%%CRLF%Checkbox Test2 is %CBW2%

Will sort this for next release.
MJT Net Support
[email protected]

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