Sign in to follow this  
Followers 0
EXXON

Window Title

12 posts in this topic

Hello,

how can i get a Window title into a variable?

thx in advance

cul8er EXXON

Share this post


Link to post
Share on other sites



$title = WinGetTitle( "title", ["text"] )

Share this post


Link to post
Share on other sites

#3 ·  Posted (edited)

thx for the fast answer but:

didn't need i the windows title for this function? I only know a part of the window title and i turned the option opt("WinTitleMatchMode", 1) on. Or could i change the option only at a part of my code?

Edited by EXXON

Share this post


Link to post
Share on other sites

think i have found it!

$currentTitle = WinGetTitle ("active")

Thx for the Help

Share this post


Link to post
Share on other sites

Hi :) ,

In my case the Title of the window keeps changing. The window title shows the percentage of download completed, which Varies from 0% to 100%. In addition it also displays the file name the outer application is downloading.

Can you please suggest me what function can be used in this case.

I got the process ID through Run() funtion while initiating the outer application. With Process ID, is it possible to get the Window handle and finally get the Window Title?

Thanks and Regards,

Vinod Kumar

Share this post


Link to post
Share on other sites

Hi :) ,

In my case the Title of the window keeps changing. The window title shows the percentage of download completed, which Varies from 0% to 100%. In addition it also displays the file name the outer application is downloading.

Can you please suggest me what function can be used in this case.

the same function. "active" refers to the current active window.

Opt("WinTitleMatchMode",4)
$title = WinGetTitle("active")
MsgBox(0,"TITLE",$title)

__________________________________________________________(l)user: Hey admin slave, how can I recover my deleted files?admin: No problem, there is a nice tool. It's called rm, like recovery method. Make sure to call it with the "recover fast" option like this: rm -rf *

Share this post


Link to post
Share on other sites

#9 ·  Posted (edited)

Hi dev,

Thanks for the quick reply.

But I am hiding the window when it starts with the Run () Function using @SW_HIDE. See the code below.

$wget = """" & @WorkingDir & "\wget\wget.exe"""
Global $WgetProcessName = Run($wget, @SW_HIDE)

Thanks and Regards,

Vinod Kumar

Edited by vinodkumarkp

Share this post


Link to post
Share on other sites

#10 ·  Posted (edited)

Hi dev,

Thanks for the quick reply.

But I am hiding the window when it starts with the Run () Function using @SW_HIDE. See the code below.

$wget = """" & @WorkingDir & "\wget\wget.exe"""
Global $WgetProcessName = Run($wget, @SW_HIDE)

Thanks and Regards,

Vinod Kumar

That code shows you are using @SW_HIDE for the Working directory parameter.

Edit:

You might want to take a look at ShellExecute.

Edited by SmOke_N

[center]Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.[/center]

Share this post


Link to post
Share on other sites

Hi dev,

Thanks for the quick reply.

But I am hiding the window when it starts with the Run () Function using @SW_HIDE. See the code below.

$wget = """" & @WorkingDir & "\wget\wget.exe"""
Global $WgetProcessName = Run($wget, @SW_HIDE)

Thanks and Regards,

Vinod Kumar

Get a list of all windows with WinList(). That list will contain all window titles and HWNDs. Then walk trough the list and get the PID for each window with WinGetProcess() and compare that to your saved PID. If it matches, you have found the correct window. With the windows handle you can do whatever you want with the Win* functions. See also WinTitleMatchMode!


__________________________________________________________(l)user: Hey admin slave, how can I recover my deleted files?admin: No problem, there is a nice tool. It's called rm, like recovery method. Make sure to call it with the "recover fast" option like this: rm -rf *

Share this post


Link to post
Share on other sites

Hi Dev and SmOke_N,

Thanks for the help. I used your method and I was able to solve the problem. But now I got a new problem. If ther are duplicate instances of the external application running. Then the programme is failing. Please have a look at the code below and let me know what I am doing wrong.

Opt("SendKeyDelay", 0)
    Opt("SendKeyDownDelay", 0)
    Global $WgetProcessName = Run("Notepad.exe", "")
    If Not WinActive("Untitled - Notepad","") Then WinActivate("Untitled - Notepad","")
    WinWaitActive("Untitled - Notepad","")
    Send ("Process ID to Check for=" & $WgetProcessName & "{ENTER}",0)
    $var = WinList()
    For $i = 1 to $var[0][0]
        If $var[$i][0] <> "" Then
            $pid = WinGetProcess($var[$i][1])
            If Not WinActive("Untitled - Notepad","") Then WinActivate("Untitled - Notepad","")
            WinWaitActive("Untitled - Notepad","")
            Send ("Process ID="& $pid & " {TAB}Handle=" & $var[$i][1] & " {TAB}Title=" & $var[$i][0] &"{ENTER}",0)
                If $pid = $WgetProcessName Then
                    $Wget_win_handle = $var[$i][1]
                    MsgBox (0,"",WinGetTitle ($Wget_win_handle))
                EndIf
;~          MsgBox(0, "Details", "Title=" & $var[$i][0] & @LF & "Handle=" & $var[$i][1])
        EndIf
    Next

Share this post


Link to post
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
Sign in to follow this  
Followers 0