| View previous topic :: View next topic |
| Author |
Message |
chandru155
Joined: 03 Dec 2008 Posts: 158 Location: chennai,india
|
Posted: Fri Dec 12, 2008 6:42 am Post subject: Displaying System usage time for one week |
|
|
| 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 |
|
 |
Dra_Gon
Joined: 25 May 2007 Posts: 373
|
Posted: Fri Dec 12, 2008 5:36 pm Post subject: |
|
|
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 |
|
 |
chandru155
Joined: 03 Dec 2008 Posts: 158 Location: chennai,india
|
Posted: Sat Dec 13, 2008 3:58 am Post subject: Thanks. But one more thing |
|
|
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 |
|
 |
Krogdor
Joined: 18 Apr 2008 Posts: 1390 Location: The Interwebs
|
Posted: Sat Dec 13, 2008 4:30 am Post subject: |
|
|
| 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 |
|
 |
chandru155
Joined: 03 Dec 2008 Posts: 158 Location: chennai,india
|
Posted: Sat Dec 13, 2008 4:53 am Post subject: I know the current up time calculation. |
|
|
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 |
|
 |
Slanter
Joined: 28 May 2008 Posts: 739 Location: Minnesota, USA
|
Posted: Sat Dec 13, 2008 6:08 am Post subject: |
|
|
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 |
|
 |
evan Guest
|
Posted: Sat Dec 13, 2008 8:02 am Post subject: |
|
|
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
|
Posted: Sat Dec 13, 2008 8:22 am Post subject: |
|
|
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
|
Posted: Sat Dec 13, 2008 8:35 am Post subject: Re: Thanks. But one more thing |
|
|
| chandru155 wrote: | | The application i saw doesnt keep any file. |
It would be using the Registry, my best guess. |
|
| Back to top |
|
 |
chandru155
Joined: 03 Dec 2008 Posts: 158 Location: chennai,india
|
Posted: Sat Dec 13, 2008 8:49 am Post subject: Thanks for your reply. |
|
|
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 |
|
 |
BoBo² Guest
|
Posted: Sat Dec 13, 2008 8:56 am Post subject: |
|
|
| 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
|
|
| Back to top |
|
 |
chandru155
Joined: 03 Dec 2008 Posts: 158 Location: chennai,india
|
Posted: Sat Dec 13, 2008 2:14 pm Post subject: |
|
|
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 |
|
 |
|