I'm trying to debug a script. I'm repeatively getting stuck at the same page of an application.
I want to skip the first steps, and test from the point the script is getting stuck. I have tried stepping through the code in the editor but that does not seem to work as the application is in the background (as i'm in the editor) I cant get the debug to see the application in debug mode.
Debug from middle of Script
Moderators: Dorian (MJT support), JRL, Phil Pendlebury
- Dorian (MJT support)
- Automation Wizard
- Posts: 1389
- Joined: Sun Nov 03, 2002 3:19 am
- Contact:
Re: Debug from middle of Script
You could try the Refocus Windows option (>Debug >Refocus Windows / ALT-df) but there's no guarantee that this can cope mid-keystroke.
You could put a breakpoint after your first section of code. >Debug >Insert BreakPoint / ALT-di
Maybe also put a SetFocus after the breakpoint to ensure the correct window gets the focus. You can then run to breakpoint over that block of code, and then step through the bits that need more detailed examination.
This mentions the conundrum and some workarounds:
http://www.mjtnet.com/blog/2009/05/19/m ... debugging/
Another option is to turn on logging. You can even log all the variable, although this will result in a huge logfile.
Let>_DUMP_VARS=1
Let>_DUMP_VARS=0
You could put a breakpoint after your first section of code. >Debug >Insert BreakPoint / ALT-di
Maybe also put a SetFocus after the breakpoint to ensure the correct window gets the focus. You can then run to breakpoint over that block of code, and then step through the bits that need more detailed examination.
This mentions the conundrum and some workarounds:
http://www.mjtnet.com/blog/2009/05/19/m ... debugging/
Another option is to turn on logging. You can even log all the variable, although this will result in a huge logfile.
Let>_DUMP_VARS=1
Let>_DUMP_VARS=0
Yes, we have a Custom Scripting Service. Message me or go here
Re: Debug from middle of Script
Thanks for the tips.
I ended up doing the following.
Simply commenting out the first few subroutines that I know work so the subroutine I'm testing is executed first.
Putting a wait in the script before the critical step so I could place the application in the state before the failing step. I did have to temporarily manually define some variables that would normally be captured in previous subroutines.
Using messagemodal to display the value of variables that had been captured/used. This does two things allows me to pause the script so I can stop going down a path I don't want and of course confirms if the script is capturing the variable as expected.
I ended up doing the following.
Simply commenting out the first few subroutines that I know work so the subroutine I'm testing is executed first.
Putting a wait in the script before the critical step so I could place the application in the state before the failing step. I did have to temporarily manually define some variables that would normally be captured in previous subroutines.
Using messagemodal to display the value of variables that had been captured/used. This does two things allows me to pause the script so I can stop going down a path I don't want and of course confirms if the script is capturing the variable as expected.
- Dorian (MJT support)
- Automation Wizard
- Posts: 1389
- Joined: Sun Nov 03, 2002 3:19 am
- Contact:
Re: Debug from middle of Script
I employ both those methods very frequently.
Yes, we have a Custom Scripting Service. Message me or go here