WinBatch® Technical Support Forum

All Things WinBatch => WinBatch => Topic started by: George Vagenas on July 15, 2013, 01:39:48 AM

Title: Maybe there's a fix?
Post by: George Vagenas on July 15, 2013, 01:39:48 AM
Took me a while to figure out the problem the StrCat structure is correct.

Code (winbatch) Select

   intcontrol(73, 2, 0, 0, 0)   ; GOSUB error handler.
   Tails = 'Tails'
   Heads = 'Heads'
   fName = strcat(Heads, ' or ', Tails, '.', Ext)
   clipput(fName)

:Cancel
   return


;__________________________________________________________________________________________
:WBERRORHANDLER
   Error = LastError()
   
   if Error==2058    ; StrCat: Function syntax error   
      ; Deal with it.
      fName = Heads : ' or ' : Tails : '.' : Ext
      return
   endif
   
   ErrInfo = strcat('Error: #', Error, ': ', wberrortextstring, @crlf, 'Script: ', wberrorhandlerline, @crlf, 'Assignment: ', wberrorhandlerassignment, @crlf, 'File: ', wberrorhandlerfile, @crlf, 'Procedure: ', wberrorinsegment, @crlf, 'Line No. ', wberrorhandlerlinenumber, @crlf)
   clipput(ErrInfo)
   pause('Error Message on Clipboard', ErrInfo)

   exit

This line
Code (winbatch) Select

fName = Heads : ' or ' : Tails : '.' : Ext

comes up with the right error message.
Title: Re: Maybe there's a fix?
Post by: Deana on July 15, 2013, 08:28:03 AM
Are you suggesting that the StrCat function should return the fatal error 3052: Uninitialized variable or undefined function rather than the moderate error 2058: StrCat function syntax error?
Title: Re: Maybe there's a fix?
Post by: George Vagenas on July 15, 2013, 12:42:00 PM
The fatal error.  If the variables used are not defined in close proximity to the function (which was my situation) then it can take a fair bit of time to figure out why the statement is causing an error.
Title: Re: Maybe there's a fix?
Post by: Deana on July 15, 2013, 01:09:24 PM
The developers have been notified of your request.