Jump to content

ToolTip buggy? (Blocks WinTitleMatchMode)


Recommended Posts

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

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

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

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

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

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

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

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

Found a way to do it with REGEXPCALSS :o

$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

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

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...