/ Forums / Advansys Formativ / Creating Solutions with Formativ / Attaching a windows shortcut

  • Creator
    Topic
  • #4350
    RPP
    Participant

      Hi

      Our users often want to send a shortcut to a network file to each other (internal emails only this is) but the process for doing so is a bit painful so I was hoping to create a Formativ button that would assist them.

      The process in GW as I understand it is as follows …

      Create a Windows Shortcut (LNK file) by right clicking on the target file, a PDF say, and choosing Send to Desktop (create shortcut).

      Start a New mail and drag the LNK file into the Attachments area (or use the paperclip icon and roam to the LNK file).

      You then get a choice of adding the file itelf (PDF) or the shortcut (LNK).

      Choosing the shortcut open creates an attachment that will open the PDF file for the recipient.

      This is very handy.

      When I try and recreate this in code howver I get stuck on doing the attachment. So far I have …

      Groupwise.ItemAttachmentAdd “XOO”, 114, “C:Documents and SettingsGRAHAMDesktopShortcut to Demo.pdf.lnk” , “Shortcut to Demo19.pdf.lnk”

      This causes the pop-up option to appear for attach file vs attach shortcut.

      Is there some way around this? Either by attaching the LNK file a different wany or some way to “answer” the pop-up question and select ‘attach shortcut’?

      Note: I am assuming I have asked the user to select the file they want a shortcut to via a Form and I have already created the windows shortcut (possibly via a VB ActiveX call). Its the attach stage that is causing me a problem.

      Thanks

      Simon

    • Author
      Replies
    • #7894
      Support 3
      Participant

        Unless I am missing something, nothing appear to happen for the shortcut file when using the ItemAttachmentAdd Token. Works fine for the actual file. Also noticed, the FileExists(“C:tempShortcut test.pdf.lnk”) method return FALSE for the shortcut item. Do you see the same behaviour?

        Regardless of the different behaviour, I think you can not skip the pop-up dialog of the attach file/attach shortcut. Another option may be to use the Object API to create the message, attach the file and finally open the message for the user using the ItemOpen() token.

        Hope this helps.

        Regards,
        Advansys Support

        #7892
        Immi
        Participant

          Hi Simon!

          You might also send a HTML link – that’s what we do:

          ‘——————————————————————————-
          ‘ AddLinkHTML
          ‘——————————————————————————-
          Sub AddLinkHTML(oMsg)

          Dim sfile

          sFile = SelectFile()
          If sFile <> “” Then ‘ file selected?
          Utilities.CopyHTMLToClipboard(“<DIV><A href=file://” & NoSpaceInFileName(sFile) & “>” & sFile & “</DIV>”)
          GroupWise.EditPaste
          End If

          End Sub

          ‘——————————————————————————-
          ‘ Create short path
          ‘——————————————————————————-
          Function NoSpaceInFileName(filespec)

          Dim fso, f

          If Instr(filespec, ” “) > 0 then
          Set fso = CreateObject(“Scripting.FileSystemObject”)
          Set f = fso.GetFile(filespec)
          NoSpaceInFileName = f.ShortPath
          Set fso = Nothing
          Else
          NoSpaceInFileName = filespec
          End If

          End Function

          Hope this helps

          Stephan

          #7893
          Support 3
          Participant

            Thanks Stephan for sharing the idea.

            Regards,
            Advansys Support

          Viewing 3 replies - 1 through 3 (of 3 total)
          • You must be logged in to reply to this topic.