GetActiveWindow in Citrix problem
Moderators: Dorian (MJT support), JRL
GetActiveWindow in Citrix problem
I am running MS ver. 9.0.053 in citrix. GetActiveWindow seems to be inconsistent in returning the full window title. I am running the GAW command in a loop looking for a new window to appear.
here is the end of the log file:
3/27/2007 14:54:24:338 - mousemove>144,562
3/27/2007 14:54:24:369 - lclick
3/27/2007 14:54:24:416 - GetActiveWindow>active,x1,y1
3/27/2007 14:54:24:447 - press menukey
3/27/2007 14:54:24:979 - wait>0.5
3/27/2007 14:54:25:119 - send>o
3/27/2007 14:54:25:666 - wait>0.5
3/27/2007 14:54:25:822 - send>o
3/27/2007 14:54:25:869 - srt>test_for_new_screen
3/27/2007 14:54:25:901 - label>look_again
3/27/2007 14:54:25:947 - GetActiveWindow>active_1,x1,y1,,
3/27/2007 14:54:25:994 - if>Procedures and Safety 2009 - General Information=Procedures and Safety 2009 - General Information
3/27/2007 14:54:28:025 - wait>2
3/27/2007 14:54:28:072 - label>look_again
3/27/2007 14:54:28:166 - GetActiveWindow>active_1,x1,y1,,
3/27/2007 14:54:28:213 - endif
3/27/2007 14:54:28:260 - endif
3/27/2007 14:54:30:557 - 'messagemodal>new screen is Microsoft Excel
3/27/2007 14:57:50:937 - setfocus>Microsoft Excel
3/27/2007 14:57:50:968 - Finished Macro : Print_MWO_main_rev03
Setfocus fails because the actual window title is
Microsoft Excel - Worksheet in Procedures and Safety 2009
any thoughts?
Dennis
here is the end of the log file:
3/27/2007 14:54:24:338 - mousemove>144,562
3/27/2007 14:54:24:369 - lclick
3/27/2007 14:54:24:416 - GetActiveWindow>active,x1,y1
3/27/2007 14:54:24:447 - press menukey
3/27/2007 14:54:24:979 - wait>0.5
3/27/2007 14:54:25:119 - send>o
3/27/2007 14:54:25:666 - wait>0.5
3/27/2007 14:54:25:822 - send>o
3/27/2007 14:54:25:869 - srt>test_for_new_screen
3/27/2007 14:54:25:901 - label>look_again
3/27/2007 14:54:25:947 - GetActiveWindow>active_1,x1,y1,,
3/27/2007 14:54:25:994 - if>Procedures and Safety 2009 - General Information=Procedures and Safety 2009 - General Information
3/27/2007 14:54:28:025 - wait>2
3/27/2007 14:54:28:072 - label>look_again
3/27/2007 14:54:28:166 - GetActiveWindow>active_1,x1,y1,,
3/27/2007 14:54:28:213 - endif
3/27/2007 14:54:28:260 - endif
3/27/2007 14:54:30:557 - 'messagemodal>new screen is Microsoft Excel
3/27/2007 14:57:50:937 - setfocus>Microsoft Excel
3/27/2007 14:57:50:968 - Finished Macro : Print_MWO_main_rev03
Setfocus fails because the actual window title is
Microsoft Excel - Worksheet in Procedures and Safety 2009
any thoughts?
Dennis
- Marcus Tettmar
- Site Admin
- Posts: 7395
- Joined: Thu Sep 19, 2002 3:00 pm
- Location: Dorset, UK
- Contact:
Use:
SetFocus>Microsoft Excel -*
SetFocus>Microsoft Excel -*
Marcus Tettmar
http://mjtnet.com/blog/ | http://twitter.com/marcustettmar
Did you know we are now offering affordable monthly subscriptions for Macro Scheduler Standard?
http://mjtnet.com/blog/ | http://twitter.com/marcustettmar
Did you know we are now offering affordable monthly subscriptions for Macro Scheduler Standard?
- Marcus Tettmar
- Site Admin
- Posts: 7395
- Joined: Thu Sep 19, 2002 3:00 pm
- Location: Dorset, UK
- Contact:
According to your log file active_1 can only ever have a full window title.
Marcus Tettmar
http://mjtnet.com/blog/ | http://twitter.com/marcustettmar
Did you know we are now offering affordable monthly subscriptions for Macro Scheduler Standard?
http://mjtnet.com/blog/ | http://twitter.com/marcustettmar
Did you know we are now offering affordable monthly subscriptions for Macro Scheduler Standard?
- Marcus Tettmar
- Site Admin
- Posts: 7395
- Joined: Thu Sep 19, 2002 3:00 pm
- Location: Dorset, UK
- Contact:
GAW could at times be getting an invisible or minimized window. SetFocus will return an error if it fails saying window does not exist. Did you get this? Have you tried setting WF_TYPE?
Marcus Tettmar
http://mjtnet.com/blog/ | http://twitter.com/marcustettmar
Did you know we are now offering affordable monthly subscriptions for Macro Scheduler Standard?
http://mjtnet.com/blog/ | http://twitter.com/marcustettmar
Did you know we are now offering affordable monthly subscriptions for Macro Scheduler Standard?
Added in WF_TYPE=2
same problem. Here is the log file and script. Basically, just going through a list of records on screen, opening each record which can have different titles and looking to see if there is a new window open.
Notice that the last setfocus> command below appears to have a null value.
3/28/2007 15:50:21:786 - Started Macro : Print_MWO_main_rev04
3/28/2007 15:50:21:817 - let>SK_DELAY=100
3/28/2007 15:50:21:817 - GetScreenRes>xres,yres
3/28/2007 15:50:21:817 - Let>WF_TYPE=2
3/28/2007 15:50:21:832 - let>window=FBC Task Cab*
3/28/2007 15:50:21:832 - let>task_window=FBC Task Cab*
3/28/2007 15:50:21:832 - SRT>setup_window
3/28/2007 15:50:21:848 - setfocus>FBC Task Cab*
3/28/2007 15:50:22:348 - wait>0.5
3/28/2007 15:50:22:348 - movewindow>FBC Task Cab*,0,0
3/28/2007 15:50:22:848 - wait>0.5
3/28/2007 15:50:22:864 - resizewindow>FBC Task Cab*,600,600
3/28/2007 15:50:23:395 - wait>0.5
3/28/2007 15:50:23:426 - resizewindow>FBC Task Cab*,800,600
3/28/2007 15:50:23:926 - wait>0.5
3/28/2007 15:50:23:926 - END>setup_window
3/28/2007 15:50:23:926 - let>number_to_process=9
3/28/2007 15:50:23:926 - setfocus>FBC Task Cab*
3/28/2007 15:50:24:426 - wait>0.5
3/28/2007 15:50:24:426 - Press down
3/28/2007 15:50:24:426 - press up * 20
3/28/2007 15:50:24:426 - label>process_MWOs
3/28/2007 15:50:24:426 - GetActiveWindow>active,x1,y1,,
3/28/2007 15:50:24:441 - setfocus>FBC Task Cabinet - Work Tasks Created Date Range
3/28/2007 15:50:24:457 - press alt
3/28/2007 15:50:24:957 - wait>0.5
3/28/2007 15:50:25:066 - send>s
3/28/2007 15:50:25:566 - wait>0.5
3/28/2007 15:50:25:676 - send>o
3/28/2007 15:50:26:191 - wait>0.5
3/28/2007 15:50:26:316 - send>f
3/28/2007 15:50:26:816 - wait>0.5
3/28/2007 15:50:26:816 - release alt
3/28/2007 15:50:26:816 - srt>test_for_new_screen
3/28/2007 15:50:26:816 - label>look_again
3/28/2007 15:50:26:832 - GetActiveWindow>active_1,x1,y1,,
3/28/2007 15:50:26:832 - if>FBC Task Cabinet - Work Tasks Created Date Range=FBC Task Cabinet - Work Tasks Created Date Range
3/28/2007 15:50:28:832 - wait>2
3/28/2007 15:50:28:832 - label>look_again
3/28/2007 15:50:28:832 - GetActiveWindow>active_1,x1,y1,,
3/28/2007 15:50:28:832 - endif
3/28/2007 15:50:42:252 - setfocus>
3/28/2007 15:50:42:252 - Finished Macro : Print_MWO_main_rev04
let>SK_DELAY=100
GetScreenRes>xres,yres
Let>WF_TYPE=2
let>window=FBC Task Cab*
let>task_window=FBC Task Cab*
gosub>setup_window
let>number_to_process=9
setfocus>%task_window%
wait>0.5
Press down
press up * 20
label>process_MWOs
GetActiveWindow>active,x1,y1,,
setfocus>%active%
press alt
wait>0.5
send>s
wait>0.5
send>o
wait>0.5
send>f
wait>0.5
release alt
gosub>test_for_new_screen
GetActiveWindow>work_order_window,x,y,w,h
let>window=%work_order_window%
gosub>setup_window
CloseWindow>%work_order_window%
wait>1
'*******************subtract and do another MWO
sub>number_to_process,1
if>number_to_process=0,stop
endif>
setfocus>%task_window%
wait>1
press down * 3
setfocus>%task_window%
goto>process_MWOs
label>stop
SRT>setup_window
setfocus>%window%
wait>0.5
movewindow>%window%,0,0
wait>0.5
resizewindow>%window%,600,600
wait>0.5
resizewindow>%window%,800,600
wait>0.5
END>setup_window
srt>test_for_new_screen
label>look_again
GetActiveWindow>active_1,x1,y1,,
if>%active%=%active_1%
wait>2
goto>look_again
endif
setfocus>%active_1%
end>test_for_new_screen
same problem. Here is the log file and script. Basically, just going through a list of records on screen, opening each record which can have different titles and looking to see if there is a new window open.
Notice that the last setfocus> command below appears to have a null value.
3/28/2007 15:50:21:786 - Started Macro : Print_MWO_main_rev04
3/28/2007 15:50:21:817 - let>SK_DELAY=100
3/28/2007 15:50:21:817 - GetScreenRes>xres,yres
3/28/2007 15:50:21:817 - Let>WF_TYPE=2
3/28/2007 15:50:21:832 - let>window=FBC Task Cab*
3/28/2007 15:50:21:832 - let>task_window=FBC Task Cab*
3/28/2007 15:50:21:832 - SRT>setup_window
3/28/2007 15:50:21:848 - setfocus>FBC Task Cab*
3/28/2007 15:50:22:348 - wait>0.5
3/28/2007 15:50:22:348 - movewindow>FBC Task Cab*,0,0
3/28/2007 15:50:22:848 - wait>0.5
3/28/2007 15:50:22:864 - resizewindow>FBC Task Cab*,600,600
3/28/2007 15:50:23:395 - wait>0.5
3/28/2007 15:50:23:426 - resizewindow>FBC Task Cab*,800,600
3/28/2007 15:50:23:926 - wait>0.5
3/28/2007 15:50:23:926 - END>setup_window
3/28/2007 15:50:23:926 - let>number_to_process=9
3/28/2007 15:50:23:926 - setfocus>FBC Task Cab*
3/28/2007 15:50:24:426 - wait>0.5
3/28/2007 15:50:24:426 - Press down
3/28/2007 15:50:24:426 - press up * 20
3/28/2007 15:50:24:426 - label>process_MWOs
3/28/2007 15:50:24:426 - GetActiveWindow>active,x1,y1,,
3/28/2007 15:50:24:441 - setfocus>FBC Task Cabinet - Work Tasks Created Date Range
3/28/2007 15:50:24:457 - press alt
3/28/2007 15:50:24:957 - wait>0.5
3/28/2007 15:50:25:066 - send>s
3/28/2007 15:50:25:566 - wait>0.5
3/28/2007 15:50:25:676 - send>o
3/28/2007 15:50:26:191 - wait>0.5
3/28/2007 15:50:26:316 - send>f
3/28/2007 15:50:26:816 - wait>0.5
3/28/2007 15:50:26:816 - release alt
3/28/2007 15:50:26:816 - srt>test_for_new_screen
3/28/2007 15:50:26:816 - label>look_again
3/28/2007 15:50:26:832 - GetActiveWindow>active_1,x1,y1,,
3/28/2007 15:50:26:832 - if>FBC Task Cabinet - Work Tasks Created Date Range=FBC Task Cabinet - Work Tasks Created Date Range
3/28/2007 15:50:28:832 - wait>2
3/28/2007 15:50:28:832 - label>look_again
3/28/2007 15:50:28:832 - GetActiveWindow>active_1,x1,y1,,
3/28/2007 15:50:28:832 - endif
3/28/2007 15:50:42:252 - setfocus>
3/28/2007 15:50:42:252 - Finished Macro : Print_MWO_main_rev04
let>SK_DELAY=100
GetScreenRes>xres,yres
Let>WF_TYPE=2
let>window=FBC Task Cab*
let>task_window=FBC Task Cab*
gosub>setup_window
let>number_to_process=9
setfocus>%task_window%
wait>0.5
Press down
press up * 20
label>process_MWOs
GetActiveWindow>active,x1,y1,,
setfocus>%active%
press alt
wait>0.5
send>s
wait>0.5
send>o
wait>0.5
send>f
wait>0.5
release alt
gosub>test_for_new_screen
GetActiveWindow>work_order_window,x,y,w,h
let>window=%work_order_window%
gosub>setup_window
CloseWindow>%work_order_window%
wait>1
'*******************subtract and do another MWO
sub>number_to_process,1
if>number_to_process=0,stop
endif>
setfocus>%task_window%
wait>1
press down * 3
setfocus>%task_window%
goto>process_MWOs
label>stop
SRT>setup_window
setfocus>%window%
wait>0.5
movewindow>%window%,0,0
wait>0.5
resizewindow>%window%,600,600
wait>0.5
resizewindow>%window%,800,600
wait>0.5
END>setup_window
srt>test_for_new_screen
label>look_again
GetActiveWindow>active_1,x1,y1,,
if>%active%=%active_1%
wait>2
goto>look_again
endif
setfocus>%active_1%
end>test_for_new_screen