Guest User

Chatlog Saver

a guest
Aug 3rd, 2019
171
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #include <TrayConstants.au3>
  2. Opt("TrayMenuMode", 3 )
  3.  
  4. ;~ GLOBAL VARIABLE
  5. local $stateGTA = WinExists( "GTA:SA:MP" )
  6. local $logDir = @MyDocumentsDir & "\GTA San Andreas User Files\SAMP\"
  7.  
  8. ;~ TRAY MANAGEMENT
  9. Opt("TrayMenuMode", 3 )
  10. TrayCreateItem ( "SAMP Chatlog Saver by Nelson" )
  11. $chatlogDir = TrayCreateItem ( "Dossier des chatlogs" )
  12. $quit = TrayCreateItem ( "Quitter" )
  13.  
  14.  
  15. Func findChatlogNewName()
  16.     For $i = 1 To 4000
  17.         local $n = $logDir&"\chatlog ("&$i&").txt"
  18.         If (Not FileExists($n)) Then
  19.             Return $n
  20.         EndIf
  21.     Next
  22. EndFunc
  23.  
  24. While 1
  25.     Sleep( 100 )
  26.     if ($stateGTA == True) Then
  27.         If (Not WinExists( "GTA:SA:MP" )) Then
  28.             FileCopy( $logDir&"\chatlog.txt", findChatlogNewName())
  29.             $stateGTA = False
  30.         EndIf
  31.     Else
  32.         If WinExists( "GTA:SA:MP" ) Then
  33.             $stateGTA = True
  34.         EndIf
  35.     EndIf
  36.     Switch TrayGetMsg()
  37.         Case $chatlogDir
  38.             Run("explorer /e, " & '"' & $logDir & '"')
  39.         Case $quit
  40.             Exit
  41.     EndSwitch
  42. WEnd
RAW Paste Data