WinBatch® Technical Support Forum

All Things WinBatch => WinBatch => Topic started by: mueer01 on February 06, 2024, 11:03:50 PM

Title: AskLine()
Post by: mueer01 on February 06, 2024, 11:03:50 PM
Hello,

The "Cancel" button from the function AskLine() quits the program.
Is it possible to get a @FALSE, @CANCEL or '' returned, instead?

Regards,
Erhard
Title: Re: AskLine()
Post by: td on February 07, 2024, 06:55:23 AM
You don't need a different function return value, but you do need to place a cancel label in your script. You can learn more about cancel handling by reading the following WIL Help page:

https://docs.winbatch.com/mergedProjects/WindowsInterfaceLanguage/html/HTMLWIL_RFC001.htm
Title: Re: AskLine()
Post by: mueer01 on February 07, 2024, 07:12:51 AM
YEPP! That's it. Many thanks.
Title: Re: AskLine()
Post by: snowsnowsnow on April 08, 2024, 12:17:41 PM
Or you can use this function, which I wrote years ago and find very useful:


#DefineSubroutine udsTry(expr,errstr,cancelstr)
IntControl(73,1,1,0,0)
Return %expr%
:wberrorhandler
Return errstr
:cancel
Return cancelstr
#EndSubroutine