Jump to content

WinGetTitle always return 0 - nothings helps


Recommended Posts

Hi, 

I have autoit program on my computer only portable version. I use Autoit vs 3.1.1.68

I want to use WinGetTitle but it always return 0. 

I want to use it for retriev windows title and then i want to switch between windows. 

E.g. - On start is msgbox where is info - "now choose yourt first window", i click first win - e.g. Excel, then 2. msgbox "now choose your 2. window" and i choose e.g. window folder. Then i want, that my script will switch between this windws and make my routine. 

But my test code for retrieve win title still return 0. I try this on comp in work. I dont have admin rights but i belive, that this is not a reason, bacause Au3.SPY, show me win title correctly. 

This is my sample code. 

Pls. any suggestions?

thx a lot

Sleep( 2000 ) ; Allows switching to some other window to see if can get its title.
$title = WinGetTitle("[active]")
If $title Then
    MsgBox(0, "", $title)
 Else
    MsgBox(0, "", "nothing")
EndIf

 

Link to comment
Share on other sites

This will get Active WIndows

Global $g_sTitle = ""

_WinGetTitle()

Func _WinGetTitle()
    Local $_sTitle = ""
    While 1
        $_sTitle = WinGetTitle("[Active]", "")
            If $_sTitle = $g_sTitle Or StringStripWS($_sTitle, 8) = "" Then ContinueLoop Sleep(100)
        $g_sTitle = $_sTitle
        MsgBox(4096, "Window Title", "Window Title = " & $g_sTitle, 2)
    WEnd
EndFunc

 

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

×
×
  • Create New...