Kinook Software Forum

Kinook Software Forum (https://www.kinook.com/Forum/index.php)
-   [VBP] General Discussion (https://www.kinook.com/Forum/forumdisplay.php?f=2)
-   -   Return value of InputBox (https://www.kinook.com/Forum/showthread.php?t=5083)

garyb@se.rr.com 09-27-2012 05:30 PM

Return value of InputBox
 
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

Quote:

Originally Posted by kinook (Post 19926)
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

Quote:

Originally Posted by kinook (Post 19928)
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


All times are GMT -5. The time now is 09:11 PM.


Copyright © 1999-2023 Kinook Software, Inc.