Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Removing a database icon from a workspace

Posted on 1999-06-29
11
Medium Priority
?
2,256 Views
Last Modified: 2013-12-18
Hi everyone!

   This one is a "toughy"... I need to remove a database icon from the workspace programmatically... I know there are no methods in LotusScript to do that but I trust someone has found a way to "hack" lotus notes and do that.

I'm thinking, in LotusScript (as most solution requires), to open the desktop.dsk file (it's a database you know), try (if God helps me) to find the document that represents the icon I wish to remove and remove the document ?

I'm also thinking to put a button in the database (the one I wish to remove) that will 1. Quit the database (return to the workspace) 2. Call @Command([EditClear]) ... that should do the trick but I am too afraid that something goes wrong and I end up deleting another icon ...

Any toughts / solutions will be appreciated,

mchampou
0
Comment
Question by:mchampou
[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
  • 3
  • 2
  • 2
  • +3
11 Comments
 
LVL 2

Author Comment

by:mchampou
ID: 1119643
If anyone wonders, I've tried the second solution with success but I still don't like it ... here's the code in the button :

@Command([FileCloseWindow]);
@Command([FileCloseWindow]);
@PostedCommand([EditClear])

The first FileCloseWindow closes the document the user had opened to click on the button.
The second FileClose closes the database.
The EditClear acts like if the user had pressed "Delete" on his keyboard to remove the database icon ... voila!

But it's too simple ... I need something more robust (like script).

Thanks!

0
 
LVL 6

Expert Comment

by:ghassan99
ID: 1119644
No such thing...believe me, I tried this before and drived me nuts, before someone told me about the commands.  Its possible in R5 so I hear. No script what so ever to do this.  By the way, instead of a 2 close windows command, and a posted one, u can just use @Command([WindowWorkspace]).  Will that earn me the points?:p
0
 
LVL 3

Expert Comment

by:Gunsen
ID: 1119645
I don't think you will be able to do this from R4 documentet script features.

Still i would prefer the following formula wich makes sure the correct database icon is highlighted before deletion :

@Command([FileCloseWindow]);
@Command([FileCloseWindow]);
@Command([WindowWorkspace]);
@Command( [AddDatabase] ; server : db );
@Command([FileDatabaseRemove])

[EditClear] may interfere with wrong object types as documents.
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!

 
LVL 3

Expert Comment

by:MW
ID: 1119646
The problem with a formula is that one can not make sure that the database to be removed is not currently open in another window. If this is the case the formula won't work. I tried this method, but gave up as it is not reliable.

Secondly you get this stupid confirmation dialog when using FileDatabaseRemove. So still a user can make your formula not working.
0
 
LVL 6

Expert Comment

by:ghassan99
ID: 1119647
MW, u r absolutely right!
0
 
LVL 2

Author Comment

by:mchampou
ID: 1119648
Hi Gunsen,

  I am sorry to reject you answer. I tried it out and it does not work. It leaves the database opened so when you do the @Command([FileDatabaseRemove]) it gives an error message and does not remove the icon : I must go back to my window list, close the opened view and then it removes itself ...

  I tried with a mix of @PostedCommand to no avail. I also tried to add a couple more of [FileCloseWindow]... If you could just check up your code, perharps I'm not getting something here.

  BTW: You are right on the target when you say that the [AddDatabase] will select the right database... but up to now (perhaps I'm lucky) I haven't had any problems : the correct icon was selected. You were also right about the [EditClear] that might delete the wrong stuff ... it happened to me once as I was testing and I didn't put enough [FileCloseWindow].

I'll be waiting for your response ... pls keep in mind that I won't be in the office for the next 4 days (tommorrow and friday off + weekend).

Sincere thanks,

mchampou
0
 
LVL 6

Accepted Solution

by:
ghassan99 earned 300 total points
ID: 1119649
Ok here is what u have to do...
@PostedCommand([FileCloseWindow]);
@PostedCommand([FileCloseWindow]);
@PostedCommand([WindowWorkspace]);
@PostedCommand( [AddDatabase] ;"test.nsf" );
@PostedCommand([EditClear]) or @PostedCommand([FileDatabaseRemove])

It wont be really a difference using edit clear or the other, coz the icon will have the focus last, it will not be confused with other open documents.

0
 
LVL 3

Expert Comment

by:Gunsen
ID: 1119650
Well, on my client (R 4.6.3), the icon will get deleted after last session/window is closed.  The error msg says - the icon will be deleted later... - and it does.
0
 

Expert Comment

by:JoeRiley
ID: 3778539
I have a LotusScript solution that works.  First, I found a LotusScript script library that you include in your database.  It functions like SendKeys in VB, but SendKeys is not supported in Notes, and does not work.  This script library does work -- very much like SendKeys.

When the script library (that I can send to anyone who wants it) is pasted into the database, and the Use statement decared in the Globals Options with the Use statement, the script is available and the "PushKeys" statements can be used in script in much the same way SendKeys works.

I used this solution in an application that I have to distribute files to multiple users in a self-extracting archive.  After the document that they open from a doclink is closed, the icon to the database remains on their workspace.  Since the last thing this application does is run a LotusScript routine to send mail back to IT (as an audit trail of which users actually unzipped the files), I simply wrote included the script witten in a sample below.  The sample below of for illustrative purposes.  My code is seamless to the user.

For demonstation, I created an action in a view, with a button visible in that view to test and run the script.  It adds the database icon to the workspace (even though it's already there it doesn't generate an error).  The script attahced to the button is this:

Sub Click(Source As Button)
     Dim workspace As New NotesUIWorkspace
     Dim db As NotesDatabase
     Dim session As New NotesSession
     Dim sn As NotesDatabase
     Set db = session.CurrentDatabase
     
     'if db is on several servers, this code will
     'assign the name of the server to the variable
     'sn by retrieving it from the sessions current database properties
     Set sn = session.CurrentDatabase  'set value of sn
     server = sn.Server  'get current server name
     
     'this code uses an empty string for the server assuming this script is running on a local machine
     'replce the empty string with the server variable if the database is a replica on a server
     Call workspace.AddDatabase("", "test navigators.nsf")    
     
     PushKeys "{ESCAPE}"  'Closes the current database and returns to the workspace
     PushKeys "{DELETE}"   'Removes the selected icon from the workspace
     PushKeys "{ENTER}"     'Answers the user prompt by accespting the Yes default
     
     Exit Sub
End Sub

=====================================================
If you would like to accept this answer, I will send you the script library.
>>Thanks
0
 

Expert Comment

by:CRISIL
ID: 21864040
The above solution is nice.. but can you provide me with the script library... my id is vikram.solanki@inbox.com

0
 

Expert Comment

by:CRISIL
ID: 21897709
vikram.r.solanki@gmail.com-- can you send me the script library to this id...
0

Featured Post

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!

Question has a verified solution.

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

I thought it will be a good idea to make a post as it will help in case someone else faces these issues. I trust this gives an idea how each entry in Notes.ini can mean a lot for the Domino Server to be functioning properly. This article discusses t…
Lack of Storage capacity is a common problem that exists in every field of life. Here we are taking the case of Lotus Notes Emails, as we all know that we are totally depend on e-communication i.e. Emails. This article is fully dedicated to resolvin…
This tutorial will teach you the special effect of super speed similar to the fictional character Wally West aka "The Flash" After Shake : http://www.videocopilot.net/presets/after_shake/ All lightning effects with instructions : http://www.mediaf…
In this video, Percona Director of Solution Engineering Jon Tobin discusses the function and features of Percona Server for MongoDB. How Percona can help Percona can help you determine if Percona Server for MongoDB is the right solution for …
Suggested Courses

670 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