Solved

Can LotusScript detect automatically if the Script Debugger is enabled?

Posted on 2006-06-21
17
657 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
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
 
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
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 

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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Lotus Notes and SQL Server 2008, ODBC 22 1,318
IBM Domino web server 5 62
Disable some Lotus eMail users for a period of time 4 51
Lotus Notes shared mailbox 'Sent by' in header 3 37
  In today’s Arena we can’t imagine our lives without Internet as we are highly used to of it. If we consider our life style just for only 2 min we found that face to face communication is swapped by e-communication.  Every Where from Works place to…
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.
This video explains how to create simple products associated to Magento configurable product and offers fast way of their generation with Store Manager for Magento tool.
Concerto provides fully managed cloud services and the expertise to provide an easy and reliable route to the cloud. Our best-in-class solutions help you address the toughest IT challenges, find new efficiencies and deliver the best application expe…

929 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

8 Experts available now in Live!

Get 1:1 Help Now