Lotus Notes FAQ Visit Our Sponsor!

How do you update the SmartIcons on all your users' workstations via LotusScript?

If you put the following code in a button in an email message and attach all the icon files to the same message, your users can update their SmartIcons by simply clicking on the button when they receive the email:

     '======================================================================
     ' Code Documentation
     '======================================================================   
     'Originally Written By: James Fox @ Com Tech Communications
     'Originally Created On: 1/3/97
     'Last Updated By: James Fox
     'Last Updated On: 1/3/97
     
     '======================================================================
     ' Declare Variables
     '======================================================================   
     Dim session As New NotesSession
     Dim ws As New NotesUIWorkspace
     Dim uidoc As NotesUIDocument
     Dim doc As NotesDocument
     Dim rtitem As Variant
     Dim iconPath As String
     Dim retvalue As Variant
     Dim fileName As String
     On Error Goto errorRoutine     
     '======================================================================
     ' Warn User what is going to happen
     '======================================================================          
     x = Messagebox("SmartIcon Installer is about to setup the new Com Tech SmartIcons.  Your current universal SmartIcon set will be overridden with the new SmartIcon set.  Your original set will be backed up to a file called universe.bak.  Press OK to Continue", 1 + 64 + 0 + 0,"SmartIcon Installer")
     If x <> 1 Then
          x = Messagebox("SmartIcon Setup has been Aborted  Thank you.",0 + 48 + 0 + 0,"SmartIcon Setup")
          End
     End If
     
     '======================================================================
     ' Get and Set Icon Path
     '======================================================================          
     iconPath = session.GetEnvironmentString("WinNTIconPath", True) + "\"
     Chdrive Left(iconPath,3)
     Chdir iconPath 
     '======================================================================
     ' Backup current universal Set
     '=====================================================================
     fileName = Dir$(iconPath + "universe.bak", 0)
     If fileName <> "" Then
          Kill iconPath + "universe.bak"
     End If     
     Name iconPath + "universe.smi"  As iconPath + "universe.bak"
     
     '======================================================================
     ' Detach Files in memo (overwriting existing files)
     '=====================================================================     
     Set uidoc = ws.CurrentDocument
     Set doc = uidoc.Document     
     Set rtitem = doc.GetFirstItem( "Body" )     
     notesEmbeddedObject = rtitem.EmbeddedObjects
     If ( rtitem.Type = RICHTEXT ) Then
          Forall o In rtitem.EmbeddedObjects          
               objectName = o.Name
               fileName = Dir$(iconpath + objectName, 0)
               If fileName <> "" Then
                    Kill iconpath + fileName
               End If     
               Call o.ExtractFile(iconPath + objectName )
          End Forall                                        
     End If
     
     '======================================================================
     ' Notify User of SmartIcon Installer Status
     '=====================================================================          
     x = Messagebox("SmartIcon Setup has completed Successfully.  Your original smartIcon set has been saved as Universe.bak.  Please close and restart Lotus Notes to use your New SmartIcons",0 + 64 + 0 + 0,"SmartIcon Setup")
     End     
     
     '======================================================================
     ' This is the general error routine
     '=====================================================================     
errorRoutine:
     x = Messagebox("SmartIcon Setup is Incomplete.  Please advise MIS via e-mail.  Thank you.",0 + 48 + 0 + 0,"SmartIcon Setup")
     Name  iconPath + "universe.bak"  As iconPath + "universe.smi"
     End
End Sub


Applies to Notes Versions: 4, 4.5, 4.6, 5
Last Modified: August 31, 1999