Jammer Posted July 29, 2007 Posted July 29, 2007 Global $win Global $text While 1 Sleep(1) if Not WinActive($win) then $winlist = WinList() for $wind in $winlist if WinActive($wind) Then $win = $wind $text = $text & "" & $win & " ^ " & @YEAR & "/" & @MON & "/" & @MDAY & " " & @HOUR & ":" & @MIN & ":" & @SEC & "" endif next EndIf WEnd this program should record what windows do i use and when... it doesn't work... why.
Jammer Posted July 29, 2007 Author Posted July 29, 2007 how can i determine the current active window title?
dNino Posted July 29, 2007 Posted July 29, 2007 $title=WinGetTitle('[ACTIVE]') if I'm correct It's al in the help-file...
erebus Posted July 29, 2007 Posted July 29, 2007 I hope you are looking something like this. Study the code line by line and you will understand how things are handled. Opt("WinTitleMatchMode", 4) ; Match the windows by their handles, not their titles; it gives more accurate results if we have double windows with the same title. #include <File.au3> ; We need this for the _FileWriteLog function used below. Dim $active ; Dim the variable outside the loop. While 1 $winlist = WinList() ; Return all windows, active or not, to an array For $i = 1 To $winlist[0][0] ; Scan all reported window handles ([0][0]) $state = WinGetState($winlist[$i][1]) ; Check each window state. If BitAnd($state, 8) And $winlist[$i][1] <> $active And $winlist[$i][0] <> "" Then ; If the state is found to be active (8) and we have not previously recorded the same action and the window title is not null, write it to the log $active = $winlist[$i][1] ; We change this variable here so as to update our check above for the next time. _FileWriteLog(@ScriptDir & "\my.log", $winlist[$i][0] & " found active @ " & @HOUR & ":" & @MIN & ":" & @SEC) ; Write down the window found active. EndIf Next WEnd
Fabry Posted July 29, 2007 Posted July 29, 2007 Try this: $winlist=WinList() Global $win =$winlist[1][0] Global $text While 1 Sleep(1) If Not WinActive($win) Then $winlist = WinList() For $k = 1 To $winlist[0][0] If $winlist[$k][0] <> "" And IsVisible($winlist[$k][1]) Then $win=$winlist[$k][0] $text = $text & "" & $winlist[$k][0] & " ^ " & @YEAR & "/" & @MON & "/" & @MDAY & " " & @HOUR & ":" & @MIN & ":" & @SEC & ""&@CRLF EndIf Next EndIf WEnd Func IsVisible($handle) If BitAND(WinGetState($handle), 2) Then Return 1 Else Return 0 EndIf EndFunc ;==>IsVisible A lan chat (Multilanguage)LanMuleFile transferTank gameTank 2 an online game[center]L'esperienza è il nome che tutti danno ai propri errori.Experience is the name everyone gives to their mistakes.Oscar Wilde[/center]
Developers Jos Posted July 29, 2007 Developers Posted July 29, 2007 $title=WinGetTitle('[ACTIVE]') if I'm correct It's al in the help-file...my version of the HelpFile states: Remarks WinGetTitle("") returns the active window's title. WinGetTitle works on both minimized and hidden windows. If multiple windows match the criteria, the most recently active window is used. SciTE4AutoIt3 Full installer Download page - Beta files Read before posting How to post scriptsource Forum etiquette Forum Rules Live for the present, Dream of the future, Learn from the past.
erebus Posted July 29, 2007 Posted July 29, 2007 I hope he was mostly interested in the logic, not the function itself.. :}
dNino Posted July 29, 2007 Posted July 29, 2007 how can i determine the current active window title?this is what I'm answering to
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