search dir and email the pdf's in it

Recommended Posts

The job i like to automate.

Search a directori for files.

Set them in a array.

Mail them 1 fot 1

(maybe make them smaller size)

I would like to put the name (nummber's 5 digits) in a excel file.

and search for them in a dir.

This i can do, no props.

I will post the code for this later on.

First i need to know if this jobis possible with autoit before i try.

1-can i read out a dir

2-put them in a array (if 1 goes then this would be a prop)

3-command outlook to mail them

Share on other sites

Yes to all.

Monkey's are, like, natures humans.

Share on other sites

Thanks Jhon LoL :-)

I will try and post my sollution .

Today i made it in à vba module .

Share on other sites

Almost there...

But have a problem with to attatch a file to the mail.

Im trying with this code.

The window of a naw email is open and i'm trying with jeystrokes to attach.

But it almost impossible. :-(

Func IMPORT_A_TO_AR($FILE) ;~$Address = InputBox('Address', 'Enter the E-Mail address to send message to')
$Subject = "==> : " &$FILE ;InputBox('Subject', 'Enter a subject for the E-Mail')
$Body = "==> : " &$FILE ;InputBox('Body', 'Enter the body (message) of the E-Mail')
$ATT=$dir&$FILE _INetMail($address, $subject,$body)
sleep(500)
Send("!i")
sleep(1000)
Send("b")
;Send("{ENTER}")
sleep(1000)
Send($ATT) sleep(1000) Send("!o") ;Send("{TAB}") ; sleep(1000) ;Send("{TAB}") ; sleep(1000) ;Send("{ENTER}") ; sleep(1000) ;MsgBox(0,'E-Mail has been opened','The E-Mail has been opened and process identifier for the E-Mail client is ' & _INetMail($address, $subject,$body))
endfunc

Share on other sites

Use _InetSmtpMail() if possible. This allows you to bypass the manual send, but you do have to have all of your email account's SMTP information available to make it work.

_InetSmtpMail() is in your help file as well.

Spoiler

“Hello, ladies, look at your man, now back to me, now back at your man, now back to me. Sadly, he isn’t me, but if he stopped using ladies scented body wash and switched to Old Spice, he could smell like he’s me. Look down, back up, where are you? You’re on a boat with the man your man could smell like. What’s in your hand, back at me. I have it, it’s an oyster with two tickets to that thing you love. Look again, the tickets are now diamonds. Anything is possible when your man smells like Old Spice and not a lady. I’m on a horse.”

Share on other sites

You could also take a look at the Outlook.au3 UDF.

• 1

If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.
Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag Gude
How to ask questions the smart way!

I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from.

Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays.  -  ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script.  -  Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label.  -  _FileGetProperty - Retrieve the properties of a file  -  SciTE Toolbar - A toolbar demo for use with the SciTE editor  -  GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI.  -   Latin Square password generator

Share on other sites

I tried Outlook.au3 and OutlookEX.au3.

it only works with autoit 3.9.2

and not outlook 2003 (wich i use)

GENERAL

=======

* Needs AutoIt beta version 3.3.9.2 or later because of the new COM error handling.

Will still run with earlier versions but will crash if a COM error occurres and _OL_ErrorNotify has not been called before

* _OL_Open no longer initializes a COM error handler. Has to be done by _OL_ErrorNotify

Im using portable autoit..not 3.9.2

for _InetSmtpMail() its the echange server @ my work...

I dont know where to get the info needed

Share on other sites

If you are not the administrator of the exchange server, I would recommend getting with an administrator FIRST before doing a project that involves its use. You may be breaking corporate IT rules that can lead to your termination.

If YOU are the administrator... drop what you're doing and go learn about how exchange server works.

Spoiler

“Hello, ladies, look at your man, now back to me, now back at your man, now back to me. Sadly, he isn’t me, but if he stopped using ladies scented body wash and switched to Old Spice, he could smell like he’s me. Look down, back up, where are you? You’re on a boat with the man your man could smell like. What’s in your hand, back at me. I have it, it’s an oyster with two tickets to that thing you love. Look again, the tickets are now diamonds. Anything is possible when your man smells like Old Spice and not a lady. I’m on a horse.”

Share on other sites

LoL no mate.

I just need to work somthing out to simplify some stuff.

I like to learn about scripting because it made my life easier

So if you can help me out :-)

