Non-Modal Dialog Difficulty with Focus

Technical support and scripting issues

Moderators: JRL, Dorian (MJT support)

Post Reply
kpassaur
Automation Wizard
Posts: 696
Joined: Wed Jul 07, 2004 1:55 pm

Non-Modal Dialog Difficulty with Focus

Post by kpassaur » Sun May 27, 2007 11:52 am

I have a Sub Routine in a script that when tested with Debug works if I assign it variables and go through it step by step. I have checked and rechecked the variable names and they are correct.

So, I copied and pasted the portion of the script that reads the ini file and the contents of the subroutine and created a new script. It worked, so I am positive it is not the reading of the variables or the script.


However, the goal is to have a Non-Modal Box run this subroutine. When I run it, from a Non-Modal Dialog, the Focus does not change and the command to Maximize a Window doesn't work, when the menu on the
Dialog reappears it is not displaying the information it should.

I somewhat understand the concept of Non-Modal Dialog and Modal Dialogs, and that a Non-Modal Dialog is always there in the background.
(that is what I think - it is hidden and refreshed)
But is there a way of turning it off and on? I tried Close Dialog with the hope of refreshing and resetting it but that didn't seem to work either.

This is the Menu

Dialog>Dialog1
Caption=Setup type of Window Capture
Width=377
Height=432
Top=CENTER
Left=CENTER
Max=0
Min=0
Close=1
Resize=0
Edit=dwinname,188,96,153,%winname%
Label=Enter Portion of Window Name,31,100,true
Edit=dvalue1,182,220,33,%value1%
Edit=dvalue2,223,220,33,%value2%
Edit=dvalue3,264,220,33,%value3%
Edit=dvalue4,305,221,33,%value4%
RadioGroup=msRadioGroup1,Method of Capture,12,266,185,100,Auto Capture by Name%CRLF%Auto Capture by Location%CRLF%Window Name%CRLF%Location,%rindex%
Label=Enter Location of Window,38,225,true
Label=_______________Capture by Location of Window________________,20,186,true
Button=Test Capture,212,317,129,25,1
Button=Exit,212,341,129,25,2
Edit=dchildwindow,188,128,153,%childwindow%
Label=Focus on Child Window,60,132,true
CheckBox=msCheckBox1,Maximize Window,217,268,113,%maximizewindow%
Image=C:\consolegrab\setup step one menu.bmp,0,0,369,57
Label=Copyright© eDocFile Inc. 2004-2007,102,377,true
Button=Notes:,212,293,128,25,3
Label=______________Manual Window Capture Options_______________,20,73,true
Label=X Pos,186,205,true
Label=Y Pos,227,205,true
Label=W,275,205,true
Label=H,317,205,true
Label=________________________________________________________,19,241,true
Label=Note: To capture a Child Window the Parent Window Must be Entered,22,159,true
EndDialog>Dialog1


Show>Dialog1
Label>Mainloop
GetDialogAction>Dialog1,dialog1r
IF>dialog1r=1,testcapture
IF>dialog1r=2,EOF
IF>dialog1r=3,help
Goto>Mainloop



This is the portion subroutine that is causing the difficulty


If>Capturetype=Window Name
Let>WW_TIMEOUT=30
WaitWindowOpen>%winname%*
If>WW_RESULT=FALSE
MDL>Could not find matching Window %winname% - Will now Exit
Goto>endoftest
Endif
SetFocus>%winname%*
Wait>.2
If>maximizewindow=True
WindowAction>1,%winname%*
Wait>.2
Endif
Length>%childwindow%,childlen
If>%childlen%>1,getchild,donewithwindow
Label>getchild
Let>WW_TIMEOUT=30
WaitWindowOpen>%childwindow%*
If>WW_RESULT=FALSE
MDL>Could not find matching Window %winname% - Will now Exit
Goto>endoftest
Endif
SetFocus>%childwindow%*
Wait>.2
If>maximizewindow=True
WindowAction>1,%childwindow%*
Wait>.2
Endif
Label>donewithwindow
Let>RP_WINDOWMODE=0
Let>RP_Wait=1
Run Program>C:\consolegrab\consolegrab.exe "%winname%" c:\consolegrab\output.txt
ExecuteFile>c:\consolegrab\output.txt
Goto>endoftest
Endif

Any ideas besides creating a separate script and calling it from a first one.

kpassaur
Automation Wizard
Posts: 696
Joined: Wed Jul 07, 2004 1:55 pm

Non Modal difficulty when calling another script

Post by kpassaur » Sun May 27, 2007 12:24 pm

I decided that maybe it is better to go with a stand alone exe and call it a day However, that did not work either. The script did not change focus on the windows if the first script was running with a Non Modal dialog, but if I run it on its own it is fine.

This script is for setting up a utility and testing needs to be done for setup, so it would be nice if the results could be shown and then the settings used displayed. It may take a few tries so it would be nice if the user could just try something, view the results and try againg until they go it right. So I really don't want the end user to keep on having to go through start/all programs/app name / test setup function 1, each time they want to attempt to try a different setting.

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