Jump to content
Sign in to follow this  
MFerris

Dropping Outlook attachments onto GUI

Recommended Posts

MFerris

Hi all - hoping some of you OLE/COM/DLL gurus could possibly help me out with a task that has really got me stumped - mostly because I am not terribly familiar with hooking into DLLs and the whole 'DllStruct' arena. I can usually find a solution to my problems by searching these forums as well as VB related scripts and tend to post here only as a last resort - which is where I find myself now.

I am attempting to write a utility which will accept attachments dragged out of Outlook onto my GUI and then save the files to a specified directory. This behavior is not allowed by default. I am able to set up the GUI to accept files dropped onto it with no problem, but attempting to drag an attachment from Outlook onto the GUI shows the 'no action' icon. I've done plenty of searching on how this can be done in VB. I have found some solutions, but I can't figure out how to convert it to AutoIt code. In doing some searches here on the forum, I found which I *think* might be a step in the right direction, however it more or less deals with clipboard data, not actual dropped items onto a control.

I'm not asking for anyone to code this for me, but only to pick the brains of those who understand this a little more clearly and can steer me in the right direction. Also if there is a good tutorial on how to use DLLs with the DLLStruct and DLLStructCreate functions.

Note: Some further code example which sounds like nearly exactly what I'm trying to do (but in VB).

http://social.msdn.microsoft.com/Forums/is/vblanguage/thread/c30b87fa-3257-4b0b-b36b-350b0dd5b397

Private Sub listbox1_DragEnter(ByVal sender As Object, _
         ByVal e As System.Windows.Forms.DragEventArgs) _
         Handles ListBox1.DragEnter
     If (e.Data.GetDataPresent(DataFormats.FileDrop) = True) Then
         e.Effect = DragDropEffects.Copy
     End If
End Sub
Private Sub listbox1_DragDrop(ByVal sender As Object, _
         ByVal e As System.Windows.Forms.DragEventArgs) _
         Handles ListBox1.DragDrop
     For Each oneFile As String In _
             e.Data.GetData(DataFormats.FileDrop)
         ListBox1.Items.AddRange(IO.File.ReadAllLines(oneFile))
     Next oneFile
End Sub
Edited by MFerris

Share this post


Link to post
Share on other sites
water

I can't help you with the "drag" part but for the "Outlook" part you might have a look at my OutlookEX UDF (please check my signature).


My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2018-06-01 - Version 1.4.9.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (2018-01-27 - Version 1.3.3.1) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2015-04-01 - Version 0.4.0.0) - Download - General Help & Support - Example Scripts
Excel - Example Scripts - Wiki
Word - Wiki
PowerPoint (2015-06-06 - Version 0.0.5.0) - Download - General Help & Support

Tutorials:
ADO - Wiki

 

Share this post


Link to post
Share on other sites
MFerris

Thanks, water. I've actually used your UDF for other purposes and it's worked great - thanks for your contribution. I think the bigger nut to crack is getting the AutoIt GUI to accept the dragged attachment as a droppable item, as my research shows that the data contained in the outloook 'droppable' is a list of the items being dragged (or possibly binary data of the items themselves - this part I'm not entirely clear on). So I don't really think there's much to do as far as hooking into Outlook is concerned. I may look into whether the clipboard route may work as a last resort. (CTRL+C on an attachement in Outlook triggers the DropEffect script that i linked to - haven't explored that route very much yet as that's not the optimal solution.)

Update: It seems the VB code isn't really going to help as I was researching the use of 'System.Windows.Forms' doesn't really apply to AutoIt GUIs - So I'm guessing now I'm looking for something that will allow the AutoIt GUI to accept the drop action. I found another solution for C# here but the same construct applies. I just need to find a DLL or OLE hook that will let me force AutoIt to allow the drop and read the stream of data that it receives.

Edited by MFerris

Share this post


Link to post
Share on other sites
water
looks like a good start for the drag & drop issue.

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2018-06-01 - Version 1.4.9.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (2018-01-27 - Version 1.3.3.1) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2015-04-01 - Version 0.4.0.0) - Download - General Help & Support - Example Scripts
Excel - Example Scripts - Wiki
Word - Wiki
PowerPoint (2015-06-06 - Version 0.0.5.0) - Download - General Help & Support

Tutorials:
ADO - Wiki

 

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

  • Similar Content

    • Gowrisankar
      By Gowrisankar
      Dear members of the forum,
      I need to open the attachments from mails without downloading them. Is it possible using OutlookEx UDF ?
    • water
      By water
      Extensive library to control and manipulate Microsoft Outlook.
      Theads: Development - General Help & Support - Example Scripts - Wiki
      BTW: If you like this UDF please click the "I like this" button. This tells me where to next put my development effort

      KNOWN BUGS (last changed: 2018-01-26)
      None
    • Gowrisankar
      By Gowrisankar
      Dear members,
      I'm trying to get the attachments from mails using OutlookEx UDF and then save them in a particular location.
      The UDF considers even the signature images and other images in the mail body as attachments, and saves it in the folder I point. I want only the proper attachment documents to be saved.
      Requesting the guidance of the forum members.
       
       
      Thanks and regards,
      Gowrisankar R.
    • Gowrisankar
      By Gowrisankar
      Dear members,
      I'm trying to move unread mails from Inbox to a different folder using OutlookEx UDF.
      But its not working for me. I'm not sure what mistake I do.
      I get the error code 6 when the following is executed. From the UDF it is observed that  "No or an invalid item has been specified".
      Note : The UDF version is 1.3.3.1. AutoIt version (v3.3.14.2).
      #include <OutlookEX.au3> Global $oOutlook = _OL_Open() If @error <> 0 Then Exit MsgBox(16, "OutlookEX UDF", "Error creating a connection to Outlook. @error = " & @error & ", @extended = " & @extended) Global $aOL_Item = _OL_ItemFind($oOutlook, "*\Inbox", $olMail, "[UnRead]=True", "", "", "Subject", "", 1) If $aOL_Item[0][0] = 0 Then Exit MsgBox(16, "OutlookEX UDF: _OL_ItemMove Example Script", "Could not find a task item in folder 'Outlook-UDF-Test\SourceFolder\Tasks'. @error = " & @error) _ArrayDisplay($aOL_Item, "OutlookEX UDF: _OL_ItemFind Example Script - Unread mails") _OL_ItemMove($oOutlook, $aOL_Item[1][0], Default, "*\Outlook-UDF-Test\TargetFolder\Mail") If @error <> 0 Then Exit MsgBox(16, "OutlookEX UDF: _OL_ItemMove Example Script", "Error moving specified task. @error = " & @error) Any help is deeply appreciated. Thanks in advance.
      Thanks and regards,
      Gowrisankar R.
    • cag8f
      By cag8f
      Hi all.  Does AutoIt have any functions/tools (either built-in or user defined) that can help me automate the process of exporting an OST mailbox to a PST file in Microsoft Outlook (2013)?
      I know how to carry out the process manually.  At the Microsoft Forums, I have asked if it is possible to do the same via a script, but some have said it is not possible.  It may be possible if I was using Microsoft Exchange, but I am not.
      I've seen some posts about an Outlook UDF on this site (here and here), but I don't see any mention of exporting a mailbox.  
      In my post at the Microsoft Forums, many paid third party applications were suggested.  But for now I would like to pursue the custom scripting route as far as I can.
      The ultimate goal of this exercise is to automatically create a weekly backup of my Outlook mailbox for offline storage.
      Thanks in advance.
       
×