Jump to content

Illogic winactive script


Sodori
 Share

Recommended Posts

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.

Link to comment
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 ...)?

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2024-07-28 - Version 1.6.3.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download
Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki
PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki
Task Scheduler (2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki

Standard UDFs:
Excel - Example Scripts - Wiki
Word - Wiki

Tutorials:
ADO - Wiki
WebDriver - Wiki

 

Link to comment
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

Link to comment
Share on other sites

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
Link to comment
Share on other sites

Glad to be of service :)

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2024-07-28 - Version 1.6.3.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download
Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki
PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki
Task Scheduler (2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki

Standard UDFs:
Excel - Example Scripts - Wiki
Word - Wiki

Tutorials:
ADO - Wiki
WebDriver - Wiki

 

Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...