Solved

Can LotusScript detect automatically if the Script Debugger is enabled?

Posted on 2006-06-21
17
665 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 6
  • 5
  • 3
  • +1
17 Comments
 
LVL 18

Expert Comment

by:marilyng
ID: 16950338
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
ID: 16950343
Oops, If NOT DEBUG then do this..
0
 

Author Comment

by:TRArter
ID: 16950410
Naturally I did that. I was hoping that it could be FULLY automatic
0
Technology Partners: 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!

 
LVL 43

Expert Comment

by:Steve Knight
ID: 16950414
[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
ID: 16950727
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
ID: 16950869
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
ID: 16950942
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
ID: 16950988
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
 

Author Comment

by:TRArter
ID: 16951616
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
ID: 16951668
Heh, can you do that?  Must have a play!

Steve
0
 
LVL 46

Expert Comment

by:Sjef Bosman
ID: 16951944
> 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
ID: 16951971
True.  It's not as flakey as the formula language debugger though ;-)
0
 
LVL 46

Expert Comment

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

Author Comment

by:TRArter
ID: 16957522
What formula language debugger?
0
 
LVL 46

Expert Comment

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

Author Comment

by:TRArter
ID: 16957885
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
ID: 16958237
And they did so for a very good reason: it was a very good idea, but it was buggy as hell!
0

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

IBM Notes offer Encryption feature using which the user can secure its NSF emails or entire database easily. In this section we will discuss about the process to Encrypt Incoming and Outgoing Mails in depth.
Notes Document Link used by IBM Notes is a link file which aids in the sharing of links to documents in email and webpages. The posts describe the importance and steps to create a Lotus Notes NDL file in brief.
Come and listen to Percona CEO Peter Zaitsev discuss what’s new in Percona open source software, including Percona Server for MySQL (https://www.percona.com/software/mysql-database/percona-server) and MongoDB (https://www.percona.com/software/mongo-…
In this video we outline the Physical Segments view of NetCrunch network monitor. By following this brief how-to video, you will be able to learn how NetCrunch visualizes your network, how granular is the information collected, as well as where to f…

696 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