Command that open window with buttons YES or NO

English support forum

Moderators: white, Hacker, petermad, Stefan2

Post Reply
liamZ
Junior Member
Junior Member
Posts: 23
Joined: 2014-12-28, 20:04 UTC

Command that open window with buttons YES or NO

Post by *liamZ »

Hi, I've been looking for a build-in command that will open a prompt window with two buttons YES or NO. YES will run the next command and NO will exit.

Is there such thing in TC or is there another way to do it using the mouse? Cause one way to do it is with bat file and keyboard, but I need to use the mouse.

Thanks!!
User avatar
Stefan2
Power Member
Power Member
Posts: 4153
Joined: 2007-09-13, 22:20 UTC
Location: Europa

Post by *Stefan2 »

Try to put a leading '?' question mark as first sign into the parameter box.

Command: xxxx
Parameters: ?yyyyy




If not that, write a VBScript (or others) with MessageBoxes instead of a dos batch.


 
liamZ
Junior Member
Junior Member
Posts: 23
Joined: 2014-12-28, 20:04 UTC

Post by *liamZ »

Thanks, I think I'm gonna try the VBScript method.
User avatar
ZoSTeR
Power Member
Power Member
Posts: 1008
Joined: 2004-07-29, 11:00 UTC

Post by *ZoSTeR »

You could use Nircmd

Code: Select all

nircmd.exe qbox "Do you want to run the calculator ?" "Question:" "calc.exe"
will open a Yes/No dialog and will run the calculator when you press Yes.
liamZ
Junior Member
Junior Member
Posts: 23
Joined: 2014-12-28, 20:04 UTC

Post by *liamZ »

ZoSTeR wrote:You could use Nircmd

Code: Select all

nircmd.exe qbox "Do you want to run the calculator ?" "Question:" "calc.exe"
will open a Yes/No dialog and will run the calculator when you press Yes.
Thanks!! That's a nice option too.

Anyway it would be nice to do it with TC build in commands too.
User avatar
Horst.Epp
Power Member
Power Member
Posts: 6480
Joined: 2003-02-06, 17:36 UTC
Location: Germany

Post by *Horst.Epp »

liamZ wrote:
ZoSTeR wrote:You could use Nircmd

Code: Select all

nircmd.exe qbox "Do you want to run the calculator ?" "Question:" "calc.exe"
will open a Yes/No dialog and will run the calculator when you press Yes.
Thanks!! That's a nice option too.

Anyway it would be nice to do it with TC build in commands too.
Using ? in the parameter field of a command button does this with internal TC.
Enter or OK button starts the command, ESC or Cancel button cancels.
So I don't see any need for any other tool or script.
Windows 11 Home x64 Version 23H2 (OS Build 22631.3447)
TC 11.03 x64 / x86
Everything 1.5.0.1371a (x64), Everything Toolbar 1.3.3, Listary Pro 6.3.0.73
QAP 11.6.3.2 x64
liamZ
Junior Member
Junior Member
Posts: 23
Joined: 2014-12-28, 20:04 UTC

Post by *liamZ »

Horst.Epp wrote:Using ? in the parameter field of a command button does this with internal TC.
Enter or OK button starts the command, ESC or Cancel button cancels.
So I don't see any need for any other tool or script.
You don´t? That's a window to modify the parameters and does not give any information or warning of what the command is going to do. And the most important part of the YES/NO buttons is to know what is goping to happend if you click YES.


Anyway if anyone is interested in the VBscipt method, this works fine:

Code: Select all

@echo off

    call :MsgBox "WARNING INFORMATION"  "VBYesNo" "QUESTION"
    if errorlevel 7 (
        echo NO
    ) else if errorlevel 6 (
        echo YES
    )

PAUSE

exit

:MsgBox prompt type title
    setlocal enableextensions
    set "tempFile=%temp%\%~nx0.%random%%random%%random%vbs.tmp"
    >"%tempFile%" echo(WScript.Quit msgBox("%~1",%~2, "%~3") & cscript //nologo //e:vbscript "%tempFile%"
    set "exitCode=%errorlevel%" & del "%tempFile%" >nul 2>nul
    endlocal & exit /b %exitCode%
User avatar
Horst.Epp
Power Member
Power Member
Posts: 6480
Joined: 2003-02-06, 17:36 UTC
Location: Germany

Post by *Horst.Epp »

liamZ wrote:
Horst.Epp wrote:Using ? in the parameter field of a command button does this with internal TC.
Enter or OK button starts the command, ESC or Cancel button cancels.
So I don't see any need for any other tool or script.
You don´t? That's a window to modify the parameters and does not give any information or warning of what the command is going to do. And the most important part of the YES/NO buttons is to know what is goping to happend if you click YES.


Anyway if anyone is interested in the VBscipt method, this works fine:

Code: Select all

@echo off

    call :MsgBox "WARNING INFORMATION"  "VBYesNo" "QUESTION"
    if errorlevel 7 (
        echo NO
    ) else if errorlevel 6 (
        echo YES
    )

PAUSE

exit

:MsgBox prompt type title
    setlocal enableextensions
    set "tempFile=%temp%\%~nx0.%random%%random%%random%vbs.tmp"
    >"%tempFile%" echo(WScript.Quit msgBox("%~1",%~2, "%~3") & cscript //nologo //e:vbscript "%tempFile%"
    set "exitCode=%errorlevel%" & del "%tempFile%" >nul 2>nul
    endlocal & exit /b %exitCode%
Sorry, but if I press one of my self defined buttons
I know what it will do :D
So you press buttons without knowing what they will do.
Windows 11 Home x64 Version 23H2 (OS Build 22631.3447)
TC 11.03 x64 / x86
Everything 1.5.0.1371a (x64), Everything Toolbar 1.3.3, Listary Pro 6.3.0.73
QAP 11.6.3.2 x64
liamZ
Junior Member
Junior Member
Posts: 23
Joined: 2014-12-28, 20:04 UTC

Post by *liamZ »

Okey...
Post Reply