Stepping out of functions and sub-routines

Anything VBScript-related, including Windows Script Host, WMI, ADSI, and more.
Forum rules
Do not post any licensing information in this forum.

Any code longer than three lines should be added as code using the 'Select Code' dropdown menu or attached as a file.
Locked
User avatar
UnhandledException
Posts: 2
Joined: Mon Jun 03, 2013 2:10 am

Stepping out of functions and sub-routines

Post by UnhandledException » Mon Jun 03, 2013 3:03 am

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?

User avatar
Alexander Riedel
Posts: 6862
Joined: Tue May 29, 2007 4:43 pm

Re: Stepping out of functions and sub-routines

Post by Alexander Riedel » Mon Jun 03, 2013 3:18 am

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.
Alexander Riedel
SAPIEN Technologies, Inc.

User avatar
Alexander Riedel
Posts: 6862
Joined: Tue May 29, 2007 4:43 pm

Re: Stepping out of functions and sub-routines

Post by Alexander Riedel » Mon Jun 03, 2013 3:24 am

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
Alexander Riedel
SAPIEN Technologies, Inc.

User avatar
UnhandledException
Posts: 2
Joined: Mon Jun 03, 2013 2:10 am

Re: Stepping out of functions and sub-routines

Post by UnhandledException » Mon Jun 03, 2013 6:28 am

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

Locked