PDA

View Full Version : Return value of InputBox


garyb@se.rr.com
09-27-2012, 05:30 PM
I am curious... if you present an inputbox in a vbscript to the user, how do you determine if the Cancel button of the inputbox was clicked?

I would like to abort the build process if the Cancel button is clicked on the inputbox.

Perhaps there is a better method?

dim sTemp
dim objMacro

sTemp = InputBox("Do you want to transmit ActiveX32 to the FTP site?","Transmit File","NO")
Set objMacro = vbld_TempMacros.Add("FTPActivex", sTemp)


Any help is appreciated.

kinook
09-27-2012, 09:52 PM
I would probably use the Shell Popup method for that, or check for an empty string returned from InputBox. See the Prompt.bld sample.
http://kinook.com/VisBuildPro/Manual/promptsample.htm

garyb@se.rr.com
09-28-2012, 07:49 AM
I would probably use the Shell Popup method for that, or check for an empty string returned from InputBox. See the Prompt.bld sample.
http://kinook.com/VisBuildPro/Manual/promptsample.htm

Thank you for the info. I looked through the recommended sample project however it does not tell me if the inputbox cancel button was clicked and that is what I am trying to determine.

I already define a default value for the inputbox, so the script can deal with yes or no answers, but if the cancel is clicked I want to abort the project build. Is this possible?

kinook
09-28-2012, 07:53 AM
It will return an empty string if canceled.
http://www.w3schools.com/vbscript/func_inputbox.asp

To fail the build from script code, use Step.BuildStatus = vbldStepStatFailed

garyb@se.rr.com
09-28-2012, 10:28 AM
It will return an empty string if canceled.
http://www.w3schools.com/vbscript/func_inputbox.asp

To fail the build from script code, use Step.BuildStatus = vbldStepStatFailed

Got it! That worked... Thank you. :D