ur Posted February 8, 2017 Posted February 8, 2017 I got a UDF to zip the files from below link. With this I am able to create a zip file but the post processing of zip file creation I am checking the zip file exists or not, but it is giving the message as file not found. Any sugestions?? #include "Zip.au3" ZipLogs() Func ZipLogs() $ResultsFolder = @ScriptDir & "\Results" $ResultsDestFolder = @ScriptDir & "\Results_Archive" $zipFile = $ResultsDestFolder & "\Results_"&TodayDateTime()&".zip" DirCreate($ResultsDestFolder) Dim $Zip = _Zip_Create($zipFile) ;Create The Zip File. Returns a Handle to the zip File _Zip_AddFolderContents($Zip, $ResultsFolder) ;Add a folder's content in the zip file if FileExists(@ScriptDir&"\Logging.log") then _Zip_AddFile($Zip,@ScriptDir&"\Logging.log") FileDelete(@ScriptDir&"\Logging.log") EndIf if FileExists(@ScriptDir&"\RemoteExecution_Log.txt") then _Zip_AddFile($Zip,@ScriptDir&"\RemoteExecution_Log.txt") FileDelete(@ScriptDir&"\RemoteExecution_Log.txt") EndIf if FileExists($zipFile) then DirRemove($ResultsFolder,$DIR_REMOVE) Else MsgBox(0,"","Zip file not found") EndIf return $zipFile EndFunc Zip.au3
water Posted February 8, 2017 Posted February 8, 2017 The _ZIP* functions set macro @error when there was a problem. So you should check this macro after having called a _ZIP* function. My UDFs and Tutorials: Spoiler UDFs: Active Directory (NEW 2024-07-28 - Version 1.6.3.0) - Download - General Help & Support - Example Scripts - Wiki ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki Task Scheduler (2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs: Excel - Example Scripts - Wiki Word - Wiki Tutorials: ADO - Wiki WebDriver - Wiki
ur Posted February 8, 2017 Author Posted February 8, 2017 @water Sorry the info is not correct earlier, the file is able to detect with file exists. But when I pass that file name to the below code. Dim $zip_file = ZipLogs() if FileExists($zip_file) then MsgBox(0,"",$zip_file) SendAutoMail("AutoIT:Install Testing Process","Testing of Installers completed","PFA: attached log files",$zip_file) Else SendAutoMail("AutoIT:Install Testing Process","Testing of Installers completed","Log files not found to attach") EndIf It is able to go the first branch of code as I am able to get the message prompt. But I am not getting any email. SendMail.au3 I am able to get the mail if I pass some other attachments for testing. Can you suggest for this.
water Posted February 8, 2017 Posted February 8, 2017 What I posted above is true for SendAutoMail as well. Check @error or the return value. My UDFs and Tutorials: Spoiler UDFs: Active Directory (NEW 2024-07-28 - Version 1.6.3.0) - Download - General Help & Support - Example Scripts - Wiki ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki Task Scheduler (2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs: Excel - Example Scripts - Wiki Word - Wiki Tutorials: ADO - Wiki WebDriver - Wiki
ur Posted February 8, 2017 Author Posted February 8, 2017 11 minutes ago, water said: What I posted above is true for SendAutoMail as well. Check @error or the return value. I am getting the @error value as 2. And the 2 is at the codeblock $objEmail.Send If @error Then SetError(2) Return $oMyRet[1] EndIf Any idea??How to resolve this.??
water Posted February 8, 2017 Posted February 8, 2017 (edited) Please search the forum for _INetSmtpMailCom. IIRC this has beend discussed multiple times. Edited February 8, 2017 by water My UDFs and Tutorials: Spoiler UDFs: Active Directory (NEW 2024-07-28 - Version 1.6.3.0) - Download - General Help & Support - Example Scripts - Wiki ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki Task Scheduler (2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs: Excel - Example Scripts - Wiki Word - Wiki Tutorials: ADO - Wiki WebDriver - Wiki
ur Posted February 8, 2017 Author Posted February 8, 2017 @water , YeahI tried many links but no resolution for this. THe error I am getting at the send method.
water Posted February 8, 2017 Posted February 8, 2017 Add a COM error handler to your script to get more detailed error information. Easiest way is to use the Debug UDF: #include <Debug.au3> _DebugSetup() _DebugCOMError() ... Your script goes here ... My UDFs and Tutorials: Spoiler UDFs: Active Directory (NEW 2024-07-28 - Version 1.6.3.0) - Download - General Help & Support - Example Scripts - Wiki ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki Task Scheduler (2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs: Excel - Example Scripts - Wiki Word - Wiki Tutorials: ADO - Wiki WebDriver - Wiki
ur Posted February 9, 2017 Author Posted February 9, 2017 When I tried to pass the zip file to the mail function after the zipping is done, it is giving return code 2. But if I try again as a separate au3 file by sending the zip file as argument later, it is sending. So I tried whether file is in use or not by below code but I am geting the second message stating that file is not in use. #include "SendMail.au3" $f = @TempDir&"\logs.zip" $filename = $f if FileInUse($filename) Then MsgBox(0, "", "File is in use") Else MsgBox(0, "", "Not in use - go nuts") SendAutoMail("AutoIT:Install Testing Process","Testing of Installers completed","PFA: attached log files",$f) EndIf ;SendAutoMail("AutoIT:Install Testing Process","Got the Installers","Will intimate once the process is completed",$f) ;SendAutoMail("AutoIT:Install Testing Process","Testing of Installers completed","PFA: attached log files",$f) Func FileInUse($filename) $handle = FileOpen($filename, 1) $result = False if $handle = -1 then $result = True FileClose($handle) return $result EndFunc Any idea??
ur Posted February 9, 2017 Author Posted February 9, 2017 @water , YeahI tried many links but no resolution for this. I am getting below error while sending mail.. --------------------------- sendmail error: 2 --------------------------- The message could not be sent to the SMTP server. The transport error code was 0x80040217. The server response was not available --------------------------- OK --------------------------- I have already enabled less secure app setting in gmail.
water Posted February 9, 2017 Posted February 9, 2017 Searching the web for "SMTP transport error code 0x80040217" returns a lot of hits. One names a wrong username/password as the culprit.http://stackoverflow.com/questions/9157087/getting-error-transport-error-code-was-0x80040217-while-sending-email-in-asp-net My UDFs and Tutorials: Spoiler UDFs: Active Directory (NEW 2024-07-28 - Version 1.6.3.0) - Download - General Help & Support - Example Scripts - Wiki ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki Task Scheduler (2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs: Excel - Example Scripts - Wiki Word - Wiki Tutorials: ADO - Wiki WebDriver - Wiki
ur Posted February 9, 2017 Author Posted February 9, 2017 But I am able to send mails at the start of the program...Once I process everything at the end am getting this error for sending mail at process completion.
water Posted February 9, 2017 Posted February 9, 2017 Can you verify that all variables still have the correct value before sending? I once re-used a variable for something different and hence a function call crashed. My UDFs and Tutorials: Spoiler UDFs: Active Directory (NEW 2024-07-28 - Version 1.6.3.0) - Download - General Help & Support - Example Scripts - Wiki ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki Task Scheduler (2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs: Excel - Example Scripts - Wiki Word - Wiki Tutorials: ADO - Wiki WebDriver - Wiki
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