Windows start time and shoot down time Topic is solved

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
Pilu
Posts: 84
Joined: 22 Jun 2018, 01:13

Windows start time and shoot down time

17 Jan 2020, 08:02

Hi,

I would like reporting when start the windows and when shoot down the windows and would like to write in one excel these datas day by day.
Can somebody help me?
User avatar
telanx
Posts: 68
Joined: 10 Jan 2020, 14:31

Re: Windows start time and shoot down time

17 Jan 2020, 10:01

ahk is not good at this, use the startup and shutdown script.
Two written before, Both are vbs scripts.

1. startup script, Put in the startup folder of the start menu.

Code: Select all

Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objFile = objFSO.OpenTextFile ("c:\StartupShutdownTime.ini", 8, True)
objFile.WriteLine ("startupTime:" & date() & " " & time())
objFile.Close
2. Shutdown script, Use it manually, or by command or something.

Code: Select all

Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objFile = objFSO.OpenTextFile ("c:\StartupShutdownTime.ini", 8, True)
objFile.WriteLine ("ShutdownTime:" & date() & " " & time())
objFile.Close
CreateObject("WScript.Shell").Run "shutdown /s /t 60"
aifritz
Posts: 301
Joined: 29 Jul 2018, 11:30
Location: Germany

Re: Windows start time and shoot down time  Topic is solved

17 Jan 2020, 11:55

You could give ahk a chance with this script ;)

Code: Select all

#Persistent
Global LogStartExit := A_ScriptDir "\LogStartExit.txt"
;When starting
FormatTime, TimeStamp, %LongDate%, dd.MM.yyyy, HH:mm:ss
FileAppend, %TimeStamp%: StartTime`r`n, %LogStartExit%
OnExit("MyExit") ;When exit or shutdown
return

MyExit(Reason) {
  FormatTime, TimeStamp, %LongDate%, dd.MM.yyyy, HH:mm:ss
  FileAppend, %TimeStamp%: %Reason%`r`n, %LogStartExit%
}

F10::ExitApp

Return to “Ask for Help (v1)”

Who is online

Users browsing this forum: Google [Bot], Hansielein, Lpanatt and 315 guests