 |
AutoHotkey Community Let's help each other out
|
| View previous topic :: View next topic |
| Author |
Message |
redd
Joined: 06 Nov 2006 Posts: 39 Location: Sechelt,BC
|
Posted: Wed Dec 10, 2008 12:52 am Post subject: Timer, total number of hours PC is on? Help |
|
|
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 |
|
| Back to top |
|
 |
Dra_Gon
Joined: 25 May 2007 Posts: 373
|
Posted: Wed Dec 10, 2008 12:58 am Post subject: |
|
|
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 _________________
For a good laugh {hopefully} >> megamatts.50megs.com
My WritersCafe profile>>
http://www.writerscafe.org/writers/BlueDragonFire/ |
|
| Back to top |
|
 |
redd
Joined: 06 Nov 2006 Posts: 39 Location: Sechelt,BC
|
Posted: Wed Dec 10, 2008 1:39 am Post subject: |
|
|
Still not sure what to do
Redd |
|
| Back to top |
|
 |
Krogdor
Joined: 18 Apr 2008 Posts: 1390 Location: The Interwebs
|
Posted: Wed Dec 10, 2008 1:52 am Post subject: |
|
|
| Code: | | MsgBox, % "The computer has been on for " A_TickCount/(1000*60*60) " hours." |
|
|
| Back to top |
|
 |
redd
Joined: 06 Nov 2006 Posts: 39 Location: Sechelt,BC
|
Posted: Wed Dec 10, 2008 6:39 am Post subject: |
|
|
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 |
|
| Back to top |
|
 |
redd
Joined: 06 Nov 2006 Posts: 39 Location: Sechelt,BC
|
Posted: Wed Dec 10, 2008 11:51 pm Post subject: |
|
|
| I still need help ,simple timer for total time |
|
| Back to top |
|
 |
Wingfat
Joined: 23 Aug 2004 Posts: 275 Location: East Bay, California USA
|
Posted: Thu Dec 11, 2008 12:00 am Post subject: |
|
|
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 Thu Dec 11, 2008 12:04 am; edited 1 time in total |
|
| Back to top |
|
 |
Krogdor
Joined: 18 Apr 2008 Posts: 1390 Location: The Interwebs
|
Posted: Thu Dec 11, 2008 12:21 am Post subject: |
|
|
| 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... |
|
| Back to top |
|
 |
vahju
Joined: 17 Feb 2008 Posts: 296
|
Posted: Thu Dec 11, 2008 3:07 am Post subject: |
|
|
| 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 |
|
| Back to top |
|
 |
evan Guest
|
Posted: Thu Dec 11, 2008 3:24 am Post subject: |
|
|
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 |
|
| Back to top |
|
 |
EricCartman
Joined: 13 Oct 2008 Posts: 60 Location: South Park, Colorado
|
Posted: Thu Dec 11, 2008 3:32 am Post subject: |
|
|
| 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. |
|
| Back to top |
|
 |
Krogdor
Joined: 18 Apr 2008 Posts: 1390 Location: The Interwebs
|
Posted: Thu Dec 11, 2008 3:42 am Post subject: |
|
|
| 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... |
|
|
| Back to top |
|
 |
redd
Joined: 06 Nov 2006 Posts: 39 Location: Sechelt,BC
|
Posted: Thu Dec 11, 2008 7:48 am Post subject: |
|
|
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 |
|
| Back to top |
|
 |
trik
Joined: 15 Jul 2007 Posts: 1320
|
Posted: Thu Dec 11, 2008 1:02 pm Post subject: |
|
|
| 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. >_> |
|
| Back to top |
|
 |
redd
Joined: 06 Nov 2006 Posts: 39 Location: Sechelt,BC
|
Posted: Thu Dec 11, 2008 4:00 pm Post subject: |
|
|
Still error,
myfile.ini ,how do I make this file?
Redd |
|
| Back to top |
|
 |
|
|
You can post new topics in this forum You can reply to topics in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|