CWeeks Posted October 7, 2020 Posted October 7, 2020 I am using the WInExists function to determine if a specific window by name exists. On some machines this is taking nearly 15 seconds to return when the window does not exist. Any thoughts?
Developers Jos Posted October 7, 2020 Developers Posted October 7, 2020 Any script to show having the issue we can have a look at? SciTE4AutoIt3 Full installer Download page - Beta files Read before posting How to post scriptsource Forum etiquette Forum Rules Live for the present, Dream of the future, Learn from the past.
CWeeks Posted October 8, 2020 Author Posted October 8, 2020 It is a really simple call that is part of a larger process. Originally I was only using a WinActivate call and not checking for existance which seemed to work everywhere else, but then I added a WinExists call before using a WinActivate. Both calls could take upwards to 15 seconds when the window does not exist. Here is a sample. If WinExists("Error") Then MsgBox(1, "Success", "Error found") EndIf I ended up capturing the original window handle of the window I looking for which was possible for my process. I then created my own function using WIn APIs to detect it's existance and activate it. That work without the delay. I didn't have direct access to the workstation with the issue and could only provide different test programs until the issue was solved. Perhaps there is a delay enumerating through all the windows, but then there is no delay if the window does exist. Quite puzzling and I'm sorry this isn't more helpful,
jchd Posted October 8, 2020 Posted October 8, 2020 If Not WinExists("Window not present") Then MsgBox(1, "", "Window not found") returns the message box immediately. Note the Not. This wonderful site allows debugging and testing regular expressions (many flavors available). An absolute must have in your bookmarks.Another excellent RegExp tutorial. Don't forget downloading your copy of up-to-date pcretest.exe and pcregrep.exe hereRegExp tutorial: enough to get startedPCRE v8.33 regexp documentation latest available release and currently implemented in AutoIt beta. SQLitespeed is another feature-rich premier SQLite manager (includes import/export). Well worth a try.SQLite Expert (freeware Personal Edition or payware Pro version) is a very useful SQLite database manager.An excellent eBook covering almost every aspect of SQLite3: a must-read for anyone doing serious work.SQL tutorial (covers "generic" SQL, but most of it applies to SQLite as well)A work-in-progress SQLite3 tutorial. Don't miss other LxyzTHW pages!SQLite official website with full documentation (may be newer than the SQLite library that comes standard with AutoIt)
Musashi Posted October 8, 2020 Posted October 8, 2020 Just in case the suggestion of @jchd does not work : Try this "brute force" approach #include <WinAPI.au3> Global $aList = WinList(), $sSearchTitle, $bTitleFound = False $sSearchTitle = "xxx" ; <== insert title For $i = 1 To $aList[0][0] If $aList[$i][0] = $sSearchTitle And BitAND(WinGetState($aList[$i][0]), 1) Then $bTitleFound = True Next If $bTitleFound Then MsgBox(0, "Search Title", $sSearchTitle & " exists" & @CRLF) Else MsgBox(0, "Search Title", $sSearchTitle & " not found" & @CRLF) EndIf "In the beginning the Universe was created. This has made a lot of people very angry and been widely regarded as a bad move."
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