Home Upgrade Search Memberlist Extras Hacker Tools Award Goals Help Wiki Contact

Shell 

Would this be possible? User set timer, close, open at timer end

I want to make a script that will, on startup, open a web page. After/during that is opening, I want the user to enter a number which will be converted to whatever time unit batch uses and start a timer. Can they then close that window and have the timer still run? I would like for at the end of the timer for it to open another window and then end itself.

Thank you
01000101
(Dec 18, 2015 04:21 PM)Elite Hacker 69 Wrote:  I want to make a script that will, on startup, open a web page. After/during that is opening, I want the user to enter a number which will be converted to whatever time unit batch uses and start a timer. Can they then close that window and have the timer still run? I would like for at the end of the timer for it to open another window and then end itself.

Thank you



This is possible. I don't know what window you want to open so I just have it re-opening cmd

Code
@echo off
start www.google.com
call :InputBox "Enter a time to wait" "Time"
echo CreateObject^("Wscript.Shell"^).Run """" ^& WScript.Arguments^(0^) ^& """", 0, False > invisible.vbs
(
echo @echo off
echo timeout /t %input%
echo start
echo exit
) >timer.bat
start invisible.vbs timer.bat
exit


REM Input routine for batch using VBScript to provide input box
REM Stephen Knight, October 2009, http://www.dragon-it.co.uk/
:InputBox
set input=
set heading=%~2
set message=%~1
echo wscript.echo inputbox(WScript.Arguments(0),WScript.Arguments(1)) >"%temp%\input.vbs"
for /f "tokens=* delims=" %%a in ('cscript //nologo "%temp%\input.vbs" "%message%" "%heading%"') do set input=%%a
exit /b
There's no place like ~/
(Dec 18, 2015 05:06 PM)b00st3d Wrote:  This is possible. I don't know what window you want to open so I just have it re-opening cmd

Code
@echo off
start www.google.com
call :InputBox "Enter a time to wait" "Time"
echo CreateObject^("Wscript.Shell"^).Run """" ^& WScript.Arguments^(0^) ^& """", 0, False > invisible.vbs
(
echo @echo off
echo timeout /t %input%
echo start
echo exit
) >timer.bat
start invisible.vbs timer.bat
exit


REM Input routine for batch using VBScript to provide input box
REM Stephen Knight, October 2009, http://www.dragon-it.co.uk/
:InputBox
set input=
set heading=%~2
set message=%~1
echo wscript.echo inputbox(WScript.Arguments(0),WScript.Arguments(1)) >"%temp%\input.vbs"
for /f "tokens=* delims=" %%a in ('cscript //nologo "%temp%\input.vbs" "%message%" "%heading%"') do set input=%%a
exit /b

batch can do this without the vbscript in it
Code
@echo off
set /p time=Enter how long you want the window open:
:main
    set ctime=%time%
    start yourwebsite.com
    call :time
goto main

:time
    timeout /t 1>nul
    set ctime-=1
    if %ctime%==0 (
        taskkill /IM yourbrowser.exe
        goto :eof
    )
goto time
(Dec 24, 2015 02:37 PM)Nakamoto. Wrote:  batch can do this without the vbscript in it
agreed the vbscript in my example just made it fancy and run invisible.
There's no place like ~/


Possibly Related Threads...
Thread / Author Replies Views Last Post
by NobleJul 17, 2024 08:13 AM 4 182 Jul 17, 2024 08:13 AM
Last Post: ShadowCipher
[Shell] by samir50Sep 24, 2018 12:33 PM 3 262 Sep 24, 2018 12:33 PM
Last Post: ɩᴄᴀʀᴜȿ ᴌוᴠᴇѕ™
[.NET] by ·Evolved·Apr 25, 2016 08:25 AM 7 301 Apr 25, 2016 08:25 AM
Last Post: ·Evolved·