AutoHotkey Community

It is currently May 26th, 2012, 1:42 pm

All times are UTC [ DST ]




Post new topic Reply to topic  [ 23 posts ]  Go to page 1, 2  Next
Author Message
PostPosted: December 10th, 2008, 1:52 am 
Offline

Joined: November 6th, 2006, 4:18 pm
Posts: 39
Location: Sechelt,BC
I would like to make a timer that shows total hours that my PC has been on. eg 1 hour a day x 100 days = total hours 100

Basically a timer that keeps track of total hours PC is on.

Any suggestions

Thankyou Red


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: December 10th, 2008, 1:58 am 
Offline

Joined: May 25th, 2007, 6:13 pm
Posts: 373
A_TickCount is the variable which holds the length of time since a computer has been rebooted. So just separate that into the hh:mm:ss and you'll have your time the computer has been on.

Ciao,
Dra'Gon

_________________
Image
For a good laugh {hopefully} >> megamatts.50megs.com

My WritersCafe profile>>
http://www.writerscafe.org/writers/BlueDragonFire/


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: December 10th, 2008, 2:39 am 
Offline

Joined: November 6th, 2006, 4:18 pm
Posts: 39
Location: Sechelt,BC
Still not sure what to do
Redd


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: December 10th, 2008, 2:52 am 
Offline

Joined: April 18th, 2008, 7:57 am
Posts: 1390
Location: The Interwebs
Code:
MsgBox, % "The computer has been on for " A_TickCount/(1000*60*60) " hours."


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: December 10th, 2008, 7:39 am 
Offline

Joined: November 6th, 2006, 4:18 pm
Posts: 39
Location: Sechelt,BC
The Timer restarts (at 0)when PC is turned on,
I would like timer to keep track of total time,PC has been on.
Eg:after 1 year 1040 hours
Redd


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: December 11th, 2008, 12:51 am 
Offline

Joined: November 6th, 2006, 4:18 pm
Posts: 39
Location: Sechelt,BC
I still need help ,simple timer for total time


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: December 11th, 2008, 1:00 am 
Offline

Joined: August 23rd, 2004, 10:06 pm
Posts: 276
Location: East Bay, California USA
what system are you using? XP, Vista, 2000? those have that function built in.
ex: start --> run --> cmd --> systeminfo

_________________
----------------------------
Wingfool you fat! I mean, Wingfat you fool!
Line from Woody Allen's movie "What's Up Tiger Lilly?"
-----------------------------


Last edited by Wingfat on December 11th, 2008, 1:04 am, edited 1 time in total.

Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: December 11th, 2008, 1:21 am 
Offline

Joined: April 18th, 2008, 7:57 am
Posts: 1390
Location: The Interwebs
Wingfat wrote:
what system are you using? XP, Vista, 2000? those have that function built in.
ex: start --> run --> cmd --> systeminfo


I don't see the total up time anywhere in the information given by systeminfo...


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: December 11th, 2008, 4:07 am 
Offline

Joined: February 17th, 2008, 8:52 pm
Posts: 314
Wingfat wrote:
what system are you using? XP, Vista, 2000? those have that function built in.
ex: start --> run --> cmd --> systeminfo


Nice command. Haven't seen that one before. 11 line down shows the following on XP.


System Up Time: 0 Days, 0 Hours, 47 Minutes, 22 Seconds


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: December 11th, 2008, 4:24 am 
just use the settimer method, its not hard at all
like:
Code:
settimer, aa, 60000  ;updates every 1 minute
aa:
IniRead, OutputVar, C:\Temp\myfile.ini, section1, key
OutputVar++
IniWrite, %OutputVar%, C:\Temp\myfile.ini, section1, key
return

F1::
IniRead, OutputVar, C:\Temp\myfile.ini, section1, key
msgbox, %OutputVar% mins
return

of course, u need to put this program in the startup folder


Report this post
Top
  
Reply with quote  
 Post subject:
