MSFN Forum: Tiny command line utility msgbox.exe with timeout option - MSFN Forum

Jump to content


Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

Tiny command line utility msgbox.exe with timeout option Rate Topic: -----

#1 User is offline   phan 

  • Group: Members
  • Posts: 9
  • Joined: 22-May 06

Posted 21 March 2007 - 10:44 AM

I searched for such tool but did not find so I wrote myself. Maybe some of you can make use of this tiny tool

Features:
- standard styles (yes/no, ok/cancel, abort/retry,...) and icons
- selectable default button with timeout option
- only 1KB

Download: Attached File  msgbox.cab (1.33K)
Number of downloads: 303


#2 User is offline   ricktendo 

  • Group: Banned Members
  • PipPipPipPipPipPipPipPip
  • Group: Members
  • Posts: 2,230
  • Joined: 06-June 06
  • OS:Windows 7 x64
  • Country: Country Flag

Posted 21 March 2007 - 02:48 PM

Dude this is sweet... might be awesome for my INF uninstallers

#3 User is offline   uid0 

  • Advanced Member
  • PipPipPip
  • Group: Members
  • Posts: 348
  • Joined: 12-June 06

Posted 22 March 2007 - 06:39 AM

I've used wprompt before, but at 5kb it's now looking bloated :lol:

#4 User is offline   phan 

  • Group: Members
  • Posts: 9
  • Joined: 22-May 06

Posted 23 March 2007 - 03:53 AM

oh the old good WBAT :wub: . Just forgotten

#5 User is offline   phan 

  • Group: Members
  • Posts: 9
  • Joined: 22-May 06

Posted 26 March 2007 - 08:00 AM

improved version can display countdown timer like this

Posted Image

download: Attached File  msgbox2.rar (960bytes)
Number of downloads: 321

#6 User is offline   ricktendo 

  • Group: Banned Members
  • PipPipPipPipPipPipPipPip
  • Group: Members
  • Posts: 2,230
  • Joined: 06-June 06
  • OS:Windows 7 x64
  • Country: Country Flag

Posted 26 March 2007 - 08:38 AM

OK I got the message boxes but n00b question:

How do i use the choices? meaning when i select OK or Cancell how do I use the number to go to a choice?

#7 User is offline   phan 

  • Group: Members
  • Posts: 9
  • Joined: 22-May 06

Posted 26 March 2007 - 08:58 AM

use errorlevel, for example:
 msgbox "Setup will continue in %%d seconds." "Setup" 65 15
			  if errorlevel 2 goto :cancel
			
			rem *** put your stuff here in case the user clicks on OK or timed out ***
			
			:cancel


Here are the errorlevels returned:

0 Timed out
1 OK
2 Cancel
3 Abort
4 Retry
5 Ignore
6 Yes
7 No

You can also use %ERRORLEVEL% as environment variable, i.e.

if "%ERRORLEVEL%"=="5" goto :ignore
if "%ERRORLEVEL%"=="4" goto :retry
if "%ERRORLEVEL%"=="3" goto :abort

This post has been edited by phan: 26 March 2007 - 09:06 AM


#8 User is offline   rajesh.kumar 

  • Crank up
  • PipPipPip
  • Group: Members
  • Posts: 340
  • Joined: 02-July 05

Posted 27 March 2007 - 08:29 AM

:yes: wonderful my friend. thank u very much. ive been looking for this kind of app to execute cmds based on the user interest. u have fulfilled my interest. :thumbup
Youve just got my 200th post. :whistle:

This post has been edited by rajesh.kumar: 27 March 2007 - 08:31 AM


#9 User is offline   uid0 

  • Advanced Member
  • PipPipPip
  • Group: Members
  • Posts: 348
  • Joined: 12-June 06

Posted 27 March 2007 - 08:56 AM

Quality :thumbup

#10 User is offline   phan 

  • Group: Members
  • Posts: 9
  • Joined: 22-May 06

Posted 28 March 2007 - 01:33 AM

thank u all :wub:
@rajesh: I'll wait for ur 999th post :rolleyes:
btw, note on the double percent sign %%d above: this is because calling in cmd-file. If you run msgbox from other program, use only one percent sign %d (like printf())
And the number 65 in the example above is sum of 1+64 (OK Cancel + Information Icon). You may combine following box styles:

