Sodori

Illogic winactive script

5 posts in this topic

Hi all!

Simple script:

If WinActive("Form1") = 1 Then MsgBox(0,"","Fancy Title")

If WinActive("WindowsForms10.Window.8.app.0.2bf8098_r11_ad1") = 1 Then MsgBox(0,"","Fancy Class")

If WinActive("[TITLE:Form1]") = 1 Then MsgBox(0,"","Normal Title")

If WinActive("[CLASS:WindowsForms10.Window.8.app.0.2bf8098_r11_ad1]") = 1 Then MsgBox(0,"","Normal Class")

MsgBox(0,"","Nothing!")

I often encounter this issue. Using AutoIt WindowInfo to gather said title and class. Sometimes, I can get away with what is resulting in "Fancy Title". Sometimes I can hardly manage a normal class. What I am saying, is that it's all so random! Ofc, just mentioned is overall not for this script.

For this script, I get nothing. Why? What am I doing wrong?? MsBox "Nothing" is just to make sure it's working.

Share this post


Link to post
Share on other sites



If you get nothing then there is nothing ;)
Which is the active Window when you run the script? How do you run the script (compiled from Windows Explorer, from SciTE ...)?

1 person likes this

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2017-02-03 - Version 1.4.7.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (NEW 2017-02-03 - Version 1.2.4.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2015-04-01 - Version 0.4.0.0) - Download - General Help & Support - Example Scripts
Excel - Example Scripts - Wiki
Word - Wiki
Tutorials:
ADO - Wiki

 

Share this post


Link to post
Share on other sites

Why do you expect WinActive to return 1? This is higly unlikely. Have another read of the help file for this function.

Use <> 0 instead.

If WinActive("Form1") <> 0 Then MsgBox(0,"","Fancy Title")


"Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the universe trying to build bigger and better idiots. So far, the universe is winning."- Rick Cook

Share this post


Link to post
Share on other sites

#4 ·  Posted (edited)

If WinExists("Form1") = 1 Then MsgBox(0,"",'WinExists("Form1")')

If WinExists("WindowsForms10.Window.8.app.0.2bf8098_r11_ad1") = 1 Then MsgBox(0,"",'WinExists("WindowsForms10.Window.8.app.0.2bf8098_r11_ad1")')

If WinExists("[TITLE:Form1]") = 1 Then MsgBox(0,"",'WinExists("[TITLE:Form1]")')

If WinExists("[CLASS:WindowsForms10.Window.8.app.0.2bf8098_r11_ad1]") = 1 Then MsgBox(0,"",'WinExists("[CLASS:WindowsForms10.Window.8.app.0.2bf8098_r11_ad1]")')


If WinExists("Form1") <> 0 Then MsgBox(0,"",'WinExists("Form1")')

If WinExists("WindowsForms10.Window.8.app.0.2bf8098_r11_ad1") <> 0 Then MsgBox(0,"",'WinExists("WindowsForms10.Window.8.app.0.2bf8098_r11_ad1")')

If WinExists("[TITLE:Form1]") <> 0 Then MsgBox(0,"",'WinExists("[TITLE:Form1]")')

If WinExists("[CLASS:WindowsForms10.Window.8.app.0.2bf8098_r11_ad1]") <> 0 Then MsgBox(0,"",'WinExists("[CLASS:WindowsForms10.Window.8.app.0.2bf8098_r11_ad1]")')

MsgBox(0,"","Nothing!")

 

All but "WinExists("WindowsForms10.Window.8.app.0.2bf8098_r11_ad1")" got a callback. I am such a dum dum sometimes! >.< Just lock this thread all up. Thanks Water for hinting me to what window I have active!

Edited by Sodori

Share this post


Link to post
Share on other sites

Glad to be of service :)


My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2017-02-03 - Version 1.4.7.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (NEW 2017-02-03 - Version 1.2.4.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2015-04-01 - Version 0.4.0.0) - Download - General Help & Support - Example Scripts
Excel - Example Scripts - Wiki
Word - Wiki
Tutorials:
ADO - Wiki

 

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