Its because of firm policys that we can not sync 2 directorys. (firm-A to Firm-B )

If i can mail some files automaticly it would be good for both.

I dont see anny harm in that.

Create an account

Register a new account

• Similar Content

• 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)
Function _OL_RuleConditionSet does not properly handle parameter rule condition type ($iRuleConditionType) when value$olConditionSentTo is passed. it is being processed the same way as $olConditionFrom. Thanks to user Moonscarlet for reporting this bug. Fixed with version 1.3.3.1 of the UDF. • 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. • By zetaimmersion Hi all. I am trying to do 2 things but i cannot seem to get any traction on how to read/implement this idea. Premise: PowerPoint file in C\temp\presentation.pptx that contains on the first slide 2 entries as "<one>" and "<two>" which need to be replaced with "user1" and "user2", then a silent Outlook send mail containing the file with a predefined body and subject. I narrowed it down to COM objects as the Office does not like intrusive open AutoIt functions. I installed OLE/COM Object Viewer to understand how to create the commands but i am still stuck. So far i am trying to user water's code but i suck COM object i was originally trying to modify Dim$oPPT, $oPres$oPPT = ObjCreate("PowerPoint.Application") $oPPT.Visible = True$oPres = $oPPT.Presentations.Read Water's code below (0.1% modified) #include <File.au3> #include "PowerPoint.au3" #include <misc.au3> Global$sFile = "C:\temp\presentation.pptx" Global $sString2Search = "<username>",$sString2Replace = "Password", $iReplaceOnce = 1,$sFullLogFile = "C:\temp\pptxlog.txt" _ProcessPpt($sFile) Func _ProcessPpt($sFile) $oApp = _PPT_PowerPointApp() Local$bChange = False Local $oInterface =$oApp.Presentations Local $oPresentation =$oInterface.Open($sFile, False, False, False) If @error Then _FileWriteLog($sFullLogFile, "E Error " & @error & " opening File " & $sFile) Return SetError(1, 0, 0) EndIf ;it does not even open my file and from here not sure how to read the text and replace it EndFunc ;==>_ProcessPpt • By Smigacznr1 I'm writing Outlook pst cleaner and now I'm stuck. Compiled script is crashing with OS crash message. When I tryied to run script from editor it's exiting itself (mabye it's some type of crash?) always when it's processing on 4-rd pst file. Here is my code: #include <OutlookEX.au3> #include <Date.au3> #include <File.au3> #include <Array.au3> _cleanOutlook("Administrator") _cleanOutlook("Admin") Exit Func _cleanOutlook($user) $foldery = "Wiadomości-śmieci#?SPAM#?Junk E-mail#?Elementy usunięte#?Deleted Items"$tab_folderow = StringSplit($foldery, "#?", 1)$tab_pst = _FileListToArrayRec("c:\users\" & $user, "*.pst", 1+4+8, 1, 0, 2) ;~ _ArrayDisplay($tab_pst) For $d = 1 To UBound($tab_pst) -1 Step +1 $outlook = _OL_Open(True) _OL_Close($outlook, True) $outlook = _OL_Open() Local$aStores = _OL_StoreGet($outlook) ;~ _ArrayDisplay($aStores) For $i = 1 to$aStores[0][0] If $aStores[$i][4] = True Then ;~ ConsoleWrite(@CRLF & "zamykam pst 2") _OL_PSTClose($outlook,$aStores[$i][0]) EndIf Next ;~ _OL_PSTAccess($outlook, "C:\Users\Administrator\Desktop\cos.pst") _OL_PSTAccess($outlook,$tab_pst[$d]) ConsoleWrite(@CRLF &$tab_pst[$d]) ;~$tab_struktury = _OL_FolderTree($outlook, "*", 10) ;~ If @error Then ;~ ContinueLoop ;~ EndIf ;~ _ArrayDisplay($tab_struktury) $tab_ktory_pst = _OL_PSTGet($outlook) ;~ _ArrayDisplay($tab_ktory_pst) For$a = 0 To UBound($tab_ktory_pst) -1 Step +1 If$tab_ktory_pst[$a][2] =$tab_pst[$d] Then ;~ MsgBox(0, "",$tab_ktory_pst[$a][0])$nazwa_bazy_pst = $tab_ktory_pst[$a][0] EndIf Next ;~ MsgBox(0, "", UBound($tab_folderow)) ;~ _ArrayDisplay($tab_folderow, $tab_pst[$d]) ConsoleWrite(@CRLF & "przed while") $a = 0 While$a < 2 ConsoleWrite(@CRLF & "while 1") For $b = 1 To UBound($tab_folderow) -1 Step +1 ConsoleWrite(@CRLF & "for 1") $tab_struktury = _OL_FolderTree($outlook, $nazwa_bazy_pst) ;~ _ArrayDisplay($tab_struktury, $nazwa_bazy_pst) ;~$folder = _OL_FolderAccess($outlook, StringTrimLeft($tab_struktury[0], 2) & "\" & $tab_folderow[$b]) $folder = _OL_FolderAccess($outlook, $nazwa_bazy_pst & "\" &$tab_folderow[$b]) ;~ ConsoleWrite(@CRLF & "eeee") If @error Then ;~ MsgBox(0, "", "\\" &$nazwa_bazy_pst & "\" & $tab_folderow[$b] & @CRLF & @error) ConsoleWrite(@CRLF & "przechodze do kolejnego " & $b+1) ContinueLoop EndIf ;~ _ArrayDisplay($folder, $nazwa_bazy_pst) ConsoleWrite(@CRLF &$tab_folderow[$b]) If$tab_folderow[$b] = "Deleted Items" Or$tab_folderow[$b] = "Elementy usunięte" Then ConsoleWrite(@CRLF & "usuwam kosze") _OL_FolderDelete($outlook, $folder[1], 1) _OL_FolderDelete($outlook, $folder[1], 2) _OL_FolderDelete($outlook, $folder[1], 3) _OL_FolderDelete($outlook, $folder[1], 4) ;~ _OL_FolderDelete($outlook, $folder[1], 5) EndIf If$a = 0 Then $tab_maile = ""$data_dzis = @YEAR & "/" & @MON & "/" & @MDAY & " 00:00" ;~ $data_dzis = "2017/01/31 00:00"$data_szukana = _DateAdd("D", "-3", $data_dzis)$tab_maile = _OL_ItemFind($outlook,$folder[1], $olMail, "[Received]<'" & StringReplace($data_szukana, "/", "-") & "'", "", "", "EntryID", "", 1) If @error Then ContinueLoop EndIf ;~ If UBound($tab_maile) > 1 Then ;~ _ArrayDisplay($tab_maile) ;~ EndIf If UBound($tab_maile) > 1 Then For$c = 1 To UBound($tab_maile) -1 Step +1 ;~ ConsoleWrite(@CRLF & "usuwam stare maile") _OL_ItemDelete($outlook, $tab_maile[$c][0], "", False) Next EndIf EndIf Next $a =$a + 1 WEnd ;~ ConsoleWrite(@CRLF & "pokazuje") ;~ $folder[1].Display$olFolderInbox.Display ;~ _OL_PSTClose($outlook,$olFolderInbox) ;~ If @error Then ;~ MsgBox(0, "", @error) ;~ EndIf Local $aStores = _OL_StoreGet($outlook) ;~ _ArrayDisplay($aStores) For$i = 1 to $aStores[0][0] If$aStores[$i][4] = True Then ;~ ConsoleWrite(@CRLF & "zamykam pst 1") _OL_PSTClose($outlook,$aStores[$i][0]) EndIf Next ;_OL_PSTClose($outlook,$folder[1]) _OL_Close(\$outlook, True) If @error Then MsgBox(0, "", @error) EndIf ConsoleWrite(@CRLF & "zamykam") ProcessWaitClose("outlook.exe", 30) ProcessClose("outlook.exe") Next EndFunc
Outlook and OS is updated. I'm usinn OutlooEX in ver. 1.3.1.0
Any ideas?

• By Gowrisankar
Dear members of the forum,
I'm new to AutoIt and I'm having a good time exploring and enjoying the features of AutoIt.
For one of my tasks, I've to open few particular mails from outlook based on subject of the mails and then print the mails. Can someone please guide me how to do it?
My question could be very silly for experts. But I'm just a beginner. Kindly advice.
Thanks and regards,
Gowrisankar R.
×

• Wiki