[Mini Request] Looking for Active Window + Textfile creation

06/18/2015 16:32 DAFUQx#1
HeyGuys,
i need a mini script that is just checking all 30 seconds for a Active window.

Window Name: League of Legends (TM) Client

When the Window (Game) is active it has to write into a Textfile "Ingame" when the Window gets closed change "Ingame" into "Not Ingame".


It would be awesome when someone can help me... im a autoit noob :/
:handsdown: 1000x Thanks!
06/18/2015 17:58 [Beatrice]#2
Quote:
Originally Posted by DAFUQx View Post
HeyGuys,
i need a mini script that is just checking all 30 seconds for a Active window.

Window Name: League of Legends (TM) Client

When the Window (Game) is active it has to write into a Textfile "Ingame" when the Window gets closed change "Ingame" into "Not Ingame".


It would be awesome when someone can help me... im a autoit noob :/
:handsdown: 1000x Thanks!




Code:
HotKeySet("{HOME}","ExitS")
FileWrite(@DesktopDir & "\LogWindow.txt","[" & @Mon & "/" & @Mday & " - " & @Hour & ":" & @Min & ":" & @Sec & "] ===> " &  "Started Logging." & @CRLF)
While 1
   Sleep(30000)
   If WinExists("League of Legends (TM) Client") = 1 Then
	  FileWrite(@DesktopDir & "\LogWindow.txt","[" & @Mon & "/" & @Mday & " - " & @Hour & ":" & @Min & ":" & @Sec & "] ===> " &  "Ingame." & @CRLF)
   Else
	  FileWrite(@DesktopDir & "\LogWindow.txt","[" & @Mon & "/" & @Mday & " - " & @Hour & ":" & @Min & ":" & @Sec & "] ===> " &  "Not Ingame." & @CRLF)
   EndIf
WEnd
   
   Func ExitS()
	  FileWrite(@DesktopDir & "\LogWindow.txt","[" & @Mon & "/" & @Mday & " - " & @Hour & ":" & @Min & ":" & @Sec & "] ===> " &  "Stopped Logging." & @CRLF)
	  Exit
   EndFunc
06/18/2015 18:32 DAFUQx#3
Thank you mate!
Working perfect.