Can't find the information you are looking for here? Then leave a message over on our WinBatch Tech Support Forum.
Keywords: interactive debug debugging winbatch studio mode gosub
Main.wbt: #include Subs_And_Funcs.wbt Message("Func returned",Func()) GoSub Sub Message("Subroutine returned",val) exit Subs_And_Funcs.wbt: goto Define_Functions :Sub val = "Subroutine called" return :Define_Functions #DefineFunction Func() return "Function called" #EndFunction
How can I debug this code?
In summary, If you want to debug a script that has a #Include statement and it attempts a gosub into the included file, you should use the DebugTrace function instead. I have included an example that should help:
Make sure to choose the 'RUN' option, to run the following script from WinBatch studio:
;Main.WBT dbg = @ON ; to turn of debug set to @OFF If dbg = @ON then DebugTrace(@On,"C:\trace.txt") #include Subs_And_Funcs.wbt Message("Func returned",Func()) GoSub Sub Message("Subroutine returned",val) Exit ;Subs_And_Funcs.wbt If dbg = @ON then DebugTrace(@On,"C:\trace.txt") goto Define_Functions :Sub val = "Subroutine called" return :Define_Functions #DefineFunction Func() If dbg = @ON then DebugTrace(@On,"C:\trace.txt") return "Function called" #EndFunction
Article ID: W15349
File Created: 2002:09:05:13:51:26
Last Updated: 2002:09:05:13:51:26