mastrboy Posted March 7, 2007 Share Posted March 7, 2007 i putting it on this forum so i don't loose it Func _uptime(ByRef $iDays, ByRef $iHours, ByRef $iMins, ByRef $iSecs) $iTicks = DllCall("kernel32.dll", "long", "GetTickCount") $iTicks = $iTicks[0] If Number($iTicks) > 0 Then $iTicks = Round($iTicks / 1000) $iDays = Int($iTicks / 86400) $iHours = Int($iTicks / 3600) $iTicks = Mod($iTicks, 3600) $iMins = Int($iTicks / 60) $iSecs = Round(Mod($iTicks, 60)) Return 1 ElseIf Number($iTicks) = 0 Then $iDays = 0 $iHours = 0 $iTicks = 0 $iMins = 0 $iSecs = 0 Return 1 Else SetError(1) Return 0 EndIf EndFunc ;==>_uptimeoÝ÷ Ú+wöƦ¡Øçoz»"¢z¶'$²Ú-gºØën®{-ë©¶)µë-yÚ'Æ6Ç«½êðÚMìz»ÞìZ^jëh×6Dim $idays Dim $ihours Dim $imins Dim $isecs _uptime($idays,$ihours,$imins,$isecs) MsgBox(0,"Uptime","Days: "&$idays&" Hours: "&$ihours&" mins: "&$imins&" secs: "&$isecs) exit - Link to comment Share on other sites More sharing options...
ptrex Posted March 7, 2007 Share Posted March 7, 2007 @mastrboy Simple, but VERY usefull Thanks ptrex Contributions :Firewall Log Analyzer for XP - Creating COM objects without a need of DLL's - UPnP support in AU3Crystal Reports Viewer - PDFCreator in AutoIT - Duplicate File FinderSQLite3 Database functionality - USB Monitoring - Reading Excel using SQLRun Au3 as a Windows Service - File Monitor - Embedded Flash PlayerDynamic Functions - Control Panel Applets - Digital Signing Code - Excel Grid In AutoIT - Constants for Special Folders in WindowsRead data from Any Windows Edit Control - SOAP and Web Services in AutoIT - Barcode Printing Using PS - AU3 on LightTD WebserverMS LogParser SQL Engine in AutoIT - ImageMagick Image Processing - Converter @ Dec - Hex - Bin -Email Address Encoder - MSI Editor - SNMP - MIB ProtocolFinancial Functions UDF - Set ACL Permissions - Syntax HighLighter for AU3ADOR.RecordSet approach - Real OCR - HTTP Disk - PDF Reader Personal Worldclock - MS Indexing Engine - Printing ControlsGuiListView - Navigation (break the 4000 Limit barrier) - Registration Free COM DLL Distribution - Update - WinRM SMART Analysis - COM Object Browser - Excel PivotTable Object - VLC Media Player - Windows LogOnOff Gui -Extract Data from Outlook to Word & Excel - Analyze Event ID 4226 - DotNet Compiler Wrapper - Powershell_COM - New Link to comment Share on other sites More sharing options...
MCP Posted September 16, 2007 Share Posted September 16, 2007 First of all, thanks for sharing, mastrboy. I think I have found a small bug in the hours count: variable $iHours contains the total number of hours, not just the remaining hours when you have removed from the total the number of days the system is online.Thus, I have changed the $iHours assignment from$iHours = Int($iTicks / 3600) 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