LaurentiuB Posted December 8, 2005 Share Posted December 8, 2005 How can I attach a file (the name file can be diferent, but i know the extension) to an e-mail message and send it? More, it's posible to run the script without user intervention ? I know how to create an e-mail but I don't know how to attach a file. Link to comment Share on other sites More sharing options...
dabus Posted December 8, 2005 Share Posted December 8, 2005 Have a look at those blat-udfs at scripts@scraps. There should be some if you just use the search button and type blat. Link to comment Share on other sites More sharing options...
Gun-Food Posted December 8, 2005 Share Posted December 8, 2005 Hi, I did the same for sending every morning a Mail. I used Outlook Express (no need for an additional Office License). It' s configured as a client. expandcollapse popupif FileExists("S:\sicher\sicher.zip") Then ; Run Outlook Run("C:\Programme\Outlook Express\MSIMN.EXE") ; Wait for the Outlook become active WinWaitActive("Outlook Express") ; Now that the Outlook window is active type some text Sleep(500) Send("!d") ; new message send("n") send("e") Sleep(500) winwaitActive("Neue Nachricht"); English: winwaitActive("New message") ; Enter Mail adress send("xxx@xfdsjgk.com") sleep(500) send("+{Tab 2}") sleep(500) ; Subject send("Files") sleep(500) send("+{Tab 3}") sleep(500) ; a short text send("The daily files") sleep(500) ; Attach files send("!i") send("a") sleep(500) send("s:\sicher\sicher.zip"); insert here the path to your file - If more then one file use semicolon to add next file sleep(500) send("!e") sleep(500) ; Now send the Mail Send("!s") ; Quit Outlook Express sleep(500) send("!d") send("b") Hope it helps. I know it's not perfect, but it works great. If someone has a shorter Version of it, just message me. CU @ ALL -[-Gun-Food-]- Link to comment Share on other sites More sharing options...
dabus Posted December 8, 2005 Share Posted December 8, 2005 It would be much better to use blat, since there is no interaction, that can be interrupted. As far as I figured out, outlook (and maybe outlook express) is such a bunch of cusomized bars & menus, that save Controlsend will fail. As you use Send, your script will be interrupted by a simple popup (Maybe sth. like "Update Adobe Reader", "Virus found" ...). If this data that should be send is sensitive, use blat. It's very small, open source and you neither need outlook express. Link to comment Share on other sites More sharing options...
seandisanti Posted December 8, 2005 Share Posted December 8, 2005 It would be much better to use blat, since there is no interaction, that can be interrupted. As far as I figured out, outlook (and maybe outlook express) is such a bunch of cusomized bars & menus, that save Controlsend will fail. As you use Send, your script will be interrupted by a simple popup (Maybe sth. like "Update Adobe Reader", "Virus found" ...). If this data that should be send is sensitive, use blat. It's very small, open source and you neither need outlook express. if you're using outlook, personally i believe the solution should be outlook based whenever possible. i would suggest using COM via AutoIT, or VBA. I will type up a VBA script real quick and append it to this message, it shouldn't take much to modify it to an AutoIT script utilizing COM interaction... Link to comment Share on other sites More sharing options...
seandisanti Posted December 8, 2005 Share Posted December 8, 2005 if you're using outlook, personally i believe the solution should be outlook based whenever possible. i would suggest using COM via AutoIT, or VBA. I will type up a VBA script real quick and append it to this message, it shouldn't take much to modify it to an AutoIT script utilizing COM interaction... here ya go. this is entered into the VBA IDE accessed by pressing alt + f11 in outlook. Public Sub blah() Set mymessage = Application.CreateItem(olMailItem) mymessage.Recipients.Add "me@myprovider.com" mymessage.Attachments.Add "c:\test.txt" mymessage.Subject = "Subject goes here" mymessage.Body = "vba is neat." mymessage.Display mymessage.Send End Sub you could even omit the 'mymessage.display' line, and the message would not even be displayed prior to sending. Link to comment Share on other sites More sharing options...
dabus Posted December 9, 2005 Share Posted December 9, 2005 (edited) I don't know how to code vba (and I think autoit 3.1.1 was not able to do so natively), but seems like it's not that hard... Where should I look for outlook-vba-code? Example: I would love to start the import-dialog without using Send - at least I did't find any good way. Although I have to add that those functions suck since outlook wasn't able to export and reimport properly if you use excel or access-format ... Edited December 9, 2005 by dabus Link to comment Share on other sites More sharing options...
seandisanti Posted December 9, 2005 Share Posted December 9, 2005 I don't know how to code vba (and I think autoit 3.1.1 was not able to do so natively), but seems like it's not that hard...Where should I look for outlook-vba-code? Example: I would love to start the import-dialog without using Send - at least I did't find any good way. Although I have to add that those functions suck since outlook wasn't able to export and reimport properly if you use excel or access-format ... i have a few sites in my list at home i can post when i get off, i had a hard time finding resources when i was trying to learn the syntax etc for doing things in outlook, but i was able to find a few references. Also in teh vba interface, if you press F2 you can check out the objects and methods available, that may help. In the interim though, i may be able to help you do the things you want to do with outlook, and there are a few outlook interaction scripts in the scripts and scraps forum that may accomplish what you're trying to do. As far as the import you're talking about, if you give me some more details, as to how you do it manually, and what exactly it is you're trying to do, i may be able to whip something up for you. Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now