Jump to content

How to get exact name of window?


Recommended Posts

This is giving me problems now. The autoit I am working has to go from one window to another. It is not picking up one of the windows. Is there a way to get the exact window name so I can plug it into the script and make it work?

I am not sure how I should add this window name to the script so it knows that is the window I need. Have not had a problem before but this one is giving me fits.

Link to comment
Share on other sites

in the autoit install folder there should be a program called AU3Info.exe, use that to find the exact title of the window you want to activate.

If you still have problems, try posting at least the problematical part of your script here and maybe someone will be able to see the problem easier.

Link to comment
Share on other sites

This is giving me problems now.  The autoit I am working has to go from one window to another.  It is not picking up one of the windows.  Is there a way to get the exact window name so I can plug it into the script and make it work? 

I am not sure how I should add this window name to the script so it knows that is the window I need.  Have not had a problem before but this one is giving me fits.

<{POST_SNAPBACK}>

Again, if you're using partial names, your problem may be solved by setting the correct Opt() at the start of the script.

Opt(WinTitleMatchMode,2) - this matches full or partial strings in the title of the window.

I prefer Opt(WinTitleMatchMode,4) as that allows you to use "classname=blah" Classnames are more accurate anyway, and unique to the window (correct me if I'm wrong, of course)

Then, I just get the window handle and use it. Window handles are the most accurate way of using the focus, send, control send, etc.

Opt(WinTitleMatchMode,4)
Global $primary, $secondary
MouseButton($primary, $secondary)

If WinExists("classname=ThunderClass234")
   $hwnd_blah = WinGetHandle("classname=ThunderClass234")
   WinActivate($hwnd_blah)
   WinMove($hwnd_blah,0,0,300,300)
   ControlSend($hwnd_blah,"",Button1,$primary,1)
EndIf


#Region Functions
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; Function to check what button is primary on user's mouse.
; useful for detecting those who have swapped the mouse buttons.
; From the AutoIt Help File.
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
Func MouseButton(ByRef $primary, ByRef $secondary)
   Local $k
   $k = RegRead("HKEY_CURRENT_USER\Control Panel\Mouse", "SwapMouseButtons")
   If $k = 1 Then
      $primary = "right"
      $secondary = "left"
   Else;normal (also case if could not read registry key)
      $primary = "left"
      $secondary = "right"
   EndIf
EndFunc ;==>MouseButton
#EndRegion
Edited by Blue_Drache

Lofting the cyberwinds on teknoleather wings, I am...The Blue Drache

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