Buttons:
0 OK
1 OK Cancel
2 Abort, Retry, Ignore
3 Yes, No, Cancel
4 Yes, No
5 Retry, Cancel

Icon:
16 Error
32 Question
48 Exclamation
64 Information

Default button:
256 make 2nd button default
512 make 3rd button default

#11 User is offline   rajesh.kumar 

  • Crank up
  • PipPipPip
  • Group: Members
  • Posts: 340
  • Joined: 02-July 05

Posted 21 July 2007 - 05:39 AM

is there a way to modify the caption of buttons like OK, Cancel etc

#12 User is offline   uid0 

  • Advanced Member
  • PipPipPip
  • Group: Members
  • Posts: 348
  • Joined: 12-June 06

Posted 22 July 2007 - 10:11 AM

View Postphan, on Mar 28 2007, 08:33 AM, said:

Buttons:
0 OK
1 OK Cancel
2 Abort, Retry, Ignore
3 Yes, No, Cancel
4 Yes, No
5 Retry, Cancel


The first param is the messagebox text, the second is the window title, third is the sum of the buttons + icon + default, fourth is the timeout in seconds.

#13 User is offline   asgeirk 

  • Group: Members
  • Posts: 1
  • Joined: 21-September 07

Posted 21 September 2007 - 04:47 AM

Could you add a switch to always return errorlevel 0. I would like to use msgbox.exe as a program in MS SMS, and errorlevel <> 0 cause a stop.

thanx for an excellent program

#14 User is offline   Aake 

  • Group: Members
  • Posts: 1
  • Joined: 08-July 09

Posted 08 July 2009 - 08:36 AM

Msgbox.exe - virus alert ???

My Avira Personal Antivirus send alarm when unpacking msgbox.cab


True virus ???

#15 User is offline   uid0 

  • Advanced Member
  • PipPipPip
  • Group: Members
  • Posts: 348
  • Joined: 12-June 06

Posted 08 July 2009 - 10:20 AM

msgbox.cmd contains the text "format c:" - try changing that to something else and scan the extracted files again?
virustotal.com seems busy at the moment.

#16 User is offline   Yatch 

  • Group: Members
  • Posts: 1
  • Joined: 12-September 09

Posted 12 September 2009 - 03:03 PM

Sintaxis

for print time add "in %%d"
If you run msgbox from other program, use only one percent sign %d (like printf())

"<Message>" "<Title>" "<Flag #1-5>" "<seconds>"

for non timeout use in seconds "0"

Flags:
You may combine following box styles:

0 = OK
1 = OK + Cancel
2 = Abort + Retry + Igonore
3 = Yes + No + Cancel
4 = Yes + No
5 = Retry + Cancel
6 = Cancel + Retry + Continue
Icon:
16 Error
32 Question
48 Exclamation
64 Information


Here are the errorlevels returned:

0 Timed out
1 OK
2 Cancel
3 Abort
4 Retry
5 Ignore
6 Yes
7 No
11 Continue

You can also use %ERRORLEVEL% as environment variable, i.e.

if "%ERRORLEVEL%"=="5" goto :ignore
if "%ERRORLEVEL%"=="4" goto :retry
if "%ERRORLEVEL%"=="3" goto :abort

#17 User is offline   war59312 

  • Will's Blog
  • PipPipPipPipPip
  • Group: Members
  • Posts: 932
  • Joined: 07-June 02

Posted 14 June 2011 - 04:44 AM

Anyone got something like this that works on Win7 x64?

#18 User is offline   trucknut1999 

  • Group: Members
  • Posts: 1
  • Joined: 25-January 12
  • OS:none specified
  • Country: Country Flag

Posted 27 January 2012 - 10:53 PM

View Postwar59312, on 14 June 2011 - 04:44 AM, said:

Anyone got something like this that works on Win7 x64?


Here's a simple one line command that can be used inside a batch file. No problems with Win7 x64.

echo msgbox"my important message",64,"Some Import Title"> a.vbs & cscript a.vbs //T:5 & del a.vbs


Set your timeout by changing the //T:5 value

Coding References:
MsgBox: http://www.w3schools...func_msgbox.asp

CScript: http://www.microsoft...w.mspx?mfr=true

Share this topic:


Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

2 User(s) are reading this topic
0 members, 2 guests, 0 anonymous users



All trademarks mentioned on this page are the property of their respective owners
Copyright © 2001 - 2013 msfn.org
Privacy Policy