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
Solved

Using Shell Command for Attachments

Posted on 2011-02-14
7
511 Views
Last Modified: 2013-12-18
I have a requirement that I have to give a link to show attachment, which should not be in edit mode(so that nothing can be saved by editing it). It is workflow application. I am using sheel command to perform that action, the issue is that One user is not able to open the attachment. she ia not getting any error but the attachment is not opening when the hot spot to view attachment is clicked. Pleas find the below code which I have written on the hot spot.


Sub Click(Source As Button)
      Dim ss As New notessession
      Dim doc As NotesDocument
      Dim rtitem As Variant
      Dim ws As New NotesUIWorkspace
      Dim uidoc As NotesUIDocument
      Dim fnm As String
      
      Set uidoc=ws.CurrentDocument
      Set doc=uidoc.Document
      Set rtitem = doc.GetFirstItem( "AttPriceAttachment" )
      If ( rtitem.Type = RICHTEXT ) Then
                                   Forall o In rtitem.EmbeddedObjects
            If ( o.Type = EMBED_ATTACHMENT ) Then
            fnm= "c:\" & o.Source
            Call o.ExtractFile(fnm)
            Dim result As Integer
            'result = Shell(fnm, 3)
            'cmd = {cmd /C "\Backlog.txt"}
            cmd = {cmd /C "\}& o.Source &{"}
            ret = Shell( cmd )
                        
                  End If
            End Forall
      End If
End Sub
0
Comment
Question by:Glactus
  • 3
  • 3
7 Comments
 

Author Comment

by:Glactus
ID: 34886695
The problem exists only for one user, every other are able to see it.
0
 
LVL 22

Expert Comment

by:mbonaci
ID: 34886850
Have you tried to debug the code? Just turn debugger on and click on the hot-spot.
0
 

Author Comment

by:Glactus
ID: 34886920
Yes I have done through the debugger and it is running properly and it is returning the excel path in the variables, but it is not displaying the excel and not giving any error also
0
Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

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

 
LVL 22

Accepted Solution

by:
mbonaci earned 250 total points
ID: 34886929
If you want to improve your code look at the solution in this thread to learn how to use WinAPI function ShellExecuteEx:

http://www.experts-exchange.com/Q_26718234.html#34629225

Beware that the code prints the attachment, not just opens it...

See here to learn about function parameters:
    http://msdn.microsoft.com/en-us/library/aa932861.aspx
0
 
LVL 22

Expert Comment

by:mbonaci
ID: 34886937
See, in the task manager, whether the Excel task was left there hanging.
If not see whether her Excel is working properly (launch the detached file manually).
0
 

Author Comment

by:Glactus
ID: 34894308
Thanks for the help, the code helped, I am doing final round of testing,  I will let you know when finished.
0
 
LVL 31

Expert Comment

by:qwaletee
ID: 34902702
First thing to do is check that the file is actually there. Second thing to do is check if you can run the equivalent command manually, successfully, from a command prompt. If the file is there, and you can run the ocmmand succesffully from a prompt, then it is a Notes problem. If the file is not there, it is probably a coding problem. If the file is there, but you fial when running it manully, then it is a problem with the workstation and.or the installation of Excel on the workstation.
0

Featured Post

Free Tool: Postgres Monitoring System

A PHP and Perl based system to collect and display usage statistics from PostgreSQL databases.

One of a set of tools we are providing to everyone 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

Suggested Solutions

Title # Comments Views Activity
IBM Enterprise Integrator - ZID File 1 173
Exchange coexistence and migration from Lotus DOmino 8 233
Switching from Lotus Notes to Outlook 4 52
attaching a file lotus notes 4 112
For users on the Lotus Notes 8 Standard client, this article provides information on checking the Java Heap size and adjusting it to half of your system RAM in attempt to get the Lotus Notes 8.x Standard client to run faster.  I've had to exercise t…
  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…
Established in 1997, Technology Architects has become one of the most reputable technology solutions companies in the country. TA have been providing businesses with cost effective state-of-the-art solutions and unparalleled service that is designed…
In a recent question (https://www.experts-exchange.com/questions/29004105/Run-AutoHotkey-script-directly-from-Notepad.html) here at Experts Exchange, a member asked how to run an AutoHotkey script (.AHK) directly from Notepad++ (aka NPP). This video…

790 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