IfWindowOpen always return true
Moderators: JRL, Dorian (MJT support)
IfWindowOpen always return true
I do not want the OR Manager application to be running when I launch a macro. So, i used the following code:
IfWindowOpen>OR Manager*,STOP,CONTINUE
Label>STOP
Show>CloseOR,Close
GoTo>End
Label>CONTINUE
...
...
Altough OR Manager is not running, The dialog "CloseOR" is getting displayed all the times.
Five lines of code, and I cannot see what is wrong. That drives me crazy!
Gaston.
IfWindowOpen>OR Manager*,STOP,CONTINUE
Label>STOP
Show>CloseOR,Close
GoTo>End
Label>CONTINUE
...
...
Altough OR Manager is not running, The dialog "CloseOR" is getting displayed all the times.
Five lines of code, and I cannot see what is wrong. That drives me crazy!
Gaston.
- Bob Hansen
- Automation Wizard
- Posts: 2475
- Joined: Tue Sep 24, 2002 3:47 am
- Location: Salem, New Hampshire, US
- Contact:
Remove the line for SHOW>
Show> is used to display Dialog Windows created with Macro Scheduler.
You may want to use:to close that window, but it might be safer to set focus to the window and exit the program normally instead.
Show> is used to display Dialog Windows created with Macro Scheduler.
You may want to use:
Code: Select all
WindowAction>3,OR Manager
Hope this was helpful..................good luck,
Bob
A humble man and PROUD of it!
Bob
A humble man and PROUD of it!
Hi Bob,
I use the SHOW> command to display a dialog box that will say "You must exit OR Manager before running this Macro.", with two buttons:
1- Cancel - Terminate the script
2- Continue - Assume the user have terminated OR Manager, then Continue
I could have used a MessageModal as well, but that still do not explain why the damn IfWindowOpen command return TRUE.
Thank you,
Gaston.
I use the SHOW> command to display a dialog box that will say "You must exit OR Manager before running this Macro.", with two buttons:
1- Cancel - Terminate the script
2- Continue - Assume the user have terminated OR Manager, then Continue
I could have used a MessageModal as well, but that still do not explain why the damn IfWindowOpen command return TRUE.
Thank you,
Gaston.
- Bob Hansen
- Automation Wizard
- Posts: 2475
- Joined: Tue Sep 24, 2002 3:47 am
- Location: Salem, New Hampshire, US
- Contact:
Oops, I misread your message.
I am unable to duplicate problem. Never show Dialog. Log file does not show script going to STOP.
Can't see how dialog would impact, but can you provide Dialog>CloseOR code also?
Maybe entire script should be provided in case other sections are causing this.
I am unable to duplicate problem. Never show Dialog. Log file does not show script going to STOP.
Can't see how dialog would impact, but can you provide Dialog>CloseOR code also?
Maybe entire script should be provided in case other sections are causing this.
Hope this was helpful..................good luck,
Bob
A humble man and PROUD of it!
Bob
A humble man and PROUD of it!
I have another clue:
If I replace IfWindowOpen>OR Manager*,
for IfWindowOpen>vvhjviava*,
it works fine.
So, that means that MS is really "seeing" a window named "OR Manager...".
That window is hidden to me. Is there a way to determine where it is coming from?
The complete code is as follows:
Dialog>FermerOR
Caption=OR Manager est Ouvert!
Top=174
Width=384
Left=141
Height=191
Label=Vous avez déjàune session OR Manager d'ouverte.%CRLF%%CRLF%Vous devez fermer OR Manager avant de continuer.,64,32
Button=Continuer,88,104,75,25,1
Button=Annuler,224,104,75,25,2
EndDialog>FermerOR
IfWindowOpen>OR Manager*,STOP,CONTINUE
Label>STOP
SetFocus>OR Manager*
Show>FermerOR,Fermer
If>Fermer=2
GoTo>Fin
EndIf
Label>CONTINUE
Gaston.
If I replace IfWindowOpen>OR Manager*,
for IfWindowOpen>vvhjviava*,
it works fine.
So, that means that MS is really "seeing" a window named "OR Manager...".
That window is hidden to me. Is there a way to determine where it is coming from?
The complete code is as follows:
Dialog>FermerOR
Caption=OR Manager est Ouvert!
Top=174
Width=384
Left=141
Height=191
Label=Vous avez déjàune session OR Manager d'ouverte.%CRLF%%CRLF%Vous devez fermer OR Manager avant de continuer.,64,32
Button=Continuer,88,104,75,25,1
Button=Annuler,224,104,75,25,2
EndDialog>FermerOR
IfWindowOpen>OR Manager*,STOP,CONTINUE
Label>STOP
SetFocus>OR Manager*
Show>FermerOR,Fermer
If>Fermer=2
GoTo>Fin
EndIf
Label>CONTINUE
Gaston.
- Bob Hansen
- Automation Wizard
- Posts: 2475
- Joined: Tue Sep 24, 2002 3:47 am
- Location: Salem, New Hampshire, US
- Contact:
Have not really read your last message totally, am on the run, but now suspect that because OR is a boolean operator that it may be causing the problem.
Try making the window name a variable and using that variable in the IfWindowOpen> command to eliminate using OR anywhere other than defining the variable.......
Try making the window name a variable and using that variable in the IfWindowOpen> command to eliminate using OR anywhere other than defining the variable.......
Hope this was helpful..................good luck,
Bob
A humble man and PROUD of it!
Bob
A humble man and PROUD of it!
-
- Automation Wizard
- Posts: 1101
- Joined: Fri Jan 07, 2005 5:55 pm
- Location: Somewhere else on the planet
I don't know if there is something special about the way that program has to be closed, but if not you could just PSKILL it http://www.sysinternals.com/ntw2k/freeware/pskill.shtml In my experience PSKILL doesn't cause an error if the program isn't open so you can just routinely call it from the script.
- Bob Hansen
- Automation Wizard
- Posts: 2475
- Joined: Tue Sep 24, 2002 3:47 am
- Location: Salem, New Hampshire, US
- Contact:
I tried the full script that you provided and I never see the Dialog. I looked at a log script and the Show> command is never called.
Here is my log:
1/25/2005 18:41:33:890 - Started Macro : test
1/25/2005 18:41:33:940 - Dialog>FermerOR
1/25/2005 18:41:34:000 -
1/25/2005 18:41:34:000 - IfWindowOpen>OR Manager*,STOP,CONTINUE
1/25/2005 18:41:34:000 - Goto>End (I added this under the CONTINUE label).
1/25/2005 18:41:34:050 - Finished Macro : test
=========================
Your original problem was:
-----------------------------
1. I just tried to Single Step through the script and got invalid pointer error message on line IfWindowOpen>.
I added Let>LookFor=OR Manager* and modified script toand error message went away. This seems to confirm my earlier suspicion that OR is being interpreted as an operator. I suspect the error is allowing the script to continue vs. branching.
2. I also found that there was a trailing space after "Label>CONTINUE ". I had to remove the trailing space to go to CONTINUE properly.
Here is my log:
1/25/2005 18:41:33:890 - Started Macro : test
1/25/2005 18:41:33:940 - Dialog>FermerOR
1/25/2005 18:41:34:000 -
1/25/2005 18:41:34:000 - IfWindowOpen>OR Manager*,STOP,CONTINUE
1/25/2005 18:41:34:000 - Goto>End (I added this under the CONTINUE label).
1/25/2005 18:41:34:050 - Finished Macro : test
=========================
Your original problem was:
Am I missing something? I have still not seen the Dialog appear.Altough OR Manager is not running, The dialog "CloseOR" is getting displayed all the times.
-----------------------------
1. I just tried to Single Step through the script and got invalid pointer error message on line IfWindowOpen>.
I added Let>LookFor=OR Manager* and modified script to
Code: Select all
Let>LookFor=OR Manager*
IfWindowOpen>%LookFor%,STOP,CONTINUE
2. I also found that there was a trailing space after "Label>CONTINUE ". I had to remove the trailing space to go to CONTINUE properly.
Hope this was helpful..................good luck,
Bob
A humble man and PROUD of it!
Bob
A humble man and PROUD of it!
Hi Bob,
Thank you for your patience.
The idea to use the LookFor variable did not change anything to my problem.
However, I think that your suspicion that OR is being interpreted as an operator still deserve the grand prize.
The full window title is "OR Manager - Live Database"
So, I changed my IfWindowOpen>OR Manager
for IfWindowOpen>Live Database and then this little thing got happy
as ever!
I am puzzled about the fact that you did not experienced the problem. It could be the environment. I am running MS Pro version 7.3.06 under Windows 2000.
In any case, you've been of great help. Thanks again.
Gaston.
Thank you for your patience.
The idea to use the LookFor variable did not change anything to my problem.
However, I think that your suspicion that OR is being interpreted as an operator still deserve the grand prize.
The full window title is "OR Manager - Live Database"
So, I changed my IfWindowOpen>OR Manager
for IfWindowOpen>Live Database and then this little thing got happy
as ever!
I am puzzled about the fact that you did not experienced the problem. It could be the environment. I am running MS Pro version 7.3.06 under Windows 2000.
In any case, you've been of great help. Thanks again.
Gaston.