Jump to content

Search the Community

Showing results for tags 'logout'.

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • General
    • Announcements and Site News
    • Administration
  • AutoIt v3
    • AutoIt Help and Support
    • AutoIt Technical Discussion
    • AutoIt Example Scripts
  • Scripting and Development
    • Developer General Discussion
    • Language Specific Discussion
  • IT Administration
    • Operating System Deployment
    • Windows Client
    • Windows Server
    • Office

Categories

  • AutoIt Team
    • Beta
    • MVP
  • AutoIt
    • Automation
    • Databases and web connections
    • Data compression
    • Encryption and hash
    • Games
    • GUI Additions
    • Hardware
    • Information gathering
    • Internet protocol suite
    • Maths
    • Media
    • PDF
    • Security
    • Social Media and other Website API
    • Windows
  • Scripting and Development
  • IT Administration
    • Operating System Deployment
    • Windows Client
    • Windows Server
    • Office

Find results in...

Find results that contain...


Date Created

  • Start

    End


Last Updated

  • Start

    End


Filter by number of...

Joined

  • Start

    End


Group


Member Title


Location


WWW


Interests

Found 1 result

  1. I created this script but would like to help fine tuning it. My goal is to add this to a existing GUI script, and have this function only run if a user logs out of the computer without filling in the GUI form. Any ideas or help would be greatly appreciated. #include <File.au3> #include <Array.au3> Local $aLines, $iCount = 0 local $hDate = @YEAR & '-' & @MON & '-' & @MDAY local $hfile=FileOpen("\\192.168.26.17\Logs\testlog.txt", 1) OnAutoItExitRegister("MyTestFunc") Sleep(2000) Func MyTestFunc() local $sUsername = @UserName ; User Name Local $sComputername = @ComputerName ; Computer Name $sText1 = "Username = " & $sUsername & @CRLF ; The & character concentrates (joins) two values together. $sText2 = "Computer Name = " & $sComputername & @CRLF ; The &= adds to the variable. The same as doing $var = $var & "extra stuff" _FileReadToArray("\\192.168.26.17\Logs\testlog.txt", $aLines) If Not @error Then ; if the file exists look for the ID starting on the last line For $i = $aLines[0] To 1 Step -1 If StringLeft($aLines[$i], 2) == "id" Then ; get the ID number $iCount = Int(StringRegExpReplace($aLines[$i], "id(\d*):.*", "$1")) ExitLoop EndIf Next ; Check we found an ID If $i = 0 Then MsgBox(0, "Error", "No line id found") Exit EndIf EndIf FileWrite($hfile, _LineID() & '|' & $hDate & '|' & $sComputername & '|' & $sUsername & '|' &'logged off' & @CRLF) FileClose($hfile) EndFunc Func _LineID() $iCount += 1 Return "id" & StringFormat("%04i", $iCount) & ": " EndFunc ;==> LineID
×
×
  • Create New...