Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 672
  • Last Modified:

Can LotusScript detect automatically if the Script Debugger is enabled?

Hi Experts

I have a LotusScript agent which contains an error handler, called by the statement:

On Error goto errorhandler

When using the LotusScript debugger, I don't want to use the error handler, but want the script to stop on the line with the error (so I can check the variables)

When the debugger is disabled, i want the script to use the error handler.

Is there a way for LotusScript to automatically detect if the debugger is enabled?

Thanks
Trevor
0
TRArter
Asked:
TRArter
  • 6
  • 5
  • 3
  • +1
1 Solution
 
marilyngCommented:
Well, could be the $100 question.    

I don't know of a way, other than to set a global Debug = True and then code accordingly:  

if DEBUG then
               On error goto thisPlace
end if

0
 
marilyngCommented:
Oops, If NOT DEBUG then do this..
0
 
TRArterAuthor Commented:
Naturally I did that. I was hoping that it could be FULLY automatic
0
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
Steve KnightIT ConsultancyCommented:
[Wild speculation]
Might be worth a check of notes.ini.

I seem to remember there is a "debugwindowsplit" type entry which presuambly gets recorded when debug starts up.  You could clear that entry from notes.ini at the beginning of your script then if it comes back debug is open (maybe).  Don't know at what point that gets written back to notes.ini

To test ()I haven't got notes here) Clear entry out of notes.ini, take a copy of the file , let debug kick in and fc.exe the two INI files to see if any changes.

As Marilyn's idea, I tend to use a flag of some kind, i.e. a particular notes.ini entry or userrole [Debug] etc. that I can give myself for test purposes like this but of course that isn't automatic on debug entry...

Steve
0
 
marilyngCommented:
Nice try, NoShowDialogDebug=1 or debugwindowsplit don't change when debugger is on or off.  You would think there has to be some flag set somewhere.. interesting to look in ini, though.
0
 
TRArterAuthor Commented:
Yeah. i would think there has to be some flag set somewhere! But where?
0
 
Sjef BosmanGroupware ConsultantCommented:
The reverse is possible, if that might help you: the Stop statement will stop your code in the debugger as a pre-programmed breakpoint.

Also, when using a variable debug, and code like
    If debug Then Stop

You could set, in the debugger, the variable debug to 1 manually, on the commandline at the bottom.
0
 
Sjef BosmanGroupware ConsultantCommented:
Just a hunch: maybe you can do something with GetActiveWindow?
    Declare Function GetActiveWindow Lib "user32.dll" () As Long
    Declare Function GetForegroundWindow Lib "user32" () As Long
    Declare Function GetWindowText Lib "user32" Alias "GetWindowTextA" (Byval hwnd As Long, Byval lpString As String, Byval cch As Long) As Long

    Dim sCurText As String * 255
    Dim i As Integer
    Dim lHwnd As Long
   
    lHwnd = GetForegroundWindow
    i= GetWindowText(lHwnd, Byval sCurText, 255)
    sCurText= Trim(Left$(sCurText, i))

Maybe the name differs when you're in the debugger??
0
 
TRArterAuthor Commented:
Sjef comes up with the goods again!

Setting the DEBUG variable manually in the debugger allows me to turn the error handler on and off without changing the code, which is what I wanted.

I didn't know you could do that. Thanks!

Thanks to the rest of you for your suggestions as well

All the best
Trevor
0
 
Steve KnightIT ConsultancyCommented:
Heh, can you do that?  Must have a play!

Steve
0
 
Sjef BosmanGroupware ConsultantCommented:
> Heh, can you do that?

I'd rather say: is that all you can do?? I think the level of interaction with the debugger is rather poor, compared to the M$ Visual VB/C products. There are even debuggers that allow you to change code "on the fly". And every now and then the debugger causes a crash of the Notes client. For the rest, no complaints.
0
 
Steve KnightIT ConsultancyCommented:
True.  It's not as flakey as the formula language debugger though ;-)
0
 
Sjef BosmanGroupware ConsultantCommented:
Just "flakey"? You're too kind :-))
0
 
TRArterAuthor Commented:
What formula language debugger?
0
 
Sjef BosmanGroupware ConsultantCommented:
The one they scrapped from R5 to R6... :-)
0
 
TRArterAuthor Commented:
I thought that's what you were going to say, but "hope springs eternal in the human breast" (or was it beast?)
0
 
Sjef BosmanGroupware ConsultantCommented:
And they did so for a very good reason: it was a very good idea, but it was buggy as hell!
0

Featured Post

Hire Technology Freelancers with Gigs

Work with freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely, and get projects done right.

  • 6
  • 5
  • 3
  • +1
Tackle projects and never again get stuck behind a technical roadblock.
Join Now