Jump to content
Moominboy

Winexists/winactive IF block, not recognising the window is there

Recommended Posts

Moominboy

Hi folks

Been lurking for a while to build previous scripts but this has me stumped. 

I'm automating a login via an IBM iSeries data transfer component. This script requires an IF check as a recognised address will go to a standard user/pass form and if its a new address a different window will pop with some more options, and ultimately leads back to the same user/pass prompt. 

My script is something like;

If winexists ("IBM i signon information","Prompt every time") _
Or winactive ("As above", "As above" Then
Msgbox ("Entered If Block"

.....
.....
.....

Else
Msgbox ("entered else block")

The if block is never entered and the title, text are exact. I've tried using the handle different visible text. 

Tried forcing the check for hidden text and child windows.

The class of this window is the exact same as every other window used by this exe (#32770)

 

Really at a loss as to why I can't get to pass the IF check. 

 

TIA for any help and advice! 

Share this post


Link to post
Share on other sites
Moominboy

Forgot to add images. 😊

I've tried changing the text to search as well as leaving it blank and still no joy.20180322_115726.thumb.jpg.331dd9141be99fd662099609aaf74005.jpg

IMG_20180322_121148527.jpg

Share this post


Link to post
Share on other sites
Danp2

A couple of suggestions --

  1. Either remove the "Title:" or wrap the parameter in square brackets. More info here.
     
  2. Try removing the ampersand from the 2nd parameter
  • Like 1
  • Thanks 1

Share this post


Link to post
Share on other sites
Earthshine

post your real code. pictures don't cut it.

  • Like 1

My resources are limited. You must ask the right questions

 

Share this post


Link to post
Share on other sites
Bilgus
Posted (edited)

Totally the ampersand,  Ive yet to see  anything work right trying to match &

Also get rid of the spaces at the start of the title

WinActive("[TITLE:My Window]", "")

next WinWait, WinActive,  WinExists, WinWaitActive and their ilk all return a handle to the matched window on success

rather than trying to get a match each subsequent time pass the hWnd you already matched

Local $hWnd = WinWaitActive(....)

ControlClick($hWnd,"", "........")

 

Edited by Bilgus
  • Like 1
  • Thanks 1

Share this post


Link to post
Share on other sites
Moominboy

Thanks all, got it fixed now. 

The square brackets and ampersand seemed to do the trick. I assumed if autoit could see that actual text with that character then that's what it should be. 

Really appreciate the quick advice guys, thanks! 

 

 

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×