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.
This topic is 10 years and 9 months old and has exceeded the time allowed for comments. Please begin a new topic or use the search feature to find a similar but newer topic.
Locked
User avatar
UnhandledException
Posts: 2
Last visit: Sat Jun 29, 2013 2:00 am

Stepping out of functions and sub-routines

Post 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?
User avatar
Alexander Riedel
Posts: 8478
Last visit: Tue Mar 26, 2024 8:52 am
Answers: 19
Been upvoted: 37 times

Re: Stepping out of functions and sub-routines

Post 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.
Alexander Riedel
SAPIEN Technologies, Inc.
User avatar
Alexander Riedel
Posts: 8478
Last visit: Tue Mar 26, 2024 8:52 am
Answers: 19
Been upvoted: 37 times

Re: Stepping out of functions and sub-routines

Post 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
Alexander Riedel
SAPIEN Technologies, Inc.
User avatar
UnhandledException
Posts: 2
Last visit: Sat Jun 29, 2013 2:00 am

Re: Stepping out of functions and sub-routines

Post 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
This topic is 10 years and 9 months old and has exceeded the time allowed for comments. Please begin a new topic or use the search feature to find a similar but newer topic.
Locked