Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Open an attachment

Posted on 2004-08-29
7
Medium Priority
?
417 Views
Last Modified: 2013-12-18
I need to show to the user a group of files attached to a document from a view without the user have to open the document and have to make a a click over every item and press "Launch...".  Maybe somebody have a script to do that.

Thanks in advance
0
Comment
Question by:arcano232
[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
7 Comments
 
LVL 15

Expert Comment

by:Bozzie4
ID: 11928870
Is this for the Notes Client, or for the web ?

Tom
0
 
LVL 31

Expert Comment

by:qwaletee
ID: 11932091
You can display the attachment names in the view, that;s trivial.  The following button (action button in a view) will display the list of attachments as a picklist for the user to select from:

fileNameToLaunch := @Prompt([OKCancelList]; "Attachments"; "Select an attachment"; @AttachmentNames; @AttachmentNames);
@Prompt([OK]; "Your selection"; fileNameToLaunch)

The question is, how do you get the selected name to launch?  There is no built-in mechanism.  In other recent posts, I've sugegsted ways to detach files and launch via the OS, using script.  The gotchas are name conflicts and cleaning up the files later ... Notes takes care of both of these in its launch mechanism, you would have to do the same without the luxury of "system level" services.

The other problem you have is that you seem to want to launch multiple files at once.  I can tell you right now, that's usually a dumb idea.  To much screen activity and I/O at once, user would have trouble dealing with it.
0
 
LVL 24

Expert Comment

by:HemanthaKumar
ID: 11954768
I have a soln that work for single attachment.. I can change it to work with multiple.. But not sure if I want to give out the  code just for 125...

~Hemanth
0
Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

 
LVL 31

Expert Comment

by:qwaletee
ID: 11957315
Hemantha, I've never know you to be a points hound!
0
 
LVL 24

Expert Comment

by:HemanthaKumar
ID: 11957354
Yes.. I am not hungry for points. But want to break the mentality that EE is cheap and can get away with it easily...It is like grading B and C even we dedicate time and effort for them...
0
 

Author Comment

by:arcano232
ID: 12000161
I increase the points. 250 is ok???
0
 
LVL 24

Accepted Solution

by:
HemanthaKumar earned 1000 total points
ID: 12000337
Here is the code...Create agent which will run on selected docs

Paste the code in appropriate sections of the agent

DECLARATIONS

Declare Function ShellExecute Lib "shell32.dll" Alias "ShellExecuteA" _
(Byval hwnd As Long, Byval lpszOp As String, _
Byval lpszFile As String, Byval lpszParams As String, _
Byval LpszDir As String, Byval FsShowCmd As Long) As Long

Declare Private Function GetDesktopWindow Lib "user32" () As Long

Private Const SW_HIDE = 0&

INITIALIZE

Sub Initialize    
    Dim session As New NotesSession
    Dim db As NotesDatabase
    Dim col As NotesDocumentCollection
    Dim doc As NotesDocument    
    Set db = session.CurrentDatabase
    Set col = db.UnProcessedDocuments
    Set doc = col.GetFirstDocument
    While Not doc Is Nothing
        LaunchAttachment doc
        Set doc = col.GetNextDocument(doc)
    Wend
End Sub


Sub LaunchAttachment(doc As NotesDocument)
    Dim ws As New NotesUIWorkspace    
    Dim rtItem As NotesRichTextItem
    Dim emobj As NotesEmbeddedObject
    Dim Scr_hDC As Long
    Dim ret As Long
    Dim arr() As String
   
    Set rtItem = doc.GetFirstItem("Body")    
    temp = Environ$("Temp") & "\"
    If Not rtItem Is Nothing Then
        If Isempty(rtItem.EmbeddedObjects) Then
            Msgbox "No attachments found",16,""
            Exit Sub
        End If
        Print "Looping through the attachment objects"
        Forall o In rtItem.EmbeddedObjects
            Redim Preserve arr(count) As String
            arr(count) = o.Name
            count = count + 1
        End Forall
       
        If count > 0 Then
            filearr = ws.Prompt(PROMPT_OKCANCELLISTMULT,"TITLE","PROMPT", arr(0), arr)
            Stop            
            If Not Isempty(filearr) Then
                Forall file In filearr
                    file = ReplaceSubString( file , " " , "_" )
                    Set emobj = rtitem.GetEmbeddedObject(file)
                    Call emobj.ExtractFile( temp & file )
                    Scr_hDC = GetDesktopWindow()
                    Print "Launching file at location..." & temp & file
                    ret = shellExecute(Scr_hDC, "open",file ,Null ,temp ,1&)
                    If ret <= 32 Then
                        Msgbox "An error occured while printing!"
                    End If
                End Forall
            End If
           
        End If ' count
       
    End If
End Sub

Function ReplaceSubString(Byval target As String, Byval rfrom As String, Byval rto As String) As String
    Dim pos As Long, lastpos As Long
    pos = Instr(target, rfrom)
    lastpos = 1
    Do Until pos = 0
        strReplace = strReplace & Mid$(target, lastpos, pos-lastpos) & rto
        lastpos = pos + Len(rfrom)
        pos = Instr(lastpos, target, rfrom)
    Loop
    ReplaceSubString = strReplace & Mid$(target, lastpos)
End Function    


>>>>>> NOW.. you determine the worth of this code
0

Featured Post

What’s Wrong with Your Cloud Strategy ?

Even as many CIOs are embracing a cloud-first strategy, the reality is that moving to the cloud is a lengthy process and the end-state is likely to be a blend of multiple clouds—public and private. Learn why multicloud solutions matter in this webinar by Nimble Storage.

Question has a verified solution.

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

This is an old article, please see an updated version of this article, located here: http://www.experts-exchange.com/articles/23619/Notes-8-5x-Windows-7-Notes-info-and-tips.html
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.
How to fix incompatible JVM issue while installing Eclipse While installing Eclipse in windows, got one error like above and unable to proceed with the installation. This video describes how to successfully install Eclipse. How to solve incompa…
Is your data getting by on basic protection measures? In today’s climate of debilitating malware and ransomware—like WannaCry—that may not be enough. You need to establish more than basics, like a recovery plan that protects both data and endpoints.…
Suggested Courses

636 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