Blue_Drache Posted June 22, 2006 Share Posted June 22, 2006 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 Link to comment Share on other sites More sharing options...
Moderators SmOke_N Posted June 22, 2006 Moderators Share Posted June 22, 2006 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 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. Link to comment Share on other sites More sharing options...
Blue_Drache Posted June 22, 2006 Author Share Posted June 22, 2006 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 Link to comment Share on other sites More sharing options...
seandisanti Posted June 22, 2006 Share Posted June 22, 2006 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 EndFunckind of longhand for Opt("WinTitleMatchMode",4) Opt("WinSearchChildren",1) WinGetTitle("active") isn't it? Link to comment Share on other sites More sharing options...
Moderators SmOke_N Posted June 22, 2006 Moderators Share Posted June 22, 2006 kind of longhand for Opt("WinTitleMatchMode",4) Opt("WinSearchChildren",1) WinGetTitle("active") isn't it? Do I ever do anything easy? 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. Link to comment Share on other sites More sharing options...
seandisanti Posted June 22, 2006 Share Posted June 22, 2006 Do I ever do anything easy? you do plenty of easy things, in as difficult a fashion as you're able. Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now