Sign in to follow this  
Followers 0
Blue_Drache

$temp = WinGetTitle("")

6 posts in this topic

WinGetTitle("") returns the active window's title.

$ActiveWindow = WinGetTitle("")
MsgBox(262144,'Debug line ~23','Selection:' & @lf & '$ActiveWindow' & @lf & @lf & 'Return:' & @lf & $ActiveWindow & @lf & @lf & '@Error:' & @lf & @Error) ;### Debug MSGBOX
  Select
      Case $ActiveWindow = $a
           ; test case one
          $ExitCode = DoFunctionOne()
          Exit $ExitCode
      Case $ActiveWindow = $b
           ; test case two
          $ExitCode = DoFunctionTwo()
          Exit $ExitCode
      Case Else
          ; bomb
          Exit 5000
  EndSelect

F5 - runs...

Selection:

$ActiveWindow

Return:

1

@Error

0

!>AutoIT3.exe ended.rc:5000

>Exit code: 5000 Time: 14.583

I'm always getting a neumeric one. It should be returning the name of the SciTE window. Any other reliable way to do this?


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

Share this post


Link to post
Share on other sites



Guess you could try this:

MsgBox(0,'', _WinGetActive())

Func _WinGetActive()
    $OptWSC = Opt('WinSearchChildren', 1)
    $aWinList = WinList()
    For $iCount = 1 To $aWinList[0][0]
        If $aWinList[$iCount][0] <> '' And WinActive($aWinList[$iCount][0]) Then
            Opt('WinSearchChildren', $OptWSC)
            Return $aWinList[$iCount][0]
        EndIf
    Next
    Opt('WinSearchChildren', $OptWSC)
    Return 0
EndFunc


[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

Guess you could try this:

MsgBox(0,'', _WinGetActive())

Func _WinGetActive()
    $OptWSC = Opt('WinSearchChildren', 1)
    $aWinList = WinList()
    For $iCount = 1 To $aWinList[0][0]
        If $aWinList[$iCount][0] <> '' And WinActive($aWinList[$iCount][0]) Then
            Opt('WinSearchChildren', $OptWSC)
            Return $aWinList[$iCount][0]
        EndIf
    Next
    Opt('WinSearchChildren', $OptWSC)
    Return 0
EndFunc

Nifty little UDF. Thanks.


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

Share this post


Link to post
Share on other sites

Guess you could try this:

MsgBox(0,'', _WinGetActive())

Func _WinGetActive()
    $OptWSC = Opt('WinSearchChildren', 1)
    $aWinList = WinList()
    For $iCount = 1 To $aWinList[0][0]
        If $aWinList[$iCount][0] <> '' And WinActive($aWinList[$iCount][0]) Then
            Opt('WinSearchChildren', $OptWSC)
            Return $aWinList[$iCount][0]
        EndIf
    Next
    Opt('WinSearchChildren', $OptWSC)
    Return 0
EndFunc
kind of longhand for

Opt("WinTitleMatchMode",4)
Opt("WinSearchChildren",1)
WinGetTitle("active")

isn't it? :D


1100111 00001011101111 00011101101111 00010111100100 00001111110100 00110111110010 00101101111001 0011100i didn't make up this form of encryption, but i like it.credit to the lvl 6 challenge on arcanum.co.nz

Share this post


Link to post
Share on other sites

kind of longhand for

Opt("WinTitleMatchMode",4)
Opt("WinSearchChildren",1)
WinGetTitle("active")

isn't it? :D

Do I ever do anything easy? :D

[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

Do I ever do anything easy? :D

you do plenty of easy things, in as difficult a fashion as you're able. :D

1100111 00001011101111 00011101101111 00010111100100 00001111110100 00110111110010 00101101111001 0011100i didn't make up this form of encryption, but i like it.credit to the lvl 6 challenge on arcanum.co.nz

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