Solved

Can LotusScript detect automatically if the Script Debugger is enabled?

Posted on 2006-06-21
17
653 Views
Last Modified: 2013-12-18
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
Comment
Question by:TRArter
  • 6
  • 5
  • 3
  • +1
17 Comments
 
LVL 18

Expert Comment

by:marilyng
Comment Utility
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
 
LVL 18

Expert Comment

by:marilyng
Comment Utility
Oops, If NOT DEBUG then do this..
0
 

Author Comment

by:TRArter
Comment Utility
Naturally I did that. I was hoping that it could be FULLY automatic
0
 
LVL 43

Expert Comment

by:Steve Knight
Comment Utility
[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
 
LVL 18

Expert Comment

by:marilyng
Comment Utility
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
 

Author Comment

by:TRArter
Comment Utility
Yeah. i would think there has to be some flag set somewhere! But where?
0
 
LVL 46

Accepted Solution

by:
Sjef Bosman earned 250 total points
Comment Utility
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
 
LVL 46

Expert Comment

by:Sjef Bosman
Comment Utility
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
How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

 

Author Comment

by:TRArter
Comment Utility
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
 
LVL 43

Expert Comment

by:Steve Knight
Comment Utility
Heh, can you do that?  Must have a play!

Steve
0
 
LVL 46

Expert Comment

by:Sjef Bosman
Comment Utility
> 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
 
LVL 43

Expert Comment

by:Steve Knight
Comment Utility
True.  It's not as flakey as the formula language debugger though ;-)
0
 
LVL 46

Expert Comment

by:Sjef Bosman
Comment Utility
Just "flakey"? You're too kind :-))
0
 

Author Comment

by:TRArter
Comment Utility
What formula language debugger?
0
 
LVL 46

Expert Comment

by:Sjef Bosman
Comment Utility
The one they scrapped from R5 to R6... :-)
0
 

Author Comment

by:TRArter
Comment Utility
I thought that's what you were going to say, but "hope springs eternal in the human breast" (or was it beast?)
0
 
LVL 46

Expert Comment

by:Sjef Bosman
Comment Utility
And they did so for a very good reason: it was a very good idea, but it was buggy as hell!
0

Featured Post

What Security Threats Are You Missing?

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

For Desktop Techs: How to retain a user's Notes configuration data when swapping out the end user's computer. (Assuming that you are not upgrading to a completely different version of Notes client) All you need to do is: 1) install Notes o…
For beginners of Lotus Notes user this is important to know about the types of files and their location supported by IBM Notes. Mostly users are unaware about how many file types are created and what their usages are. This Article is fully dedicated…
This video discusses moving either the default database or any database to a new volume.
Illustrator's Shape Builder tool will let you combine shapes visually and interactively. This video shows the Mac version, but the tool works the same way in Windows. To follow along with this video, you can draw your own shapes or download the file…

762 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now