Mimic Windows' TIMEOUT.EXE command

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
alienpengy
Posts: 4
Joined: 12 Nov 2017, 14:45

Mimic Windows' TIMEOUT.EXE command

12 Nov 2017, 14:51

Hello. I have been struggling on trying to figure out how to mimic Windows' TIMEOUT.EXE command. It's basically pause, but with a timer. You can either wait the specified number of seconds, or press any key to just continue on.

The reason I need this is because I'm trying to get this to work in Windows XP, which doesn't have the TIMEOUT command. Even when copying %windir%\system32\TIMEOUT.EXE to an XP computer, it complains about the exe not being a vaild Win32 executable.

Any help is appreciated.
BoBo
Posts: 6564
Joined: 13 May 2014, 17:15

Re: Mimic Windows' TIMEOUT.EXE command

12 Nov 2017, 16:20

Just for the records ...
https://ss64.com/nt/timeout.html

I'd guess using a SetTimer-routine that ends itself once a key/button has been pressed should do the trick, right?
alienpengy
Posts: 4
Joined: 12 Nov 2017, 14:45

Re: Mimic Windows' TIMEOUT.EXE command

12 Nov 2017, 17:04

im sorry, im a complete n00b at this, could you help me please?
alienpengy
Posts: 4
Joined: 12 Nov 2017, 14:45

Re: Mimic Windows' TIMEOUT.EXE command

13 Feb 2018, 13:12

bump

im not asking for someone to write the script for me, i just need some assistance. im only used to writing batch scripts, ahk is a new animal for me.

thanks
Guest

Re: Mimic Windows' TIMEOUT.EXE command

13 Feb 2018, 14:00

its possible to have timeout.exe (from win 7) run on xp, but it shows no output. maybe use ping, example https://stackoverflow.com/questions/735 ... tch-script
User avatar
noname
Posts: 515
Joined: 19 Nov 2013, 09:15

Re: Mimic Windows' TIMEOUT.EXE command

14 Feb 2018, 05:54

Here is some basic code for timeout , you can always compile ahk code to exe .

To run this code as ahk file where 1220 is the sleeptime in ms, any key pressed will exit the program :

Code: Select all

run, timeout.ahk 1220
timeout code:

Code: Select all

Loop, %0%  ; For each parameter:
{
param := %A_Index%  
break
}

Loop, 5000 ; any key will exit program
{
  Hotkey, % "~*" GetKeyName(Format("vk{:x}", a_index - 1)), key_d
  Hotkey, % "~*" GetKeyName(Format("sc{:x}", a_index - 1)), key_d
}

    t:=a_tickcount  ; for testing

sleep % param

    msgbox % " slept " a_tickcount-t "ms"  ; for testing
    
exitapp


key_d:
soundbeep
exitapp
alienpengy
Posts: 4
Joined: 12 Nov 2017, 14:45

Re: Mimic Windows' TIMEOUT.EXE command

14 Feb 2018, 13:29

hey thanks noname! that script works pretty well!

~nyan~

Return to “Ask for Help (v1)”

Who is online

Users browsing this forum: Descolada, roeleboele, Rohwedder, ulysim and 389 guests