PostPosted: December 11th, 2008, 4:32 am 
Offline

Joined: October 13th, 2008, 4:14 pm
Posts: 60
Location: South Park, Colorado
redd wrote:
I still need help ,simple timer for total time
I don't think you're going to find what you'll consider to be a "simple" solution, because I don't think that Windows tracks the total time that a computer has been on.

Since you want it to track the total time, your script must write the data someplace "permanent".... that won't vanish when you power cycle your computer. With Windows this usually means the registry, or an .ini file. The .ini file will be easier for you to code.

Check out the commands: IniRead and IniWrite, as well as A_Tickcount.

Rather than just having the computer update the ini file every hour, I'd make a shutdown script that added A_Tickcount to a running total in the .ini file every time you powered your computer off.


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: December 11th, 2008, 4:42 am 
Offline

Joined: April 18th, 2008, 7:57 am
Posts: 1390
Location: The Interwebs
vahju wrote:
Wingfat wrote:
what system are you using? XP, Vista, 2000? those have that function built in.
ex: start --> run --> cmd --> systeminfo


Nice command. Haven't seen that one before. 11 line down shows the following on XP.


System Up Time: 0 Days, 0 Hours, 47 Minutes, 22 Seconds


Interesting. On Vista, I get...
Code:
OS Name
OS Version
OS Manufacturer
OS Configuration
OS Build Type
Registered Owner
Registered Organization
Product ID
Original Install Date
System Boot Time
System Manufacturer
System Model
System Type
Processor(s)
BIOS Version
Windows Directory
System Directory
Boot Device
System Locale
Input Locale
Time Zone
Total Physical Memory
Available Physical Memory
some page file stuff....
hot fixes...
network stuff...


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: December 11th, 2008, 8:48 am 
Offline

Joined: November 6th, 2006, 4:18 pm
Posts: 39
Location: Sechelt,BC
I use WinXP

settimer, aa, 60000 ;updates every 1 minute
aa:
IniRead, OutputVar, C:\Temp\myfile.ini, section1, key
OutputVar++
IniWrite, %OutputVar%, C:\Temp\myfile.ini, section1, key
return

F1::
IniRead, OutputVar, C:\Temp\myfile.ini, section1, key
msgbox, %OutputVar% mins
return
I get error when F1 pushed


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: December 11th, 2008, 2:02 pm 
Offline

Joined: July 15th, 2007, 1:43 am
Posts: 1320
redd wrote:
I use WinXP
Code:
settimer, aa, 60000  ;updates every 1 minute
aa:
IniRead, OutputVar, C:\Temp\myfile.ini, section1, key
OutputVar++
IniWrite, %OutputVar%, C:\Temp\myfile.ini, section1, key
Return

F1::
IniRead, OutputVar, C:\Temp\myfile.ini, section1, key
msgbox, %OutputVar% mins
return


I get error when F1 pushed


You get an error, because that is the default value for IniRead to return for a blank value. On your first IniRead, use the default option:

Code:
SetTimer, aa, 60000  ; updates every 1 minute
aa:
IniRead, OutputVar, C:\Temp\myfile.ini, section1, key, 0 ; If no value is found, assume it is 0.
OutputVar++
IniWrite, %OutputVar%, C:\Temp\myfile.ini, section1, key
return

F1::
IniRead, OutputVar, C:\Temp\myfile.ini, section1, key
MsgBox, %OutputVar% mins
Return

_________________
Religion is false. >_>


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: December 11th, 2008, 5:00 pm 
Offline

Joined: November 6th, 2006, 4:18 pm
Posts: 39
Location: Sechelt,BC
Still error,
myfile.ini ,how do I make this file?
Redd


Report this post
Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 23 posts ]  Go to page 1, 2  Next

All times are UTC [ DST ]


Who is online

Users browsing this forum: Newl, patgenn123, Pietro, poserpro and 17 guests


You can post new topics in this forum
You can reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Powered by phpBB® Forum Software © phpBB Group