AutoHotkey Homepage AutoHotkey Community
Let's help each other out
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Displaying System usage time for one week

 
Reply to topic    AutoHotkey Community Forum Index -> Ask for Help
View previous topic :: View next topic  
Author Message
chandru155



Joined: 03 Dec 2008
Posts: 158
Location: chennai,india

PostPosted: Fri Dec 12, 2008 6:42 am    Post subject: Displaying System usage time for one week Reply with quote

I saw one application which will display the running system time(ie if system is ON yesterday from 4to6pm and turned OFF then again today ON 5to7means it ll display this time as system running time) Can we make a script which will do the same thing?
Back to top
View user's profile Send private message Yahoo Messenger
Dra_Gon



Joined: 25 May 2007
Posts: 373

PostPosted: Fri Dec 12, 2008 5:36 pm    Post subject: Reply with quote

Sure, you can have an INI file keep track of each day's time as well as a total. Take a look at "EnvAdd" in the Docs. That should get ya started.

Ciao,
Dra'Gon
_________________

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

My WritersCafe profile>>
http://www.writerscafe.org/writers/BlueDragonFire/
Back to top
View user's profile Send private message Send e-mail
chandru155



Joined: 03 Dec 2008
Posts: 158
Location: chennai,india

PostPosted: Sat Dec 13, 2008 3:58 am    Post subject: Thanks. But one more thing Reply with quote

The application i saw doesnt keep any file. If we run, it ll show the timings. Without keeping a file to track timing, can we do it?can we do is by reading any dll or from anything in os that keep track of this?

Incase if i want to run on a fresh system, how could i get the timing? So, i have to get the timing without using that ini file:-) if i run, it should give timing details by reading any os files or os dll.
Back to top
View user's profile Send private message Yahoo Messenger
Krogdor



Joined: 18 Apr 2008
Posts: 1390
Location: The Interwebs

PostPosted: Sat Dec 13, 2008 4:30 am    Post subject: Reply with quote

AFAIK, the OS only keeps track of how long the computer has been on since it was booted, not any sort of total uptime.
Back to top
View user's profile Send private message AIM Address
chandru155



Joined: 03 Dec 2008
Posts: 158
Location: chennai,india

PostPosted: Sat Dec 13, 2008 4:53 am    Post subject: I know the current up time calculation. Reply with quote

But, how can i get the past up time of a system. ie if i worked the system yesterday from 5to8pm and today 7to6 means, it should display both this timing when i run now without using ini. It should only with the use of built in ahk variale or using os.

Ie, we should keep the track of system current and past up times. It should tell automatically. Hope you have understand that what i am trying to say:-)
Back to top
View user's profile Send private message Yahoo Messenger
Slanter



Joined: 28 May 2008
Posts: 739
Location: Minnesota, USA

PostPosted: Sat Dec 13, 2008 6:08 am    Post subject: Reply with quote

We know what you're saying, the thing is, the system doesn't store that data by itself and AHK doesn't have variables that last between sessions. You need to either use an ini file, or store the information in some environmental variables.
_________________
Unless otherwise stated, all code is untested

(\__/) This is Bunny.
(='.'=) Cut, copy, and paste bunny onto your sig.
(")_(") Help Bunny gain World Domination.
Back to top
View user's profile Send private message Visit poster's website
evan
Guest





PostPosted: Sat Dec 13, 2008 8:02 am    Post subject: Reply with quote

i have no idea why u are so against using ini file to store the time, but here is a solution u might be interested

write a script that will append up-time back to the Script.ahk
and put the script in startup folder

well u may ask whats the difference between using an ini file and this
obviously, this does not require extra file, but need to be in script form (cant be exe)
Back to top
evan
Guest





PostPosted: Sat Dec 13, 2008 8:22 am    Post subject: Reply with quote

example:
Code:
#Persistent
FormatTime, TimeString, ,  MMMM d,  hh:mm:ss
FileAppend, `;--- Computer Starts --- `n`;%TimeString%`n, %A_ScriptFullPath%
settimer, aa, 1000

aa:
FormatTime, TimeString, ,  MMMM d,  hh:mm:ss
FileAppend, `;%TimeString%`n, %A_ScriptFullPath%
return
Back to top
SKAN



Joined: 26 Dec 2005
Posts: 8688

PostPosted: Sat Dec 13, 2008 8:35 am    Post subject: Re: Thanks. But one more thing Reply with quote

chandru155 wrote:
The application i saw doesnt keep any file.

It would be using the Registry, my best guess.
Back to top
View user's profile Send private message Send e-mail
chandru155



Joined: 03 Dec 2008
Posts: 158
Location: chennai,india

PostPosted: Sat Dec 13, 2008 8:49 am    Post subject: Thanks for your reply. Reply with quote

Thanks for your code. I ll use your code. Why i am not interested to use ini or file storage is, this wont work for a fresh system. It ll tell only if we run that script in past.

Instead of updating the file for every interval, can we use OnMessage function to know the system shutdown status and write the file for once? I want to do one action before system is going to shutdown. Is it possible to do it?
Back to top
View user's profile Send private message Yahoo Messenger
BoBo²
Guest





PostPosted: Sat Dec 13, 2008 8:56 am    Post subject: Reply with quote

Whatfore you need that information (especially why you need to detect that already passed period)?
Back to top
SKAN



Joined: 26 Dec 2005
Posts: 8688

PostPosted: Sat Dec 13, 2008 12:55 pm    Post subject: Reply with quote

Uptime.exe Tool Allows You to Estimate Server Availability with Windows NT 4.0 SP4 or Higher

from command line, Uptime /p:10 gives me boot/shutdown/uptime details for past 10 days. Will some string manipulation skills, the result can be worked out.

PS: I tried in XP SP2, standalone computer
_________________
URLGet - Internet Explorer based Downloader
Back to top
View user's profile Send private message Send e-mail
chandru155



Joined: 03 Dec 2008
Posts: 158
Location: chennai,india

PostPosted: Sat Dec 13, 2008 2:14 pm    Post subject: Reply with quote

This is for my final year project SKAN. I am developing one speech recognition SERVER-CLIENT control program. For this,the client should inform to the server that it is going to shutdown, so that the server will safely remove client from its list.

@BOBO
If client doesnt tell to server means, there will be exception occur on server and the program wont work. For this i want to know information that client system is going to shutdown, so the client will inform to server and program will continue safely:)
Back to top
View user's profile Send private message Yahoo Messenger
Display posts from previous:   
Reply to topic    AutoHotkey Community Forum Index -> Ask for Help All times are GMT
Page 1 of 1

 
Jump to:  
You can post new topics in this forum
You can reply to topics in this forum


Powered by phpBB © 2001, 2005 phpBB Group