WinBatch® Technical Support Forum

All Things WinBatch => WinBatch => Topic started by: George Vagenas on July 10, 2014, 06:09:50 PM

Title: Pause() not cancelling
Post by: George Vagenas on July 10, 2014, 06:09:50 PM
I was modifying "FileMenu for all filetypes.mnw" and in the initialization code I inserted a
Code (winbatch) Select
pause(`DEBUG PAUSE`, strCat(`fDir = `, fDir))   ;***DEBUG LINE*** line for testing.  Regardless of which button I click the menu code executes anyway, which is not the expected behavior for the Pause message.
I then inserted the same line at the start of the menu item which I had selected in Explorer and it processed as expected, cancelling or continuing, depending on which button was clicked or cancelling if the Escape key was pressed.
Title: Re: Pause() not cancelling
Post by: td on July 10, 2014, 08:33:59 PM
Menu files do not work that way.  They are not processed linearly like script files are processed by WinBatch.  When you press Cancel from a prompt in the initialization (autoexec) section, it short circuits  the rest of the initialization section but it does not short circuit the menu section.  This is because the two sections are processed in separate steps.