Sodori Posted October 13, 2015 Share Posted October 13, 2015 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 More sharing options...
water Posted October 13, 2015 Share Posted October 13, 2015 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 ...)? Sodori 1 My UDFs and Tutorials: Spoiler UDFs:Active Directory (NEW 2022-02-19 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - WikiExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example ScriptsOutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - WikiOutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - DownloadOutlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - WikiPowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - WikiTask Scheduler (NEW 2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs:Excel - Example Scripts - WikiWord - Wiki Tutorials:ADO - WikiWebDriver - Wiki Link to comment Share on other sites More sharing options...
Bowmore Posted October 13, 2015 Share Posted October 13, 2015 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 More sharing options...
Sodori Posted October 14, 2015 Author Share Posted October 14, 2015 (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 October 14, 2015 by Sodori Link to comment Share on other sites More sharing options...
water Posted October 14, 2015 Share Posted October 14, 2015 Glad to be of service My UDFs and Tutorials: Spoiler UDFs:Active Directory (NEW 2022-02-19 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - WikiExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example ScriptsOutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - WikiOutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - DownloadOutlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - WikiPowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - WikiTask Scheduler (NEW 2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs:Excel - Example Scripts - WikiWord - Wiki Tutorials:ADO - WikiWebDriver - Wiki Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now