AutoHotkey Community

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

All times are UTC [ DST ]




Post new topic Reply to topic  [ 13 posts ] 
Author Message
PostPosted: December 12th, 2008, 7:42 am 
Offline

Joined: December 3rd, 2008, 5:37 am
Posts: 158
Location: chennai,india
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?


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: December 12th, 2008, 6:36 pm 
Offline

Joined: May 25th, 2007, 6:13 pm
Posts: 373
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

_________________
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  
PostPosted: December 13th, 2008, 4:58 am 
Offline

Joined: December 3rd, 2008, 5:37 am
Posts: 158
Location: chennai,india
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.


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: December 13th, 2008, 5:30 am 
Offline

Joined: April 18th, 2008, 7:57 am
Posts: 1390
Location: The Interwebs
AFAIK, the OS only keeps track of how long the computer has been on since it was booted, not any sort of total uptime.


Report this post
Top
 Profile  
Reply with quote  
PostPosted: December 13th, 2008, 5:53 am 
Offline

Joined: December 3rd, 2008, 5:37 am
Posts: 158
Location: chennai,india
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:-)


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

Joined: May 28th, 2008, 2:11 am
Posts: 739
Location: Minnesota, USA
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.


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: December 13th, 2008, 9:02 am 
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)


Report this post
Top
  
Reply with quote  
 Post subject:
PostPosted: December 13th, 2008, 9:22 am 
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


Report this post
Top
  
Reply with quote  
PostPosted: December 13th, 2008, 9:35 am 
Offline
User avatar

Joined: December 26th, 2005, 4:40 pm
Posts: 8776
chandru155 wrote:
The application i saw doesnt keep any file.

It would be using the Registry, my best guess.


Report this post
Top
 Profile  
Reply with quote  
 Post subject: Thanks for your reply.
PostPosted: December 13th, 2008, 9:49 am 
Offline

Joined: December 3rd, 2008, 5:37 am
Posts: 158
Location: chennai,india
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?


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: December 13th, 2008, 9:56 am 
Whatfore you need that information (especially why you need to detect that already passed period)?


Report this post
Top
  
Reply with quote  
 Post subject:
PostPosted: December 13th, 2008, 1:55 pm 
Offline
User avatar

Joined: December 26th, 2005, 4:40 pm
Posts: 8776
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
StartEx - Portable Shortcut Link


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: December 13th, 2008, 3:14 pm 
Offline

Joined: December 3rd, 2008, 5:37 am
Posts: 158
Location: chennai,india
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:)


Report this post
Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 13 posts ] 

All times are UTC [ DST ]


Who is online

Users browsing this forum: Bing [Bot], Google [Bot], patgenn123, poserpro, Yahoo [Bot] and 15 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