MatheFreak Posted December 30, 2008 Share Posted December 30, 2008 I think I found a bug, or am I doing something wrong??If I use 'ToolTip', my scripts don't work any longer.ToolTip seems to block setting of WinTitleMatchMode even thogh it is refreshed afterwards.Further windows simply dont get activated if their name is not fully given!First I thouht it was a problem with VBS and AutoItX3, now I realised, that it doesent work in AutoIt either.Try this code:;ToolTip("Waiting for Excel") Opt("WinTitleMatchMode", 2) WinActivate("Excel") WinWaitActive("Excel","",3) ; Watchout: substring given send("This one works{!}{DOWN}") ; ToolTip NOT YET used => substring works ToolTip("Waiting for Excel") Opt("WinTitleMatchMode", 2) WinActivate("Microsoft Excel") WinWaitActive("Microsoft Excel","",3) ; Watchout: full titel given send("It works too{!}{DOWN}") ; ToolTip was used => MatchMode 2 is unimportant ToolTip("Waiting for Excel") Opt("WinTitleMatchMode", 2) ; Watchout: try to refresh MatchMode doesn't seem to work WinActivate("Excel") WinWaitActive("Excel","",3) ; Watchout: substring given send("No way{!}{DOWN}") ; ToolTip alredy used => substring FAILS Link to comment Share on other sites More sharing options...
MHz Posted December 30, 2008 Share Posted December 30, 2008 Try using an AutoIt script to create the tooltip and then run a VB script using AppActivate to activate the window and if it fails then it maybe a windows bug. Link to comment Share on other sites More sharing options...
MatheFreak Posted December 30, 2008 Author Share Posted December 30, 2008 Thats's what I was doing. Just try the attached code. (After having started Excel manually). This IS an AutoIt Script. I Think you should get the same error. => the third block wouldn't do anything. (It should type "No way" in Ecxel Cell A:3) Link to comment Share on other sites More sharing options...
MHz Posted December 30, 2008 Share Posted December 30, 2008 (edited) Thats's what I was doing.I have seen you use AutoIt's WinActivate. I have not seen you use AppActivate which is the VB script method of activating a window. There is a difference.Edit:Note that I do not have Excel to test myself. Edited December 30, 2008 by MHz Link to comment Share on other sites More sharing options...
MHz Posted December 30, 2008 Share Posted December 30, 2008 Your usage for WinTitleMatchMode by substring is finding the ToolTip as it is the last active window with the substring to match. This shows you the match. Opt("WinTitleMatchMode", 2) ToolTip('Some Excel Title') If WinExists('Excel') Then MsgBox(0, Default, 'Title exists') EndIf Link to comment Share on other sites More sharing options...
MatheFreak Posted December 30, 2008 Author Share Posted December 30, 2008 I have seen you use AutoIt's WinActivate. I have not seen you use AppActivate which is the VB script method.I was trying it from VBS first, and it didnt work. So I reduced debuging to pure AutoIt. Shouldn't it run better on AutoIt without influence of VBS? Is there a possibillity to use AppActivate from AutoIt? How? But by the way: The application IS running, and WinExists() DOES report YES. Note that I do not have Excel to test myself.The same effect should come on each other Program. e.g.: WinActivate("Microsoft Word") vs. WinActivate("Word") ... or any editor you use: e.g.: WinActivate("Ultra Edit") vs. WinActivate("Edit") or: WinActivate("SciTE4AutoIt3") vs. WinActivate("TE4") => As soon as you have used ToolTip you can't call a window ambigous. (MatchMode=2) (I've tested it on 3 non MS-programs.) I still belive: It's a bug. You can try: ;Demo: ToolTip is buggy ;Start you prefered editor manually first! $FullTitle="Microsoft Excel" ; or $FullTitle="SciTE4" ; or $FullTitle="Ultra Edit" $ShortTitle="Excel" ; or $ShortTitle="TE4" ; or $ShortTitle="Edit" ; Test 1: ================================================================ ;ToolTip("Waiting for "& $ShortTitle) Opt("WinTitleMatchMode", 2) WinActivate($ShortTitle) WinWaitActive($ShortTitle,"",3) ; Watchout: ShortTitle given send("This one works{!}{DOWN}") ; ToolTip NOT YET used => ShortTitle works ; Test 2: ================================================================ ToolTip("Waiting for "& $ShortTitle) Opt("WinTitleMatchMode", 2) WinActivate($FullTitle) WinWaitActive($FullTitle,"",3) ; Watchout: FullTitle given send("It works too{!}{DOWN}") ; ToolTip is used => MatchMode 2 is ignored ; Test 3: ================================================================ ToolTip("Waiting for "& $ShortTitle) Opt("WinTitleMatchMode", 2) ; Watchout: try to refresh MatchMode doesn't seem to work WinActivate($ShortTitle) WinWaitActive($ShortTitle,"",3) ; Watchout: ShortTitle given send("No way{!}{DOWN}") ; ToolTip alredy used => ShortTitle FAILS ;!!!!! This last text never appeares!!!! Link to comment Share on other sites More sharing options...
MatheFreak Posted December 30, 2008 Author Share Posted December 30, 2008 Your usage for WinTitleMatchMode by substring is finding the ToolTip as it is the last active window with the substring to match. This shows you the match. Opt("WinTitleMatchMode", 2) ToolTip('Some Excel Title') If WinExists('Excel') Then MsgBox(0, Default, 'Title exists') EndIf OMG Now I see!!! ToolTip is findig himself!! Thanks a lot for this hint!! So it's not a bug! How can I indicate with ToolTip "Im wating for SaveAs Dialog" without getting confused with the real "SaveAs Dialog"? Do I have to something use like WinTitleMatchMode=4 ??? Link to comment Share on other sites More sharing options...
PsaltyDS Posted December 30, 2008 Share Posted December 30, 2008 How can I indicate with ToolTip "Im wating for SaveAs Dialog" without getting confused with the real "SaveAs Dialog"?Do I have to something use like WinTitleMatchMode=4 ???What's your problem with mode 4? You know advanced WinTitle strings work in all modes now, right? WinTitleMatchMode = 4 is deprecated, so you can be in mode 2 and also use advanced descriptions. The ToolTip has a different CLASS to begin with. Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law Link to comment Share on other sites More sharing options...
MatheFreak Posted December 30, 2008 Author Share Posted December 30, 2008 What's your problem with mode 4? You know advanced WinTitle strings work in all modes now, right? WinTitleMatchMode = 4 is deprecated, so you can be in mode 2 and also use advanced descriptions. The ToolTip has a different CLASS to begin with. My Problem is not mode 4. I just guess it was the solution and I don't know how to work with it. (Newbie on AutoIt)Now I know that mode 4 is basicly wrong, as I'm just understanding the principal of "advanced WinTitle". Thanks so far.The real problem behind it is: How can I invoke the right window, if name is duplikated (gets duplikated by my own produced ToolTip)?e.g.: The Dialog "Any-Text - Open-Dialog" and the ToolTip "Waiting for Open-Dialog".Problem is that it must work in a subroutine, and I do know ONLY (e.g) "Open-Dialog" How should I WinActivate() with TITLE something like "Open-Dialog" and CLASS not a ToolTip. Link to comment Share on other sites More sharing options...
youknowwho4eva Posted December 30, 2008 Share Posted December 30, 2008 Is there text that is always in the window you want? such as a menu it would see &File (If I remember correctly, The & underlines the F) Giggity Link to comment Share on other sites More sharing options...
azure Posted December 30, 2008 Share Posted December 30, 2008 How should I WinActivate() with TITLE something like "Open-Dialog" and CLASS not a ToolTip. WinActivate("[TITLE:Open-Dialog; REGEXPCLASS:^(ToolTip)]") Maybe something like this? that REGEXPCLASS should allow all classes that aren't "ToolTip"? Link to comment Share on other sites More sharing options...
MatheFreak Posted December 31, 2008 Author Share Posted December 31, 2008 WinActivate("[TITLE:Open-Dialog; REGEXPCLASS:^(ToolTip)]")oÝ÷ ØƲmë(ëax%G+-«Qa Link to comment Share on other sites More sharing options...
PsaltyDS Posted December 31, 2008 Share Posted December 31, 2008 The caret in the pattern "^(tooltip)" matches beginning of line, it is not negation. I don't see a way to get RegExp to do what you want in that circumstance. To find windows that do match a title but do not match a class: 1. WinList() with only the title to get an array of all windows with the matching title. 2. Loop through the array using _WinAPI_GetClassName() to get the class name of each window 3. Use StringInStr() to test the class NOT containing tooltip #Include <WinAPI.au3> $avWinList = WinList("Excel") For $n = 1 To $avWinList[0][0] $sClass = _WinAPI_GetClassName($avWinList[$n][1]) If StringInStr($sClass, "tooltip") = 0 Then MsgBox(64, "Found Window", "This window has the title 'Excel'," & @CRLF & _ "but is not a tooltip class:" & @CRLF & @CRLF & _ "Title: " & $avWinList[$n][0] & @CRLF & _ "HWND: " & $avWinList[$n][1] & @CRLF & _ "Class: " & $sClass) Exit EndIf Next MsgBox(16, "Not Found", "Did not find a matching window.") Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law Link to comment Share on other sites More sharing options...
ProgAndy Posted December 31, 2008 Share Posted December 31, 2008 Found a way to do it with REGEXPCALSS ;Start EXCEL manually first! Opt("WinTitleMatchMode", 2) ToolTip("Waiting for Excel") ; None of them works $Search="[TITLE:Excel; REGEXPCLASS:\A(?!tooltips_class)]" ; Matches beginning of Class is not "tooltips_class" MsgBox(0, '', WinExists($Search)) *GERMAN* [note: you are not allowed to remove author / modified info from my UDFs]My UDFs:[_SetImageBinaryToCtrl] [_TaskDialog] [AutoItObject] [Animated GIF (GDI+)] [ClipPut for Image] [FreeImage] [GDI32 UDFs] [GDIPlus Progressbar] [Hotkey-Selector] [Multiline Inputbox] [MySQL without ODBC] [RichEdit UDFs] [SpeechAPI Example] [WinHTTP]UDFs included in AutoIt: FTP_Ex (as FTPEx), _WinAPI_SetLayeredWindowAttributes Link to comment Share on other sites More sharing options...
PsaltyDS Posted December 31, 2008 Share Posted December 31, 2008 Found a way to do it with REGEXPCALSS $Search="[TITLE:Excel; REGEXPCLASS:\A(?!tooltips_class)]"; Matches beginning of Class is not "tooltips_class" MsgBox(0, '', WinExists($Search)) Oh, nice one. Negative Lookahead Assertions; that's what I didn't find in my reading. Thanks. Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law Link to comment Share on other sites More sharing options...
MatheFreak Posted January 1, 2009 Author Share Posted January 1, 2009 Found a way to do it with REGEXPCALSS ;Start EXCEL manually first! Opt("WinTitleMatchMode", 2) ToolTip("Waiting for Excel") $Search="[TITLE:Excel; REGEXPCLASS:\A(?!tooltips_class)]"; Matches beginning of Class is not "tooltips_class" MsgBox(0, '', WinExists($Search))Great!! Thank you! Indeed I thought '^' was a negation, and dont yet understand this '\A(' thing. Looks getting quite complicated :-) , but might work. Just I'm on wrong machine till monday, I'll let you know! Link to comment Share on other sites More sharing options...
MatheFreak Posted January 2, 2009 Author Share Posted January 2, 2009 Just I'm on wrong machine today, I'll let you know!It works Great!! Thank you! 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