Jump to content

2 Screenshots

About This File

I want to present POP3.au3 UDF.

Support topic is here: POP3.au3 UDF

Quote

    Original UDF:
   http://www.autoitscript.com/forum/index.php?showtopic=22838
    Basic functions for AU3 Scripts, based on the 1939 RFC ( http://www.ietf.org/rfc/rfc1939.txt ).
    Author : Apzo - Luc HENNINOT <lhenninot@nordnet.fr>
    Modified : Thorsten Willert (thorsten [dot] willert [at] gmx [dot] de)

    2015/02/09 ver. 1.0.0
    Modified : mLipok   http://www.autoitscript.com/forum/user/10673-mlipok/
    (Function names Changed, Variables names Changed, added new functions, added Quoted-printable.au3, Script CleanUp, $g__bPOP3_TRACE and $g__vPOP3_ISCONNECTED Removed)
    Requires AU3 v3.3.10.2+ and UDF: Quoted-printable.au3
 

 

REMARK:
Quoted-printable.au3 author @ProgAndy
https://autoit.de/index.php/Thread/11350-UTF8-Sting-Convertieren/?postID=87721#post87721

 


What's New in Version 2.0.1

Released

Quote

    2016/05/04 ver. 2.0.1
    .    Renamed:     UDF:    _POP3_Ex.au3 >> POP3.au3 - mLipok
    .    Renamed:     Var:    $g__iPOP3_SOCKET >> $__g_iPOP3_SOCKET - mLipok
    .    Renamed:     Var:    $POP3_OK >> $POP3_REGEXP_OK - mLipok
    .    New:         Var:    $POP3_REGEXP_ERR - mLipok
    .    New:         Var:    $POP3_REGEXP_PASS - mLipok
    .    New:         Var:    $POP3_CALLBACK_COMMAND - mLipok
    .    New:         Var:    $POP3_CALLBACK_STATUS - mLipok
    .    Renamed:     Enums:     $POP3_ERROR_* >> $POP3_ERR_* - mLipok
    .    Renamed:     Enum:     $POP3_ERR_OK >> $POP3_ERR_SUCCESS - mLipok
    .    Renamed:     Enum:     $POP3_ERR >> $POP3_ERR_GENERAL - mLipok
    .    Renamed:     Enum:     $POP3_ERR_SERVER_RESPONSE_TIMEOUT >> $POP3_ERR_TIMEOUT - mLipok
    .    Renamed:     Enum:     $POP3_ERR_TCPRECV_TIMEOUT >> $POP3_ERR_TIMEOUT - mLipok
    .    Renamed:     Enum:     $POP3_ERR_TCPCONNECT_FAILED >> $POP3_ERR_TCPCONNECT - mLipok
    .    New:         Enum:     $POP3_ERR_TCPSTARTUP - mLipok
    .    New:         Enum:     $POP3_ERR_SSL - mLipok
    .    New:         Enum:     $POP3_EXT_CONNECTED - mLipok
    .    New:         Enum:     $POP3_ERR_TCPRECV - mLipok
    .    New:        Func:     _POP3_UDFVersion - mLipok
    .    Removed:     Enum:     $POP3_ERR_ALREADY_CONNECTED --> Check for $POP3_EXT_CONNECTED - mLipok
    .    Removed:     Enum:     $POP3_ERR_NO_TCP_RESPONSE - is no longer used - mLipok
    .    Removed:     Enum:     $POP3_ERR_NO_OK_RESPONSE - is no longer used - mLipok
    .    Renamed:     Func:    __POP3_Cmd >> __POP3_SendCommand - mLipok
    .    Renamed:     Func:    _POP3_ConsoleDebug >> _POP3_Callback - mLipok
    .    Renamed:     Func:    _POP3_ConsoleError >> _POP3_CallbackError - mLipok
    .    Removed:     Func:    _POP3_CallbackSatus --> _POP3_Callback(FirstClassFunction) - mLipok
    .    Renamed:     Func:    _POP3_ServerIsConnected >> _POP3_IsConnected - mLipok
    .    Renamed:     Func:    _POP3_ServerIsAuth >> _POP3_IsAuthorized - mLipok
    .    Removed:    Func:     _POP3_CallbackFunction - mLipok
    .    Refactored: Func:    _POP3_IsConnected - mLipok
    .    Refactored: Func:    _POP3_IsAuthorized - mLipok
    .    Refactored: Func:     _POP3_RFC_... Functions: Finally correctly reporting: $POP3_ERR_**_REFUSED - mLipok
    .    Refactored: Func:     All faunction - mLipok
    .                If _POP3_IsAuthorized() Then  >>> checking @error
    .    Refactored: Func:    @error handling almost all functions - mLipok
    .                If @error Then Return SetError(@error, @extended, .......
    .    Refactored:    Var:    Magic Number replaced with Const/Enums - mLipok
 

 


User Feedback

You may only provide a review once you have downloaded the file.

There are no reviews to display.

  • Similar Content

    • By mLipok
      This UDF was created to facilitate the saving and reading of email configuration.
      Thanks to @water, @jchd, @Jos for helping in translation of _EmailConfig_GUI_Preset_**()
      Hope to have _EmailConfig_GUI_Preset_ES() version soon.

      If you want to create your national version of _EmailConfig_GUI_Preset_**() please do not hesitate ... contribute.
      _EmailConfig_GUI_Preset_EN() is translated by me and Google Translator (from my national Polish language), so if you have any fix for this please do not hesitate ... contribute.
       
      The EmailConfig_Example_STMP_Mailer.au3   is using modified version of Jos SMTP Mailer UDF
       
      #AutoIt3Wrapper_UseX64=N #AutoIt3Wrapper_Run_AU3Check=Y #AutoIt3Wrapper_Au3Check_Parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6 -w 7 #Tidy_Parameters=/sort_funcs /reel #include <Array.au3> #include <AutoItConstants.au3> #include <ButtonConstants.au3> #include <ComboConstants.au3> #include <Crypt.au3> #include <EditConstants.au3> #include <File.au3> #include <GUIConstantsEx.au3> #include <StaticConstants.au3> #include <WindowsConstants.au3> #include "EmailConfig.au3" #include "GDPR.au3" ; https://www.autoitscript.com/forum/files/file/509-gdpr/ Global $oMyRet[2] #Region - EXAMPLE _MY_EXAMPLE__EmailConfig() Func _MY_EXAMPLE__EmailConfig() _GDPR_Crypter_Wrapper(_EmailConfig_ExampleCrypter) _EmailConfig_GUI_Preset_EN() ;~ _EmailConfig_GUI_Preset_DE() ;~ _EmailConfig_GUI_Preset_FR() ;~ _EmailConfig_GUI_Preset_NL() ;~ _EmailConfig_GUI_Preset_PL() _EmailConfig_SaveWrapper(_EmailConfig_SaveToINI) _EmailConfig_LoadWrapper(_EmailConfig_LoadFromINI) _EmailConfig_LoadWrapper() If $IDYES = MsgBox($MB_YESNO + $MB_TOPMOST + $MB_ICONQUESTION + $MB_DEFBUTTON1, 'Question #' & @ScriptLineNumber, _ 'Do you want to set email configuration ?') Then _EmailConfig_ShowGUI() EndIf Local $s_ToAddress = 'whereisyourdestination@your.email.com' Local $s_Subject = 'Testing email sending : ' & @YEAR & @MON & @MDAY & ' ' & @HOUR & @MIN & @SEC Local $s_Body = 'This is only a test' Local $s_Attachments = '' _SMTP_SendEmail_Example($s_ToAddress, $s_Subject, $s_Body, $s_Attachments) EndFunc ;==>_MY_EXAMPLE__EmailConfig Func _EmailConfig_ExampleCrypter($dBinaryData, $bDataAlreadyEncrypted) _Crypt_Startup() ; Start the Crypt library. Local $dResult If $bDataAlreadyEncrypted Then $dResult = _Crypt_DecryptData($dBinaryData, 'securepassword', $CALG_AES_256) ; Decrypt the data using the generic password string. The return value is a binary string. Else $dResult = _Crypt_EncryptData($dBinaryData, 'securepassword', $CALG_AES_256) ; Encrypt the text with the new cryptographic key. EndIf _Crypt_Shutdown() ; Shutdown the Crypt library. Return $dResult EndFunc ;==>_EmailConfig_ExampleCrypter #EndRegion - EXAMPLE ; ; The UDF Func _INetSmtpMailCom($s_SmtpServer, $s_FromName, $s_FromAddress, $s_ToAddress, $s_Subject = "", $as_Body = "", $s_AttachFiles = "", $s_CcAddress = "", $s_BccAddress = "", $s_Importance = "Normal", $s_Username = "", $s_Password = "", $IPPort = 25, $ssl = 0, $tls = 0) Local $oCOM_Error_Handler = ObjEvent("AutoIt.Error", "MyErrFunc") #forceref $oCOM_Error_Handler Local $objEmail = ObjCreate("CDO.Message") $objEmail.From = '"' & $s_FromName & '" <' & $s_FromAddress & '>' $objEmail.To = $s_ToAddress Local $i_Error = 0 #forceref $i_Error Local $i_Error_desciption = "" #forceref $i_Error_desciption If $s_CcAddress <> "" Then $objEmail.Cc = $s_CcAddress If $s_BccAddress <> "" Then $objEmail.Bcc = $s_BccAddress $objEmail.Subject = $s_Subject If StringInStr($as_Body, "<") And StringInStr($as_Body, ">") Then $objEmail.HTMLBody = $as_Body Else $objEmail.Textbody = $as_Body & @CRLF EndIf If $s_AttachFiles <> "" Then Local $S_Files2Attach = StringSplit($s_AttachFiles, ";") For $x = 1 To $S_Files2Attach[0] $S_Files2Attach[$x] = _PathFull($S_Files2Attach[$x]) ;~ ConsoleWrite('@@ Debug : $S_Files2Attach[$x] = ' & $S_Files2Attach[$x] & @LF & '>Error code: ' & @error & @LF) ;### Debug Console If FileExists($S_Files2Attach[$x]) Then ConsoleWrite('+> File attachment added: ' & $S_Files2Attach[$x] & @LF) $objEmail.AddAttachment($S_Files2Attach[$x]) Else ConsoleWrite('!> File not found to attach: ' & $S_Files2Attach[$x] & @LF) SetError(1) Return 0 EndIf Next EndIf $objEmail.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2 $objEmail.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/smtpserver") = $s_SmtpServer If Number($IPPort) = 0 Then $IPPort = 25 $objEmail.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/smtpserverport") = $IPPort ; Authenticated SMTP If $s_Username <> "" Then $objEmail.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate") = 1 $objEmail.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/sendusername") = $s_Username $objEmail.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/sendpassword") = $s_Password EndIf ; Set security params If $ssl Then $objEmail.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/smtpusessl") = True If $tls Then $objEmail.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/sendtls") = True ; Update settings $objEmail.Configuration.Fields.Update ; Set Email Importance Switch $s_Importance Case "High" $objEmail.Fields.Item("urn:schemas:mailheader:Importance") = "High" Case "Normal" $objEmail.Fields.Item("urn:schemas:mailheader:Importance") = "Normal" Case "Low" $objEmail.Fields.Item("urn:schemas:mailheader:Importance") = "Low" EndSwitch $objEmail.Fields.Update ; Sent the Message $objEmail.Send If @error Then SetError(2) Return $oMyRet[1] EndIf $objEmail = "" EndFunc ;==>_INetSmtpMailCom Func _SMTP_SendEmail_Example($s_ToAddress, $s_Subject, $s_Body, $s_Attachments) #Tidy_ILC_Pos=120 Local $aEMAIL_CONFIG = __EmailConfig__API() Local $SmtpServer = $aEMAIL_CONFIG[$EMAIL_CONFIG__22__SMTP_SERVER_NAME][$EMAIL_CONFIG__COL3_SAVELOAD_VALUE] ; address for the smtp-server to use - REQUIRED Local $FromName = $aEMAIL_CONFIG[$EMAIL_CONFIG__02__COMMON_NAME][$EMAIL_CONFIG__COL3_SAVELOAD_VALUE] ; name from who the email was sent Local $FromAddress = $aEMAIL_CONFIG[$EMAIL_CONFIG__03__EMAIL_ADDRESS][$EMAIL_CONFIG__COL3_SAVELOAD_VALUE] ; address from where the mail should come Local $ToAddress = $s_ToAddress ; destination address of the email - REQUIRED Local $Subject = $s_Subject ; subject from the email - can be anything you want it to be Local $Body = $s_Body ; the messagebody from the mail - can be left blank but then you get a blank mail Local $AttachFiles = $s_Attachments ; the file(s) you want to attach seperated with a ; (Semicolon) - leave blank if not needed Local $CcAddress = "" ; address for cc - leave blank if not needed Local $BccAddress = "" ; address for bcc - leave blank if not needed Local $Importance = "Normal" ; Send message priority: "High", "Normal", "Low" Local $Username = $aEMAIL_CONFIG[$EMAIL_CONFIG__20__SMTP_USER_NAME][$EMAIL_CONFIG__COL3_SAVELOAD_VALUE] ; username for the account used from where the mail gets sent - REQUIRED Local $Password = $aEMAIL_CONFIG[$EMAIL_CONFIG__21__SMTP_PASSWORD][$EMAIL_CONFIG__COL3_SAVELOAD_VALUE] ; password for the account used from where the mail gets sent - REQUIRED Local $IPPort = $aEMAIL_CONFIG[$EMAIL_CONFIG__23__SMTP_PORT_NUMBER][$EMAIL_CONFIG__COL3_SAVELOAD_VALUE] ; port used for sending the mail ; in many country port 25 is not recomended, in such case use 587 instead Local $ssl = 0 ; enables/disables secure socket layer sending - put to 1 if using httpS Local $tls = 0 ; enables/disables TLS when required ;~ Local $IPPort = 465 ; GMAIL port used for sending the mail ;~ Local $ssl = 1 ; GMAIL enables/disables secure socket layer sending - put to 1 if using httpS Local $rc = _INetSmtpMailCom($SmtpServer, $FromName, $FromAddress, $ToAddress, $Subject, $Body, $AttachFiles, $CcAddress, $BccAddress, $Importance, $Username, $Password, $IPPort, $ssl, $tls) If @error Then MsgBox(0, "Error sending email", "Error code: " & @error & @CRLF & "Description: " & $rc) EndIf EndFunc ;==>_SMTP_SendEmail_Example ; ; ; Com Error Handler Func MyErrFunc(ByRef $oMyError) Local $HexNumber = Hex($oMyError.number, 8) $oMyRet[0] = $HexNumber $oMyRet[1] = StringStripWS($oMyError.description, 3) ConsoleWrite("### COM Error ! Number: " & $HexNumber & " ScriptLine: " & $oMyError.scriptline & " Description:" & $oMyRet[1] & @LF) SetError(1) ; something to check for when this function returns Return EndFunc ;==>MyErrFunc  

       
      EmailConfig.au3 EmailConfig_Example_STMP_Mailer.au3
    • By mLipok
      This is modest beginning for UDF Chilkat component:
      https://www.chilkatsoft.com/downloads_ActiveX.asp
      Some of AcitveX object bundled into this component (dll file) are Free (you can verify it here), some other are commercial.
      You can downolad this UDF here:
      ; #INDEX# ======================================================================== ; Title .........: Chilkat.au3 ; AutoIt Version : 3.3.10.2++ ; Language ......: English ; Description ...: A collection of Function for use with Chilkat component ; Author ........: mLipok ; Modified ......: ; URL ...........: https://www.chilkatsoft.com/refdoc/activex.asp ; URL ...........: https://www.chilkatsoft.com/downloads_ActiveX.asp ; Date ..........: 2017/02/01 ; Version .......: 0.1.1 BETA - Work in progress ; ================================================================================ #cs 2017/02/01 . First official version - mLipok #ce http://www.chilkatforum.com/questions/1306/is-the-chilkat-upload-component-freeware
       
      Examples:
       
      #AutoIt3Wrapper_Au3Check_Parameters=-d -w 1 -w 2 -w 3 -w- 4 -w 5 -w 6 -w 7 ;~ #AutoIt3Wrapper_Run_Debug_Mode=Y #Tidy_Parameters=/sort_funcs /reel #include <Array.au3> #include <StringConstants.au3> #include "Chilkat.au3" _Example() Func _Example() _ErrorLog_ChilkatWrapper(ConsoleWrite) _Chilkat_StartUp(@ScriptDir & '\ChilkatAx-9.5.0-win32.dll') _Chilkat_DllVersion($CHILKATOBJ_VERSION_950) Local $oGLOBAL = _Chilkat_GLOBAL_ObjCreate() If @error Then MsgBox($MB_ICONERROR, 'GLOBAL Declartion', '@error = ' & @error & @CRLF & '@extended = ' & @extended) _Chilkat_GLOBAL_UnlockBundle($oGLOBAL, "Anything for 30-day trial") If @error Then MsgBox($MB_ICONERROR, 'UnlockBundle', '@error = ' & @error & @CRLF & '@extended = ' & @extended) ; Just comment / uncomment one of this followin Examples functions: ;~ _Example_12_JsonObject_PrettyPrint() ;~ _Example_13_JsonObject_IterateMembers() ;~ _Example_14_JsonObject_CreateDocument() ;~ _Example_15_CSV_ColumnNames() ;~ _Example_16_CSV_ToArray() _Example_17_CSV_ToArray('(?i).*?Pierwszy.*?Urz.*?Skarb.*?', '(?i).*Katowice.*?') EndFunc ;==>_Example Func _Example_12_JsonObject_PrettyPrint() _Log_ChilkatExample('_Example_12_JsonObject_PrettyPrint') ; https://www.example-code.com/vbscript/json_pretty_print.asp Local $oJSON = _Chilkat_JSON_ObjCreate() If @error Then Return SetError(@error, @extended, $CHILKAT_RET_FAILURE) Local $sJSON_String = "{""name"": ""donut"",""image"":{""fname"": ""donut.jpg"",""w"": 200,""h"": 200},""thumbnail"":{""fname"": ""donutThumb.jpg"",""w"": 32,""h"": 32}}" Local $iSuccess = $oJSON.Load($sJSON_String) If ($iSuccess <> 1) Then ConsoleWrite($oJSON.LastErrorText & @CRLF) Return SetError(@error, @extended, $CHILKAT_RET_FAILURE) EndIf ; To pretty-print, set the EmitCompact property equal to 0 $oJSON.EmitCompact = 0 ; If bare-LF line endings are desired, turn off EmitCrLf ; Otherwise CRLF line endings are emitted. $oJSON.EmitCrLf = 0 ; Emit the formatted JSON: ConsoleWrite($oJSON.Emit() & @CRLF) EndFunc ;==>_Example_12_JsonObject_PrettyPrint Func _Example_13_JsonObject_IterateMembers() _Log_ChilkatExample('_Example_13_JsonObject_IterateMembers') ; https://www.example-code.com/vbscript/json_iterate_members.asp Local $oJSON = _Chilkat_JSON_ObjCreate() If @error Then Return SetError(@error, @extended, $CHILKAT_RET_FAILURE) Local $sJSON_String = "{ ""id"": 1, ""name"": ""A green door"", ""tags"": [""home"", ""green""], ""price"": 125 }" Local $iSuccess = $oJSON.Load($sJSON_String) If ($iSuccess <> 1) Then ConsoleWrite($oJSON.LastErrorText & @CRLF) Return SetError($CHILKAT_ERR_LOAD, @extended, $CHILKAT_RET_FAILURE) EndIf Local $sName = '', $sValue = '' Local $iNumMembers = $oJSON.Size, $iValue = 0 For $iMember_idx = 0 To $iNumMembers - 1 $sName = $oJSON.NameAt($iMember_idx) $sValue = $oJSON.StringAt($iMember_idx) ConsoleWrite($sName & ": " & $sValue & @CRLF) $iValue = $oJSON.IntAt($iMember_idx) ConsoleWrite($sName & " as integer: " & $iValue & @CRLF) Next EndFunc ;==>_Example_13_JsonObject_IterateMembers Func _Example_14_JsonObject_CreateDocument() _Log_ChilkatExample('_Example_14_JsonObject_CreateDocument') ; https://www.example-code.com/vbscript/create_json.asp Local $oJSON = _Chilkat_JSON_ObjCreate() If @error Then Return SetError(@error, @extended, $CHILKAT_RET_FAILURE) Local $iSuccess $iSuccess = $oJSON.AddStringAt(-1, "Title", "Pan's Labyrinth") ConsoleWrite("- $iSuccess=" & $iSuccess & @CRLF) $iSuccess = $oJSON.AddStringAt(-1, "Director", "Guillermo del Toro") ConsoleWrite("- $iSuccess=" & $iSuccess & @CRLF) $iSuccess = $oJSON.AddStringAt(-1, "Original_Title", "El laberinto del fauno") ConsoleWrite("- $iSuccess=" & $iSuccess & @CRLF) $iSuccess = $oJSON.AddIntAt(-1, "Year_Released", 2006) ConsoleWrite("- $iSuccess=" & $iSuccess & @CRLF) $oJSON.EmitCompact = 0 ConsoleWrite($oJSON.Emit() & @CRLF) EndFunc ;==>_Example_14_JsonObject_CreateDocument Func _Example_15_CSV_ColumnNames() _Log_ChilkatExample('_Example_15_CSV_ColumnNames') ; https://www.example-code.com/vbscript/csv_columnNames.asp Local $sURL = 'http://www.chilkatsoft.com/testData/sample.csv' InetGet($sURL, @ScriptDir & '\sample.csv') Local $oCSV = _Chilkat_CSV_ObjCreate() If @error Then Return SetError(@error, @extended, $CHILKAT_RET_FAILURE) ; Prior to loading the CSV file, indicate that the 1st row ; should be treated as column names: $oCSV.HasColumnNames = 1 ; Load the $oCSV records from the file: Local $iSuccess = $oCSV.LoadFile(@ScriptDir & "\sample.csv") If ($iSuccess <> 1) Then ConsoleWrite($oCSV.LastErrorText & @CRLF) Return SetError($CHILKAT_ERR_LOADFILE, @extended, $CHILKAT_RET_FAILURE) EndIf Local $iIndex = 0 Local $sColName = '' ; Display the column names: For $iCol_idx = 0 To $oCSV.NumColumns - 1 $sColName = $oCSV.GetColumnName($iCol_idx) ConsoleWrite($iCol_idx & ": " & $sColName & @CRLF) ; The following line demonstrates to to get the column ; index given a column name: $iIndex = $oCSV.GetIndex($sColName) ConsoleWrite($sColName & " is at column index " & $iIndex & @CRLF) Next EndFunc ;==>_Example_15_CSV_ColumnNames Func _Example_16_CSV_ToArray() _Log_ChilkatExample('_Example_16_CSV_ToArray') Local $sURL = 'http://www.chilkatsoft.com/testData/sample.csv' InetGet($sURL, @ScriptDir & '\sample.csv') Local $oCSV = _Chilkat_CSV_ObjCreate() If @error Then Return SetError(@error, @extended, $CHILKAT_RET_FAILURE) ; Prior to loading the CSV file, indicate that the 1st row ; should be treated as column names: $oCSV.HasColumnNames = 1 ; Load the $oCSV records from the file: Local $iSuccess = $oCSV.LoadFile(@ScriptDir & "\sample.csv") If ($iSuccess <> 1) Then ConsoleWrite($oCSV.LastErrorText & @CRLF) Return SetError($CHILKAT_ERR_LOADFILE, @extended, $CHILKAT_RET_FAILURE) EndIf Local $iNumColumns = $oCSV.NumColumns Local $iNumRows = $oCSV.NumRows Local $aResult[$iNumRows + 1][$iNumColumns] ; First get the column names For $iCol_idx = 0 To $iNumColumns - 1 $aResult[0][$iCol_idx] = $oCSV.GetColumnName($iCol_idx) Next For $iRow_idx = 0 To $iNumRows - 1 For $iCol_idx = 0 To $iNumColumns - 1 $aResult[$iRow_idx + 1][$iCol_idx] = $oCSV.GetCell($iRow_idx, $iCol_idx) Next Next _ArrayDisplay($aResult, '$aResult') EndFunc ;==>_Example_16_CSV_ToArray Func _Example_17_CSV_ToArray($sName_RegExpPattern, $sCity_RegExpPattern) _Log_ChilkatExample('_Example_16_CSV_ToArray') ; https://www.example-code.com/vbscript/csv_columnNames.asp Local $sURL = 'https://epuap.gov.pl/wps/wcm/connect/61e062b9-d981-4526-9f63-c2569263775a/RESP_2016-10-07.csv?MOD=AJPERES' InetGet($sURL, @ScriptDir & '\ePUAP.csv') ConsoleWrite("- Download completed" & @CRLF) Local $oCSV = _Chilkat_CSV_ObjCreate() If @error Then Return SetError(@error, @extended, $CHILKAT_RET_FAILURE) ; Prior to loading the CSV file, indicate that the 1st row ; should be treated as column names: $oCSV.HasColumnNames = 1 ; Load the $oCSV records from the file: Local $sCSVContent = FileRead(@ScriptDir & "\ePUAP.csv") ConsoleWrite("- Load File completed" & @CRLF) Local $iSuccess = $oCSV.LoadFromString($sCSVContent) If ($iSuccess <> 1) Then ConsoleWrite($oCSV.LastErrorText & @CRLF) Return SetError($CHILKAT_ERR_LOADFILE, @extended, $CHILKAT_RET_FAILURE) EndIf ConsoleWrite("- LoadFromString completed" & @CRLF) Local $iNumColumns = $oCSV.NumColumns Local $iNumRows = $oCSV.NumRows Local $aResult[$iNumRows + 1][$iNumColumns] ; First get the column names For $iCol_idx = 0 To $iNumColumns - 1 $aResult[0][$iCol_idx] = $oCSV.GetColumnName($iCol_idx) Next Local $iResult_RowCount = 1 ; First is ColumnName For $iRow_idx = 0 To $iNumRows - 1 If _ StringRegExp($oCSV.GetCell($iRow_idx, 0), $sName_RegExpPattern, $STR_REGEXPMATCH) _ And _ StringRegExp($oCSV.GetCell($iRow_idx, 4), $sCity_RegExpPattern, $STR_REGEXPMATCH) _ Then For $iCol_idx = 0 To $iNumColumns - 1 $aResult[$iResult_RowCount][$iCol_idx] = $oCSV.GetCell($iRow_idx, $iCol_idx) Next $iResult_RowCount += 1 EndIf Next ; strip array size to Number of founds rows ReDim $aResult[$iResult_RowCount][$iNumColumns] ConsoleWrite("- Parsing completed" & @CRLF) _ArrayDisplay($aResult, '$aResult') EndFunc ;==>_Example_17_CSV_ToArray Func _Log_ChilkatExample($sData) ConsoleWrite('>+ ' & $sData & @CRLF) EndFunc ;==>_Log_ChilkatExample  
      REMARK:
      This UDF is a continuation of this thread:
       
    • By mLipok
      Here I found a usefull UDF for POP3.
      I modified this UDF.
      You can download it from download section.


      Below you see old description:
       
    • By cdeb
      As for the object, in this case the StringReplace() function does not work for me.
      These are my steps:
      1) Extract the subject from an EML file.
       (the first character is an emoji )
      source from EML file: 
      $sSubject = "?utf-8?B?8J+TiCA1IG9mIHRoZSBCZXN0IFN0b2NrcyB0byBCdXkgZm9yIERlY2VtYmVy?=" 2) in this case I perform a decoding with _QuotedPrintable_DecodeEncodedWord()
      output is: 
      $sSubject = "?? 5 of the Best Stocks to Buy for December"  
      3) I perform StringReplace():
      $sSubject = StringReplace($sSubject, "??", "") or
      $sSubject = StringReplace($sSubject, Chr(63)&Chr(63), "")  
      But the characters ?? they are not replaced.
       
      Yet if I make an Asc of every character of the string with a for loop, are the first two characters really? that is 63
      For cycle
              Local $aArray = StringSplit($sSubject, "", $STR_NOCOUNT)         For $i = 0 To UBound($aArray)-1             ConsoleWrite($aArray[$i] & " - " & Asc($aArray[$i])& @CR)         Next Output:        
      ? - 63
      ? - 63
        - 32
      5 - 53
        - 32
      o - 111
      f - 102
        - 32
      t - 116
      h - 104
      e - 101
        - 32
      Does anyone have an explanation of why it doesn't work?
      Thank you all
       
    • By mLipok
      This is modified version of Jos "Smtp Mailer That Supports Html And Attachments"
       
      Support topic is here:
       

       
×
×
  • Create New...