Page 1 of 1

Stepping out of functions and sub-routines

Posted: Mon Jun 03, 2013 3:03 am
by UnhandledException
Hi, I am new to this forum and new to PrimalScript which I am currently evaluating.

So far it looks like a great tool but I am having a problem when trying to step through VBScript which includes functions or sub-routines.

It's fine stepping into any sub-routine but stepping out or trying to step through back to the calling point doesn't work even if I put a break point in the on the next line of the calling code.

Is this normal for PrimalScript with VBScript or am I missing a trick?

Re: Stepping out of functions and sub-routines

Posted: Mon Jun 03, 2013 3:18 am
by Alexander Riedel
No, this usually works fine. Can you post a code sample or email one to support@sapien.com?
Indicate where you put the breakpoints, step etc.
It just helps to see some actual code when discussing things like that.

Re: Stepping out of functions and sub-routines

Posted: Mon Jun 03, 2013 3:24 am
by Alexander Riedel
VBScript Code
Double-click the code block to select all.
Dim objShell
Set objShell = CreateObject("WScript.Shell")

Sub ShellRun (strCommand)
  objShell.Run strCommand,1,vbTrue
End Sub

ShellRun "NotePad.exe"
WScript.Echo "Notepad has left the building"
Consider this script. Set a breakpoint at the last two lines and hit debug.
It will stop at the line with "Shellrun"
Hit F11 to step into the function
Hit F5 to continue running
Close notepad
The debugger will stop at the last line

Re: Stepping out of functions and sub-routines

Posted: Mon Jun 03, 2013 6:28 am
by UnhandledException
Thanks Alexander, I'll try to post something up a bit later today, first I'll see if I can replicate the problem using your small sample script and if not I'll try to make the smallest script I can which reproduces the problem. It's been a busy day today but I'll get around to it as soon as I can.

Just as a quick thought though, my functions and subs are located at the bottom of my file, below the code which calls them. This seems to work in as much as everything executes nicely but I'm a C++ programmer newly dabbling with VBScript (I've only been using it for two days) so if that's bad practice or would affect PrimalScript then please do feel free to tell me; I'll not be precious about it if anybody can show me a better way, always keen to learn :)


Thanks again.

Tony