Jump to content
mLipok

Chilkatsoft Component Example

Recommended Posts

mLipok
I played around a little with http://www.chilkatsoft.com/ ActiveX components.
Here is an example based on examples from this page.
 
#include <FileConstants.au3>
#include <MsgBoxConstants.au3>


;~ http://www.chilkatsoft.com/downloads_ActiveX.asp
;~ http://www.chilkatsoft.com/support.asp
;~ http://www.chilkatsoft.com/refdoc/activex.asp
;~ http://www.chilkatsoft.com/refdoc/xChilkatCertStoreRef.html
;~ http://www.chilkatsoft.com/refdoc/xChilkatCertChainRef.html

;~ Email ActiveX Reference Documentation
;~ http://www.chilkatsoft.com/refdoc/xChilkatEmailRef.html

;~ http://www.example-code.com/vbscript/emailObj.asp
;~ http://www.example-code.com/vbscript/pop3.asp

Global $_sPOP3_Server = 'xxxxxx'
Global $_sPOP3_UserName = 'xxxxxx'
Global $_sPOP3_Password = 'xxxxxx'

_Example_1_Version()
_Example_2_Get_number_of_mesages()
_Example_3_Retrieve_UIDLs_from_POP3_Server()
_Example_4_Save_Email_Attachments_to_Filesystem()

Func _Example_1_Version()
    Local $oCrypt = ObjCreate("Chilkat_9_5_0.Crypt2")
    MsgBox(0, '', $oCrypt.Version)

EndFunc   ;==>_Example_1_Version

Func _Example_2_Get_number_of_mesages()
    ; http://www.example-code.com/vbscript/pop3_mailboxCount.asp
    ;  The mailman object is used for receiving (POP3)
    ;  and sending (SMTP) email.
    ; This ObjCreate statement uses the new single-DLL ActiveX for v9.5.0
    Local $oMailman = ObjCreate("Chilkat_9_5_0.MailMan")

    ;  Any string argument automatically begins the 30-day trial.
    $success = $oMailman.UnlockComponent("30-day trial")
    If ($success <> 1) Then
        MsgBox(0, 'UnlockComponent', $oMailman.LastErrorText)
        Return
    EndIf

    ;  Set the POP3 server's hostname
    $oMailman.MailHost = $_sPOP3_Server

    ;  Set the POP3 login/password.
    $oMailman.PopUsername = $_sPOP3_UserName
    $oMailman.PopPassword = $_sPOP3_Password

    ;  Get the number of messages in the mailbox.

    Local $iNumMessages = $oMailman.GetMailboxCount()
    MsgBox(0, '', $iNumMessages)

EndFunc   ;==>_Example_2_Get_number_of_mesages

Func _Example_3_Retrieve_UIDLs_from_POP3_Server()
    ; Retrieve UIDL's from POP3 Server
    ; http://www.example-code.com/vbscript/pop3_getUidls.asp

    ;  The mailman object is used for receiving (POP3)
    ;  and sending (SMTP) email.
    ; This ObjCreate statement uses the new single-DLL ActiveX for v9.5.0
    Local $oMailman = ObjCreate("Chilkat_9_5_0.MailMan")

    ;  Any string argument automatically begins the 30-day trial.
    $success = $oMailman.UnlockComponent("30-day trial")
    If ($success <> 1) Then
        MsgBox(0, 'UnlockComponent', $oMailman.LastErrorText)
        Return
    EndIf

    ;  Set the POP3 server's hostname
    $oMailman.MailHost = $_sPOP3_Server

    ;  Set the POP3 login/password.
    $oMailman.PopUsername = $_sPOP3_UserName
    $oMailman.PopPassword = $_sPOP3_Password

    ; sa is a Chilkat_9_5_0.StringArray
    Local $oSA = $oMailman.GetUidls()

    Local $iCount = $oSA.Count

    For $i = 0 To $iCount - 1
        ConsoleWrite($oSA.GetString($i) & @CRLF)
    Next

EndFunc   ;==>_Example_3_Retrieve_UIDLs_from_POP3_Server

Func _Example_4_Save_Email_Attachments_to_Filesystem()
    ; Save Email Attachments to Filesystem
    ; http://www.example-code.com/vbscript/emailObject_saveAttachments.asp
    Local $oEmail = ObjCreate("Chilkat_9_5_0.Email")

    ;  Load an email object containing attachments.
    ;  This .eml can be downloaded from:
    ;  http://www.example-code.com/testData/HtmlEmail.eml

    Local $sEML_FileFullPath = FileOpenDialog('Choose EML File', @ScriptDir, 'EML file (*.eml)', $FD_FILEMUSTEXIST)
    If @error Then
        ; Display the error message.
        MsgBox($MB_SYSTEMMODAL, "", "No file(s) were selected.")
        Return 0
    EndIf

    Local $iSuccess = $oEmail.LoadEml($sEML_FileFullPath)
    If ($iSuccess <> 1) Then
        ConsoleWrite($oEmail.LastErrorText & @CRLF)
        Return 0
    EndIf

    ;  If OverwriteExisting is turned on, files with the same
    ;  name are overwritten.  If turned off, new/unique filenames
    ;  are automatically generated.  The filenames actually saved
    ;  are accessible via the GetAttachmentFilename method.
    $oEmail.OverwriteExisting = 1

    ;  Save all attachments to the "myAttachments" subdirectory
    ;  found under the calling process;s current working directory.
    ;  This directory is automatically created if it does not already
    ;  exist.
    $iSuccess = $oEmail.SaveAllAttachments("myAttachments")
    If ($iSuccess <> 1) Then
        ConsoleWrite($oEmail.LastErrorText & @CRLF)
        Return 0
    EndIf

    ;  List the attachment filenames:

    For $i = 0 To $oEmail.NumAttachments - 1
        ConsoleWrite($oEmail.GetAttachmentFilename($i) & @CRLF)
    Next

EndFunc   ;==>_Example_4_Save_Email_Attachments_to_Filesystem

Best regards

mLipok

 

  • Like 3

Signature beginning:   Wondering who uses AutoIT and what it can be used for ?
* GHAPI UDF - modest begining - comunication with GitHub REST API *
ADO.au3 UDF     POP3.au3 UDF     XML.au3 UDF    How to use IE.au3  UDF with  AutoIt v3.3.14.x  for other useful stuff click the following button

Spoiler

Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind. 

My contribution (my own projects): * Debenu Quick PDF Library - UDF * Debenu PDF Viewer SDK - UDF * Acrobat Reader - ActiveX Viewer * UDF for PDFCreator v1.x.x * XZip - UDF * AppCompatFlags UDF * CrowdinAPI UDF * _WinMergeCompare2Files() * _JavaExceptionAdd() * _IsBeta() * Writing DPI Awareness App - workaround * _AutoIt_RequiredVersion() * Chilkatsoft.au3 UDF * TeamViewer.au3 UDF * JavaManagement UDF * VIES over SOAP * WinSCP UDF * GHAPI UDF - modest begining - comunication with GitHub REST API *

My contribution to others projects or UDF based on  others projects: * _sql.au3 UDF  * POP3.au3 UDF *  RTF Printer - UDF * XML.au3 UDF * ADO.au3 UDF SMTP Mailer UDF *

Useful links: * Forum Rules * Forum etiquette *  Forum Information and FAQs * How to post code on the forum * AutoIt Online Documentation * AutoIt Online Beta Documentation * SciTE4AutoIt3 getting started * Convert text blocks to AutoIt code * Games made in Autoit * Programming related sites * Polish AutoIt Tutorial * DllCall Code Generator * 

Wiki: Expand your knowledge - AutoIt Wiki * Collection of User Defined Functions * How to use HelpFile * Good coding practices in AutoIt * 

IE Related:  * How to use IE.au3  UDF with  AutoIt v3.3.14.x * Why isn't Autoit able to click a Javascript Dialog? * Clicking javascript button with no ID * IE document >> save as MHT file * IETab Switcher (by LarsJ ) * HTML Entities * _IEquerySelectorAll() (by uncommon) * 

I encourage you to read: * Global Vars * Best Coding Practices * Please explain code used in Help file for several File functions * OOP-like approach in AutoIt * UDF-Spec Questions *  EXAMPLE: How To Catch ConsoleWrite() output to a file or to CMD *

"Homo sum; humani nil a me alienum puto" - Publius Terentius Afer
"Program are meant to be read by humans and only incidentally for computers and execute" - Donald Knuth, "The Art of Computer Programming"
:naughty:  :ranting:, be  :) and       \\//_.

Anticipating Errors :  "Any program that accepts data from a user must include code to validate that data before sending it to the data store. You cannot rely on the data store, ...., or even your programming language to notify you of problems. You must check every byte entered by your users, making sure that data is the correct type for its field and that required fields are not empty."

Signature last update: 2018-03-17

Share this post


Link to post
Share on other sites
mLipok

Loz

Thanks for like.

btw.

I think I made a separate UDF.
But it takes time.

Signature beginning:   Wondering who uses AutoIT and what it can be used for ?
* GHAPI UDF - modest begining - comunication with GitHub REST API *
ADO.au3 UDF     POP3.au3 UDF     XML.au3 UDF    How to use IE.au3  UDF with  AutoIt v3.3.14.x  for other useful stuff click the following button

Spoiler

Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind. 

My contribution (my own projects): * Debenu Quick PDF Library - UDF * Debenu PDF Viewer SDK - UDF * Acrobat Reader - ActiveX Viewer * UDF for PDFCreator v1.x.x * XZip - UDF * AppCompatFlags UDF * CrowdinAPI UDF * _WinMergeCompare2Files() * _JavaExceptionAdd() * _IsBeta() * Writing DPI Awareness App - workaround * _AutoIt_RequiredVersion() * Chilkatsoft.au3 UDF * TeamViewer.au3 UDF * JavaManagement UDF * VIES over SOAP * WinSCP UDF * GHAPI UDF - modest begining - comunication with GitHub REST API *

My contribution to others projects or UDF based on  others projects: * _sql.au3 UDF  * POP3.au3 UDF *  RTF Printer - UDF * XML.au3 UDF * ADO.au3 UDF SMTP Mailer UDF *

Useful links: * Forum Rules * Forum etiquette *  Forum Information and FAQs * How to post code on the forum * AutoIt Online Documentation * AutoIt Online Beta Documentation * SciTE4AutoIt3 getting started * Convert text blocks to AutoIt code * Games made in Autoit * Programming related sites * Polish AutoIt Tutorial * DllCall Code Generator * 

Wiki: Expand your knowledge - AutoIt Wiki * Collection of User Defined Functions * How to use HelpFile * Good coding practices in AutoIt * 

IE Related:  * How to use IE.au3  UDF with  AutoIt v3.3.14.x * Why isn't Autoit able to click a Javascript Dialog? * Clicking javascript button with no ID * IE document >> save as MHT file * IETab Switcher (by LarsJ ) * HTML Entities * _IEquerySelectorAll() (by uncommon) * 

I encourage you to read: * Global Vars * Best Coding Practices * Please explain code used in Help file for several File functions * OOP-like approach in AutoIt * UDF-Spec Questions *  EXAMPLE: How To Catch ConsoleWrite() output to a file or to CMD *

"Homo sum; humani nil a me alienum puto" - Publius Terentius Afer
"Program are meant to be read by humans and only incidentally for computers and execute" - Donald Knuth, "The Art of Computer Programming"
:naughty:  :ranting:, be  :) and       \\//_.

Anticipating Errors :  "Any program that accepts data from a user must include code to validate that data before sending it to the data store. You cannot rely on the data store, ...., or even your programming language to notify you of problems. You must check every byte entered by your users, making sure that data is the correct type for its field and that required fields are not empty."

Signature last update: 2018-03-17

Share this post


Link to post
Share on other sites
mLipok

New examples and functions:

 

_Example_5_Unpack_HTML_Email_to_Files()

_EMAIL_html_Viewer_Example()
_INI_SETUP()
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#include <IE.au3>
#include <FileConstants.au3>
#include <MsgBoxConstants.au3>

Global $_sPOP3_Server = _INI_SETUP('POP3_Server')
Global $_sPOP3_UserName = _INI_SETUP('POP3_UserName')
Global $_sPOP3_Password = _INI_SETUP('POP3_Password')

_Example_1_Version()
_Example_2_Get_number_of_mesages()
_Example_3_Retrieve_UIDLs_from_POP3_Server()
_Example_4_Save_Email_Attachments_to_Filesystem()
_Example_5_Unpack_HTML_Email_to_Files()
_EMAIL_html_Viewer_Example()

Func _Example_1_Version()
    Local $oCrypt = ObjCreate("Chilkat_9_5_0.Crypt2")
    MsgBox(0, '', $oCrypt.Version)

EndFunc   ;==>_Example_1_Version

Func _Example_2_Get_number_of_mesages()
    ; http://www.example-code.com/vbscript/pop3_mailboxCount.asp
    ;  The mailman object is used for receiving (POP3)
    ;  and sending (SMTP) email.
    ; This ObjCreate statement uses the new single-DLL ActiveX for v9.5.0
    Local $oMailman = ObjCreate("Chilkat_9_5_0.MailMan")

    ;  Any string argument automatically begins the 30-day trial.
    $success = $oMailman.UnlockComponent("30-day trial")
    If ($success <> 1) Then
        MsgBox(0, 'UnlockComponent', $oMailman.LastErrorText)
        Return
    EndIf

    ;  Set the POP3 server's hostname
    $oMailman.MailHost = $_sPOP3_Server

    ;  Set the POP3 login/password.
    $oMailman.PopUsername = $_sPOP3_UserName
    $oMailman.PopPassword = $_sPOP3_Password

    ;  Get the number of messages in the mailbox.

    Local $iNumMessages = $oMailman.GetMailboxCount()
    MsgBox(0, '', $iNumMessages)

EndFunc   ;==>_Example_2_Get_number_of_mesages

Func _Example_3_Retrieve_UIDLs_from_POP3_Server()
    ; Retrieve UIDL's from POP3 Server
    ; http://www.example-code.com/vbscript/pop3_getUidls.asp

    ;  The mailman object is used for receiving (POP3)
    ;  and sending (SMTP) email.
    ; This ObjCreate statement uses the new single-DLL ActiveX for v9.5.0
    Local $oMailman = ObjCreate("Chilkat_9_5_0.MailMan")

    ;  Any string argument automatically begins the 30-day trial.
    $success = $oMailman.UnlockComponent("30-day trial")
    If ($success <> 1) Then
        MsgBox(0, 'UnlockComponent', $oMailman.LastErrorText)
        Return
    EndIf

    ;  Set the POP3 server's hostname
    $oMailman.MailHost = $_sPOP3_Server

    ;  Set the POP3 login/password.
    $oMailman.PopUsername = $_sPOP3_UserName
    $oMailman.PopPassword = $_sPOP3_Password

    ; sa is a Chilkat_9_5_0.StringArray
    Local $oSA = $oMailman.GetUidls()

    Local $iCount = $oSA.Count

    For $i = 0 To $iCount - 1
        ConsoleWrite($oSA.GetString($i) & @CRLF)
    Next

EndFunc   ;==>_Example_3_Retrieve_UIDLs_from_POP3_Server

Func _Example_4_Save_Email_Attachments_to_Filesystem()
    ; Save Email Attachments to Filesystem
    ; http://www.example-code.com/vbscript/emailObject_saveAttachments.asp
    Local $oEmail = ObjCreate("Chilkat_9_5_0.Email")

    ;  Load an email object containing attachments.
    ;  This .eml can be downloaded from:
    ;  http://www.example-code.com/testData/HtmlEmail.eml

    Local $sEML_FileFullPath = FileOpenDialog('Choose EML File', @ScriptDir, 'EML file (*.eml)', $FD_FILEMUSTEXIST)
    If @error Then
        ; Display the error message.
        MsgBox($MB_SYSTEMMODAL, "", "No file(s) were selected.")
        Return 0
    EndIf

    Local $iSuccess = $oEmail.LoadEml($sEML_FileFullPath)
    If ($iSuccess <> 1) Then
        ConsoleWrite($oEmail.LastErrorText & @CRLF)
        Return 0
    EndIf

    ;  If OverwriteExisting is turned on, files with the same
    ;  name are overwritten.  If turned off, new/unique filenames
    ;  are automatically generated.  The filenames actually saved
    ;  are accessible via the GetAttachmentFilename method.
    $oEmail.OverwriteExisting = 1

    ;  Save all attachments to the "myAttachments" subdirectory
    ;  found under the calling process;s current working directory.
    ;  This directory is automatically created if it does not already
    ;  exist.
    $iSuccess = $oEmail.SaveAllAttachments("myAttachments")
    If ($iSuccess <> 1) Then
        ConsoleWrite($oEmail.LastErrorText & @CRLF)
        Return 0
    EndIf

    ;  List the attachment filenames:

    For $i = 0 To $oEmail.NumAttachments - 1
        ConsoleWrite($oEmail.GetAttachmentFilename($i) & @CRLF)
    Next

EndFunc   ;==>_Example_4_Save_Email_Attachments_to_Filesystem

Func _Example_5_Unpack_HTML_Email_to_Files($sHTMLFilename = "thisEmail.html")
    ; Unpack HTML Email to Files
    ; http://www.example-code.com/vbscript/email_unpackHtml.asp

    ; This CreateObject statement uses the new single-DLL ActiveX for v9.5.0
    Local $oEmail = ObjCreate("Chilkat_9_5_0.Email")

    ;  Select EML File containing HTML content with images.
    Local $sEML_FileFullPath = FileOpenDialog('Choose EML File', @ScriptDir, 'EML file (*.eml)', $FD_FILEMUSTEXIST)
    If @error Then
        ; Display the error message.
        MsgBox($MB_SYSTEMMODAL, "", "No file(s) were selected.")
        Return 0
    EndIf

    ;  Load an email object containing HTML content with images.
    Local $iSuccess = $oEmail.LoadEml($sEML_FileFullPath)
    If ($iSuccess <> 1) Then
        ConsoleWrite($oEmail.LastErrorText & @CRLF)
        Return 0
    EndIf

    ;  Is this an HTML email?
    If ($oEmail.HasHtmlBody() = 1) Then

        ;  Unpack the HTML to files.  The image and css URLs
        ;  in the HTML are modified to point to the files extracted to disk.
        Local $sUnpackDir = @ScriptDir & "\ExtractedHTML"
        Local $sHTMLFileFullPath = $sUnpackDir & '\' & $sHTMLFilename
        Local $sPartsSubdir = "images"

        $iSuccess = $oEmail.UnpackHtml($sUnpackDir, $sHTMLFilename, $sPartsSubdir)
        If ($iSuccess <> 1) Then
            ConsoleWrite($oEmail.LastErrorText & @CRLF)
            Return 0
        EndIf

        ;  If the UnpackHtml method was successful, the
        ;  HTML is written to /temp/thisEmail.html and
        ;  the image files are located in  /temp/images

        Return $sHTMLFileFullPath
    EndIf
EndFunc   ;==>_Example_5_Unpack_HTML_Email_to_Files


Func _EMAIL_html_Viewer_Example($sHTMLFileFullPath = @ScriptDir & "\ExtractedHTML\thisEmail.html")

        If Not FileExists($sHTMLFileFullPath ) Then Return SetError(1,0,0)

        Local $oIE = _IECreateEmbedded()
        GUICreate("Embedded Web control Test", 640, 580, _
                (@DesktopWidth - 640) / 2, (@DesktopHeight - 580) / 2, _
                $WS_OVERLAPPEDWINDOW + $WS_CLIPSIBLINGS + $WS_CLIPCHILDREN)
        GUICtrlCreateObj($oIE, 10, 40, 600, 360)
        GUISetState(@SW_SHOW) ;Show GUI

        Local $sUnpackDir = StringRegExp($sHTMLFileFullPath,'(?i)(.+)\\.+?',3)[0]

        Local $hFileOpen = FileOpen($sHTMLFileFullPath, $FO_READ)
        Local $sHTML = FileRead($hFileOpen)
        FileClose($hFileOpen)

        _html_imgSrcToLocalPath($sHTML,$sUnpackDir)

        _IENavigate($oIE, "about:blank")
        _IEDocWriteHTML($oIE, $sHTML)
;~      _IEAction($oIE, "refresh")

        ; Waiting for user to close the window
        While 1
            Local $msg = GUIGetMsg()
            Select
                Case $msg = $GUI_EVENT_CLOSE
                    ExitLoop
            EndSelect
        WEnd

        GUIDelete()


EndFunc


; #FUNCTION# ====================================================================================================================
; Name ..........: _html_imgSrcToLocalPath
; Description ...: Change relative Path to direct local path in HTML source
; Syntax ........: _html_imgSrcToLocalPath(Byref $sHTML[, $sPath = @ScriptDir])
; Parameters ....: $sHTML               - [in/out] a string value.
;                  $sPath               - [optional] a string value. Default is @ScriptDir.
; Return values .: None
; Author ........: SmOke_N
; Modified ......:
; Remarks .......:
; Related .......:
; Link ..........: http://www.autoitscript.com/forum/topic/167535-iedocwritehtml-extractedhtml/#entry1225920
; Example .......: No
; ===============================================================================================================================
Func _html_imgSrcToLocalPath(ByRef $sHTML, $sPath = @ScriptDir)

    Local $aImgFiles = StringRegExp($sHTML, "(?is)(<\s*img\s+src=[""'](.+?)[""'])", 3)
    If @error Then ; no img files
        Return SetError(1, 0, 0)
    EndIf

    $sPath = StringReplace(StringRegExpReplace($sPath, "[\\/]+$", ""), "\", "/", 0, 1)
    Local $sRepl
    For $i = 0 To UBound($aImgFiles) -1 Step 2
        If StringRegExp($aImgFiles[$i + 1], "^(?i)\s*(http|s?ftp|file:///)") Then ContinueLoop
        $sRepl = StringReplace($aImgFiles[$i], $aImgFiles[$i + 1], _
            "file:///" & $sPath & "/" & $aImgFiles[$i + 1])
        $sHTML = StringReplace($sHTML, $aImgFiles[$i], $sRepl, 1, 0)
    Next

    Return 1
EndFunc


Func _INI_SETUP($sKey)
    Local $sINIFileFullPath = @ScriptFullPath & '.INI'
    Local $sINI_Value = IniRead( $sINIFileFullPath, "POP3", $sKey, 'Default' )
    If $sINI_Value = 'Default' Or $sINI_Value = '' Then
        $sINI_Value = InputBox('INI Setup for Key: ' & $sKey, 'Enter value for ini Key: ' & $sKey &'=','')
        IniWrite( $sINIFileFullPath, "POP3", $sKey, IniRead( $sINIFileFullPath, "POP3", $sKey, Default ) )
        Return $sINI_Value
    Else
        Return $sINI_Value
    EndIf

EndFunc

Thanks to @SmOke_N for:

; #FUNCTION# ====================================================================================================================
; Name ..........: _html_imgSrcToLocalPath
; Description ...: Change relative Path to direct local path in HTML source
; Syntax ........: _html_imgSrcToLocalPath(Byref $sHTML[, $sPath = @ScriptDir])
; Parameters ....: $sHTML               - [in/out] a string value.
;                  $sPath               - [optional] a string value. Default is @ScriptDir.
; Return values .: None
; Author ........: SmOke_N
; Modified ......:
; Remarks .......:
; Related .......:
; Link ..........: http://www.autoitscript.com/forum/topic/167535-iedocwritehtml-extractedhtml/#entry1225920
; Example .......: No
; ===============================================================================================================================
Func _html_imgSrcToLocalPath(ByRef $sHTML, $sPath = @ScriptDir)

    Local $aImgFiles = StringRegExp($sHTML, "(?is)(<\s*img\s+src=[""'](.+?)[""'])", 3)
    If @error Then ; no img files
        Return SetError(1, 0, 0)
    EndIf

    $sPath = StringReplace(StringRegExpReplace($sPath, "[\\/]+$", ""), "\", "/", 0, 1)
    Local $sRepl
    For $i = 0 To UBound($aImgFiles) -1 Step 2
        If StringRegExp($aImgFiles[$i + 1], "^(?i)\s*(http|s?ftp|file:///)") Then ContinueLoop
        $sRepl = StringReplace($aImgFiles[$i], $aImgFiles[$i + 1], _
            "file:///" & $sPath & "/" & $aImgFiles[$i + 1])
        $sHTML = StringReplace($sHTML, $aImgFiles[$i], $sRepl, 1, 0)
    Next

    Return 1
EndFunc

Signature beginning:   Wondering who uses AutoIT and what it can be used for ?
* GHAPI UDF - modest begining - comunication with GitHub REST API *
ADO.au3 UDF     POP3.au3 UDF     XML.au3 UDF    How to use IE.au3  UDF with  AutoIt v3.3.14.x  for other useful stuff click the following button

Spoiler

Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind. 

My contribution (my own projects): * Debenu Quick PDF Library - UDF * Debenu PDF Viewer SDK - UDF * Acrobat Reader - ActiveX Viewer * UDF for PDFCreator v1.x.x * XZip - UDF * AppCompatFlags UDF * CrowdinAPI UDF * _WinMergeCompare2Files() * _JavaExceptionAdd() * _IsBeta() * Writing DPI Awareness App - workaround * _AutoIt_RequiredVersion() * Chilkatsoft.au3 UDF * TeamViewer.au3 UDF * JavaManagement UDF * VIES over SOAP * WinSCP UDF * GHAPI UDF - modest begining - comunication with GitHub REST API *

My contribution to others projects or UDF based on  others projects: * _sql.au3 UDF  * POP3.au3 UDF *  RTF Printer - UDF * XML.au3 UDF * ADO.au3 UDF SMTP Mailer UDF *

Useful links: * Forum Rules * Forum etiquette *  Forum Information and FAQs * How to post code on the forum * AutoIt Online Documentation * AutoIt Online Beta Documentation * SciTE4AutoIt3 getting started * Convert text blocks to AutoIt code * Games made in Autoit * Programming related sites * Polish AutoIt Tutorial * DllCall Code Generator * 

Wiki: Expand your knowledge - AutoIt Wiki * Collection of User Defined Functions * How to use HelpFile * Good coding practices in AutoIt * 

IE Related:  * How to use IE.au3  UDF with  AutoIt v3.3.14.x * Why isn't Autoit able to click a Javascript Dialog? * Clicking javascript button with no ID * IE document >> save as MHT file * IETab Switcher (by LarsJ ) * HTML Entities * _IEquerySelectorAll() (by uncommon) * 

I encourage you to read: * Global Vars * Best Coding Practices * Please explain code used in Help file for several File functions * OOP-like approach in AutoIt * UDF-Spec Questions *  EXAMPLE: How To Catch ConsoleWrite() output to a file or to CMD *

"Homo sum; humani nil a me alienum puto" - Publius Terentius Afer
"Program are meant to be read by humans and only incidentally for computers and execute" - Donald Knuth, "The Art of Computer Programming"
:naughty:  :ranting:, be  :) and       \\//_.

Anticipating Errors :  "Any program that accepts data from a user must include code to validate that data before sending it to the data store. You cannot rely on the data store, ...., or even your programming language to notify you of problems. You must check every byte entered by your users, making sure that data is the correct type for its field and that required fields are not empty."

Signature last update: 2018-03-17

Share this post


Link to post
Share on other sites
mLipok

Few new examples:
 

Func _Example_12_JsonObject_PrettyPrint()
    _Log_Chilkat('_Example_12_JsonObject_PrettyPrint')
    ; https://www.example-code.com/vbscript/json_pretty_print.asp
    Local $oJSON = ObjCreate("Chilkat_9_5_0.JsonObject")

    $sJSON_String = "{""name"": ""donut"",""image"":{""fname"": ""donut.jpg"",""w"": 200,""h"": 200},""thumbnail"":{""fname"": ""donutThumb.jpg"",""w"": 32,""h"": 32}}"

    $iSuccess = $oJSON.Load($sJSON_String)
    If ($iSuccess <> 1) Then
        ConsoleWrite($oJSON.LastErrorText & @CRLF)
        Return
    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_Chilkat('_Example_13_JsonObject_IterateMembers')
    ; https://www.example-code.com/vbscript/json_iterate_members.asp
    Local $oJSON = ObjCreate("Chilkat_9_5_0.JsonObject")

    $sJSON_String = "{ ""id"": 1, ""name"": ""A green door"", ""tags"": [""home"", ""green""], ""price"": 125 }"

    $iSuccess = $oJSON.Load($sJSON_String)
    If ($iSuccess <> 1) Then
        ConsoleWrite($oJSON.LastErrorText & @CRLF)
        Return
    EndIf

    $iNumMembers = $oJSON.Size

    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_Chilkat('_Example_14_JsonObject_CreateDocument')
    ; https://www.example-code.com/vbscript/create_json.asp
    Local $oJSON = ObjCreate("Chilkat_9_5_0.JsonObject")
    Local $iSuccess
    $iSuccess = $oJSON.AddStringAt(-1,"Title","Pan's Labyrinth")
    $iSuccess = $oJSON.AddStringAt(-1,"Director","Guillermo del Toro")
    $iSuccess = $oJSON.AddStringAt(-1,"Original_Title","El laberinto del fauno")
    $iSuccess = $oJSON.AddIntAt(-1,"Year_Released",2006)
    $oJSON.EmitCompact = 0
    ConsoleWrite($oJSON.Emit() & @CRLF)
EndFunc   ;==>_Example_13_JsonObject_IterateMembers

 

test_CHillkat.au3


Signature beginning:   Wondering who uses AutoIT and what it can be used for ?
* GHAPI UDF - modest begining - comunication with GitHub REST API *
ADO.au3 UDF     POP3.au3 UDF     XML.au3 UDF    How to use IE.au3  UDF with  AutoIt v3.3.14.x  for other useful stuff click the following button

Spoiler

Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind. 

My contribution (my own projects): * Debenu Quick PDF Library - UDF * Debenu PDF Viewer SDK - UDF * Acrobat Reader - ActiveX Viewer * UDF for PDFCreator v1.x.x * XZip - UDF * AppCompatFlags UDF * CrowdinAPI UDF * _WinMergeCompare2Files() * _JavaExceptionAdd() * _IsBeta() * Writing DPI Awareness App - workaround * _AutoIt_RequiredVersion() * Chilkatsoft.au3 UDF * TeamViewer.au3 UDF * JavaManagement UDF * VIES over SOAP * WinSCP UDF * GHAPI UDF - modest begining - comunication with GitHub REST API *

My contribution to others projects or UDF based on  others projects: * _sql.au3 UDF  * POP3.au3 UDF *  RTF Printer - UDF * XML.au3 UDF * ADO.au3 UDF SMTP Mailer UDF *

Useful links: * Forum Rules * Forum etiquette *  Forum Information and FAQs * How to post code on the forum * AutoIt Online Documentation * AutoIt Online Beta Documentation * SciTE4AutoIt3 getting started * Convert text blocks to AutoIt code * Games made in Autoit * Programming related sites * Polish AutoIt Tutorial * DllCall Code Generator * 

Wiki: Expand your knowledge - AutoIt Wiki * Collection of User Defined Functions * How to use HelpFile * Good coding practices in AutoIt * 

IE Related:  * How to use IE.au3  UDF with  AutoIt v3.3.14.x * Why isn't Autoit able to click a Javascript Dialog? * Clicking javascript button with no ID * IE document >> save as MHT file * IETab Switcher (by LarsJ ) * HTML Entities * _IEquerySelectorAll() (by uncommon) * 

I encourage you to read: * Global Vars * Best Coding Practices * Please explain code used in Help file for several File functions * OOP-like approach in AutoIt * UDF-Spec Questions *  EXAMPLE: How To Catch ConsoleWrite() output to a file or to CMD *

"Homo sum; humani nil a me alienum puto" - Publius Terentius Afer
"Program are meant to be read by humans and only incidentally for computers and execute" - Donald Knuth, "The Art of Computer Programming"
:naughty:  :ranting:, be  :) and       \\//_.

Anticipating Errors :  "Any program that accepts data from a user must include code to validate that data before sending it to the data store. You cannot rely on the data store, ...., or even your programming language to notify you of problems. You must check every byte entered by your users, making sure that data is the correct type for its field and that required fields are not empty."

Signature last update: 2018-03-17

Share this post


Link to post
Share on other sites
mLipok

Here is an Chilkat.au3 UDF - modest begining.
I will soon post an update as separate thread.

 

Chilkat_example.au3

Chilkat.au3

  • Like 1

Signature beginning:   Wondering who uses AutoIT and what it can be used for ?
* GHAPI UDF - modest begining - comunication with GitHub REST API *
ADO.au3 UDF     POP3.au3 UDF     XML.au3 UDF    How to use IE.au3  UDF with  AutoIt v3.3.14.x  for other useful stuff click the following button

Spoiler

Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind. 

My contribution (my own projects): * Debenu Quick PDF Library - UDF * Debenu PDF Viewer SDK - UDF * Acrobat Reader - ActiveX Viewer * UDF for PDFCreator v1.x.x * XZip - UDF * AppCompatFlags UDF * CrowdinAPI UDF * _WinMergeCompare2Files() * _JavaExceptionAdd() * _IsBeta() * Writing DPI Awareness App - workaround * _AutoIt_RequiredVersion() * Chilkatsoft.au3 UDF * TeamViewer.au3 UDF * JavaManagement UDF * VIES over SOAP * WinSCP UDF * GHAPI UDF - modest begining - comunication with GitHub REST API *

My contribution to others projects or UDF based on  others projects: * _sql.au3 UDF  * POP3.au3 UDF *  RTF Printer - UDF * XML.au3 UDF * ADO.au3 UDF SMTP Mailer UDF *

Useful links: * Forum Rules * Forum etiquette *  Forum Information and FAQs * How to post code on the forum * AutoIt Online Documentation * AutoIt Online Beta Documentation * SciTE4AutoIt3 getting started * Convert text blocks to AutoIt code * Games made in Autoit * Programming related sites * Polish AutoIt Tutorial * DllCall Code Generator * 

Wiki: Expand your knowledge - AutoIt Wiki * Collection of User Defined Functions * How to use HelpFile * Good coding practices in AutoIt * 

IE Related:  * How to use IE.au3  UDF with  AutoIt v3.3.14.x * Why isn't Autoit able to click a Javascript Dialog? * Clicking javascript button with no ID * IE document >> save as MHT file * IETab Switcher (by LarsJ ) * HTML Entities * _IEquerySelectorAll() (by uncommon) * 

I encourage you to read: * Global Vars * Best Coding Practices * Please explain code used in Help file for several File functions * OOP-like approach in AutoIt * UDF-Spec Questions *  EXAMPLE: How To Catch ConsoleWrite() output to a file or to CMD *

"Homo sum; humani nil a me alienum puto" - Publius Terentius Afer
"Program are meant to be read by humans and only incidentally for computers and execute" - Donald Knuth, "The Art of Computer Programming"
:naughty:  :ranting:, be  :) and       \\//_.

Anticipating Errors :  "Any program that accepts data from a user must include code to validate that data before sending it to the data store. You cannot rely on the data store, ...., or even your programming language to notify you of problems. You must check every byte entered by your users, making sure that data is the correct type for its field and that required fields are not empty."

Signature last update: 2018-03-17

Share this post


Link to post
Share on other sites
mLipok

Finally Chillkat.au3 UDF is released:

 

  • Like 1

Signature beginning:   Wondering who uses AutoIT and what it can be used for ?
* GHAPI UDF - modest begining - comunication with GitHub REST API *
ADO.au3 UDF     POP3.au3 UDF     XML.au3 UDF    How to use IE.au3  UDF with  AutoIt v3.3.14.x  for other useful stuff click the following button

Spoiler

Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind. 

My contribution (my own projects): * Debenu Quick PDF Library - UDF * Debenu PDF Viewer SDK - UDF * Acrobat Reader - ActiveX Viewer * UDF for PDFCreator v1.x.x * XZip - UDF * AppCompatFlags UDF * CrowdinAPI UDF * _WinMergeCompare2Files() * _JavaExceptionAdd() * _IsBeta() * Writing DPI Awareness App - workaround * _AutoIt_RequiredVersion() * Chilkatsoft.au3 UDF * TeamViewer.au3 UDF * JavaManagement UDF * VIES over SOAP * WinSCP UDF * GHAPI UDF - modest begining - comunication with GitHub REST API *

My contribution to others projects or UDF based on  others projects: * _sql.au3 UDF  * POP3.au3 UDF *  RTF Printer - UDF * XML.au3 UDF * ADO.au3 UDF SMTP Mailer UDF *

Useful links: * Forum Rules * Forum etiquette *  Forum Information and FAQs * How to post code on the forum * AutoIt Online Documentation * AutoIt Online Beta Documentation * SciTE4AutoIt3 getting started * Convert text blocks to AutoIt code * Games made in Autoit * Programming related sites * Polish AutoIt Tutorial * DllCall Code Generator * 

Wiki: Expand your knowledge - AutoIt Wiki * Collection of User Defined Functions * How to use HelpFile * Good coding practices in AutoIt * 

IE Related:  * How to use IE.au3  UDF with  AutoIt v3.3.14.x * Why isn't Autoit able to click a Javascript Dialog? * Clicking javascript button with no ID * IE document >> save as MHT file * IETab Switcher (by LarsJ ) * HTML Entities * _IEquerySelectorAll() (by uncommon) * 

I encourage you to read: * Global Vars * Best Coding Practices * Please explain code used in Help file for several File functions * OOP-like approach in AutoIt * UDF-Spec Questions *  EXAMPLE: How To Catch ConsoleWrite() output to a file or to CMD *

"Homo sum; humani nil a me alienum puto" - Publius Terentius Afer
"Program are meant to be read by humans and only incidentally for computers and execute" - Donald Knuth, "The Art of Computer Programming"
:naughty:  :ranting:, be  :) and       \\//_.

Anticipating Errors :  "Any program that accepts data from a user must include code to validate that data before sending it to the data store. You cannot rely on the data store, ...., or even your programming language to notify you of problems. You must check every byte entered by your users, making sure that data is the correct type for its field and that required fields are not empty."

Signature last update: 2018-03-17

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

  • Similar Content

    • t0nZ
      By t0nZ
      Today I want to share this little project made to check and  notify the expiration of domain users password, in a Microsoft domain.
      Briefly, the script check users domain password expiration and takes actions.
      The script can work on multiple domain groups, taking different actions for every group, there is an .ini file with some options.
      Groups to be checked are defined in the .ini, and the groups must contain only users no other groups.
      The list of users of every group is obtained and if the password expiration in (remaining) days is matched (two possibilities) an email is sent.
      It can be a mail sent directly to the user (ini file : tomail=user) or it can be a mail sent to only one address (ini file : tomail=the@mail.it) (like domain admins...) and in this case the mail contains a report with the users approaching expiration.
      An operation log is always generated.
      In the ini (also the posted one) you can set to have no mail sent (for testing) and/or to have a GUI, but also the GUI is intended only for test, this script is scheduled on a server not logged in, so normally no GUI .
      Update 2018/03/16 : added switch to reset the password expiration, useful if you have for example an user (or 500) with psw expiration withing 3 days and you want to restore expiration within 90 days WITHOUT changing password.
      Used the way as advised by Microsoft  (see the link), but with sth AD.au3 , the fantastic Active Directory UDF
      # First change the pwdlastset to 0 because Microsoft wants it this way $todouser.pwdLastSet = 0 Set-ADUser -Instance $todouser # Change the pwdlastset to the current date/time of the associate DC $todouser.pwdLastSet = -1 Set-ADUser -Instance $todouser Why you should act this way ? Big companies have strange policies listen to me ...
      The code:
      #Region ;**** Directives created by AutoIt3Wrapper_GUI **** #AutoIt3Wrapper_Icon=Icone\Faenza\117.ico #EndRegion ;**** Directives created by AutoIt3Wrapper_GUI **** ; PEG ; Password Expiration Guardian ; (C) NSC 2018 ; check user domain password expiration and takes actions ; the script can work on multiple domain groups, taking differente actions for every group. ; the groups must contains only users no other groups ; the list of users of every group is obtained and if the password expiration in day is matched (two possibilities) an email is sent. ; It can be a mail sent directly to the user (ini file : tomail=user) ; or it can be a mail sent to only one address (ini file : tomail=the@mail.it) ; and in this case the mail contains a report with the users approaching expiration ; V.0.5 check based on one domain group ; V.1.0 ini file and check based on multiple domain groups ; V.1.5 ini file with general section to activate "test" GUI, and to enable disable mail send ; V.1.6 march 2018 italian "home made" translation of days and months in date ; V.1.7 added flag pwdLastSet to reset pass expiration - intended to use like a one time on/off switch to reset psw expiration #include <AD.au3> #include <File.au3> #include <GuiEdit.au3> #include <_zip.au3> #include <Date.au3> #include <Inet.au3> #include <GUIConstantsEx.au3> #include <GuiEdit.au3> #include <EditConstants.au3> #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> #include <Debug.au3> Global $appname = "PEG", $appver = "V.1.7" Global $inifile = @ScriptDir & "\" & $appname & ".ini" Global $geleft = 5, $getop = 5, $gewidth = 790, $geheight = 540 Global $gollogcount = 0, $lastlog = "sicrlf", $cachelog = "", $guititle = "PEG " & $appver, $Gollogedit, $logfile = @ScriptDir & "\" & $appname & "_LOG_", $months2NOTzip = 3 Global $INIgroup, $INItomail, $INImailsubject, $INIsmpt, $INIfromname, $INIfromaddress, $INIdays1, $INIdays2, $INItosend, $arrayINIsections, $guiactive, $flagITA, $flagpwdLastSet ; START program GOLLOG(">>>>>> " & $appname & " " & $appver & " START >>>>>>") CFGctrl() If $guiactive = 1 Then GUI() $groupnumber = 0 While $groupnumber < $arrayINIsections[0] $groupnumber += 1 If $arrayINIsections[$groupnumber] <> "general" Then CFGload($arrayINIsections[$groupnumber]) loaduserS() EndIf WEnd If $guiactive = 1 Then While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE GOLLOG("<<<< STOP <<<<") Exit EndSwitch WEnd EndIf GOLLOG("<<<<<< PEG STOP <<<<<<<") Exit ;STOP program Func GUI() GUICreate($guititle, 800, 560, 100, 200, -1) GUISetBkColor(0x693F54) ; will change background color $Gollogedit = GUICtrlCreateEdit("", $geleft, $getop, $gewidth, $geheight, BitOR($ES_AUTOVSCROLL, $ES_AUTOHSCROLL, $ES_WANTRETURN, $WS_BORDER, $WS_VSCROLL)) GUICtrlSetBkColor(-1, 0xC7BBC1) GUICtrlSetData(-1, "" & @CRLF) GUICtrlSetFont(-1, 9, 800, 0, "consolas") GUICtrlSetColor(-1, 0x090608) GUISetState(@SW_SHOW) GOLLOG("PEG " & $appver & " gui STARTED") EndFunc ;==>GUI Func loaduserS() GOLLOG("workin on group: " & $INIgroup) Local $Nscad = 0 Dim $report[1] = ["Report:"] Local $singlereport = "" Local $usermail = "" Local $username = "" Local $datediff = "" Local $arrayuserpsw Local $iErr _AD_Open() $search1 = _AD_GetGroupMembers($INIgroup) ;$search1 = _AD_RecursiveGetGroupMembers($INIgroup); testing recursive .. in the future maybe If @error = 0 Then Local $conta1 = 0 While $search1[0] > $conta1 $conta1 += 1 $arrayuserpsw = _AD_GetPasswordInfo($search1[$conta1]) $datediff = _DateDiff("D", _NowCalc(), $arrayuserpsw[9]) GOLLOG("USER: " & $search1[$conta1]) GOLLOG("Password expires on: " & $arrayuserpsw[9] & " in " & $datediff & " days") If $datediff = $INIdays1 Or $datediff = $INIdays2 Then GOLLOG("expiration match !") If $INItomail = "user" Then ; this IF is relative to .ini file parameter TOSEND $usermail = _AD_GetObjectAttribute($search1[$conta1], "mail") GOLLOG("sending mail to: " & $usermail) If $flagITA = 1 Then $dataITA = dataITA($arrayuserpsw[9]) Else $dataITA = _DateTimeFormat($arrayuserpsw[9], 1) EndIf Dim $report[1] = ["La tua password scadra' " & $dataITA & ", entro " & $datediff & " giorni."] _ArrayAdd($report, "Modificala per tempo !") If $INItosend = 0 Then GOLLOG("Not sent mail " & $Nscad & ": ") GOLLOG("from :" & $INIfromname & " | " & $INIfromaddress) GOLLOG("to :" & $usermail & " | subject: " & $INImailsubject) Local $reporttext = _ArrayToString($report) GOLLOG("text :" & $reporttext) Else Local $iResponse = _INetSmtpMail($INIsmpt, $INIfromname, $INIfromaddress, $usermail, $INImailsubject, $report, "EHLO " & @ComputerName, "-1") ; perla pearl mail send HS smtp (ehlo required) $iErr = @error If $iResponse = 1 Then GOLLOG("Success! " & "Mail to user sent") Else GOLLOG("Error! " & "Mail failed with error code " & $iErr) EndIf EndIf Else $username = _AD_GetObjectAttribute($search1[$conta1], "displayname") _ArrayAdd($report, "USER: " & $username) _ArrayAdd($report, "Password expires on: " & $arrayuserpsw[9] & " in " & $datediff & " days") $Nscad += 1 If $flagpwdLastSet = 1 Then ; warning : auto pass set GOLLOG("Re-set password expiration for " & $search1[$conta1]) If _AD_ModifyAttribute($search1[$conta1], "pwdLastSet", "0") Then GOLLOG("pwdLastSet to 0 - OK") Else GOLLOG("pwdLastSet to 0 - ERROR " & @error) EndIf If _AD_ModifyAttribute($search1[$conta1], "pwdLastSet", "-1") Then GOLLOG("pwdLastSet to -1 - OK") Else GOLLOG("pwdLastSet to -1 - ERROR " & @error) EndIf EndIf EndIf EndIf WEnd If $Nscad > 0 And $INItomail <> "user" Then _ArrayAdd($report, $Nscad & " user passwords near expiration") If $INItosend = 0 Then GOLLOG("Not sent mail " & $Nscad & ": ") GOLLOG("from :" & $INIfromname & " | " & $INIfromaddress) GOLLOG("to :" & $INItomail & " | subject: " & $INImailsubject) Local $reporttext = _ArrayToString($report) GOLLOG("text :" & $reporttext) Else Local $iResponse = _INetSmtpMail($INIsmpt, $INIfromname, $INIfromaddress, $INItomail, $INImailsubject, $report, "EHLO " & @ComputerName, "-1") ; perla pearl mail send HS smtp (ehlo required) Local $iErr = @error If $iResponse = 1 Then GOLLOG("Success! " & "Mail sent") Else GOLLOG("Error! " & "Mail failed with error code " & $iErr) EndIf EndIf EndIf GOLLOG("checked n° " & $conta1 & " users") Else GOLLOG("error in user search " & @error) EndIf _AD_Close() EndFunc ;==>loaduserS Func dataITA($inputdate) ; Input date in the format "YYYY/MM/DD[ HH:MM:SS]", and translates Tuesday 8 May 2018 -> Martedì 8 maggio 2018 - perla pearl Local $stringaDATAita = _DateTimeFormat($inputdate, 1) Select Case StringInStr($stringaDATAita, "Monday") $stringaDATAita = StringReplace($stringaDATAita, "Monday", "lunedi'") Case StringInStr($stringaDATAita, "Tuesday") $stringaDATAita = StringReplace($stringaDATAita, "Tuesday", "martedi'") Case StringInStr($stringaDATAita, "Wednesday") $stringaDATAita = StringReplace($stringaDATAita, "Wednesday", "mercoledi'") Case StringInStr($stringaDATAita, "Thursday") $stringaDATAita = StringReplace($stringaDATAita, "Thursday", "giovedi'") Case StringInStr($stringaDATAita, "Friday") $stringaDATAita = StringReplace($stringaDATAita, "Friday", "venerdi'") Case StringInStr($stringaDATAita, "Saturday") $stringaDATAita = StringReplace($stringaDATAita, "Saturday", "sabato") Case StringInStr($stringaDATAita, "Sunday") $stringaDATAita = StringReplace($stringaDATAita, "Sunday", "Domenica") EndSelect Select Case StringInStr($stringaDATAita, "January") $stringaDATAita = StringReplace($stringaDATAita, "January", "gennaio") Case StringInStr($stringaDATAita, "February") $stringaDATAita = StringReplace($stringaDATAita, "February", "febbraio") Case StringInStr($stringaDATAita, "March") $stringaDATAita = StringReplace($stringaDATAita, "March", "marzo") Case StringInStr($stringaDATAita, "April") $stringaDATAita = StringReplace($stringaDATAita, "April", "aprile") Case StringInStr($stringaDATAita, "May") $stringaDATAita = StringReplace($stringaDATAita, "May", "maggio") Case StringInStr($stringaDATAita, "June") $stringaDATAita = StringReplace($stringaDATAita, "June", "giugno") Case StringInStr($stringaDATAita, "July") $stringaDATAita = StringReplace($stringaDATAita, "July", "luglio") Case StringInStr($stringaDATAita, "August") $stringaDATAita = StringReplace($stringaDATAita, "August", "agosto") Case StringInStr($stringaDATAita, "September") $stringaDATAita = StringReplace($stringaDATAita, "September", "settembre") Case StringInStr($stringaDATAita, "October") $stringaDATAita = StringReplace($stringaDATAita, "October", "ottobre") Case StringInStr($stringaDATAita, "November") $stringaDATAita = StringReplace($stringaDATAita, "November", "novembre") Case StringInStr($stringaDATAita, "December") $stringaDATAita = StringReplace($stringaDATAita, "December", "dicembre") EndSelect Return ($stringaDATAita) EndFunc ;==>dataITA Func GOLLOG($logtext) ; Gollog V.2.3 gestione CRLF si o no ; gestione a capo automatico oltre i xx caratteri; gestione pulitura ogni totmila char Perla pearl ; basta aggiungere |nocrlf50 a fine stringa, dove 50 sono gli xx caratteri, conta la prima riga dove si supera quel limite. ; to declare $gollogcount = 0,$lastlog="sicrlf",$cachelog="",$guititle = "nomegui",$Gollogedit,$logfile = @ScriptDir & "\GOLLOG_LOG_", $months2NOTzip = 3 ; e anche le misure dell'edit: $geleft = 32, $getop = 32, $gewidth = 553, $geheight = 377 ; #include <File.au3> #include <GuiEdit.au3> #include <_zip.au3> ; to insert FUNCs: GOLLOG CLEANEDIT GOLzipZIP $gollogcount += StringLen($logtext) ;Local $logfile = @ScriptDir & "\GOLLOG_LOG_" ; now global Local $logfiletimerange = @YEAR & @MON Local $linelimit = StringRight($logtext, 2) If StringRight($logtext, 9) = "|nocrlf" & $linelimit Then $logtext = StringTrimRight($logtext, 9) Local $acapo = "no" Else Local $acapo = "si" $gollogcount += 4 If $gollogcount > 13000 Then Sleep(3000) cleanedit() ; MsgBox(64, "debug", $conta) $gollogcount = 0 EndIf EndIf If $acapo = "no" And (StringLen($cachelog) <= $linelimit) Then ;pearl perla non a capo se If $lastlog = "nocrlf" Then If WinExists($guititle) Then ; per non scrivere in gui se questa non esiste _GUICtrlEdit_AppendText($Gollogedit, $logtext) EndIf Else If WinExists($guititle) Then ; per non scrivere in gui se questa non esiste _GUICtrlEdit_AppendText($Gollogedit, @MDAY & "/" & @MON & "_" & @HOUR & ":" & @MIN & " " & $logtext) EndIf EndIf $cachelog = $cachelog & $logtext $lastlog = "nocrlf" Else If $lastlog = "nocrlf" Then If WinExists($guititle) Then ; per non scrivere in gui se questa non esiste _GUICtrlEdit_AppendText($Gollogedit, $logtext & @CRLF) EndIf $cachelog = $cachelog & $logtext _FileWriteLog($logfile & $logfiletimerange & ".txt", $cachelog) $cachelog = "" Else If WinExists($guititle) Then ; per non scrivere in gui se questa non esiste _GUICtrlEdit_AppendText($Gollogedit, @MDAY & "/" & @MON & "_" & @HOUR & ":" & @MIN & " " & $logtext & @CRLF) EndIf _FileWriteLog($logfile & $logfiletimerange & ".txt", $logtext) EndIf $lastlog = "sicrlf" EndIf EndFunc ;==>GOLLOG Func cleanedit() ; cleaning of edit every n° lines (in program put if $nlines > xlines then this function) GUICtrlDelete($Gollogedit) $Gollogedit = GUICtrlCreateEdit("", $geleft, $getop, $gewidth, $geheight) ;, BitOR($ES_AUTOVSCROLL, $ES_AUTOHSCROLL, $ES_WANTRETURN, $WS_BORDER)) GUICtrlSetData(-1, "" & @CRLF) GUICtrlSetFont(-1, 9, 800, 0, "consolas") GUICtrlSetColor(-1, 0090608) GUICtrlSetBkColor(-1, 0xF0DAE5) GUICtrlSetCursor(-1, 3) EndFunc ;==>cleanedit Func GOLzipLOG($months2NOTzip) ; zipping old log leaving unzipped only n months GOLLOG("Starting old logs zipping..") ; path extraction zone Local $logfiletimerange = @YEAR & @MON Local $sDrive = "", $sDir = "", $sFileName = "", $sExtension = "" Local $arraylogpath = _PathSplit($logfile & $logfiletimerange & ".txt", $sDrive, $sDir, $sFileName, $sExtension) Local $logpath = $arraylogpath[1] & $arraylogpath[2] Local $hSearch = FileFindFirstFile($logfile & "*.txt") ; searching for logs Local $logconta = 0 While 1 ; single file processing cycle Local $sFileName = FileFindNextFile($hSearch) ; If there is no more file matching the search. If @error Then ExitLoop Local $stringtime = StringTrimRight(StringRight($sFileName, 10), 4) ;obtaining year-month like 201609 If $logfiletimerange - $stringtime > $months2NOTzip Then ;zipping If Not FileExists($logfile & ".zip") Then If Not _Zip_Create($logfile & ".zip", 1) Then GOLLOG("Error " & @error & " creating " & $logfile & ".zip") Else GOLLOG("Created new log archive: " & $logfile & ".zip") EndIf Else GOLLOG("adding to archive: " & $logfile & ".zip") EndIf If Not _zip_additem($logfile & ".zip", $logpath & $sFileName) Then GOLLOG("Error " & @error & " zipping: " & $logpath & $sFileName) Else GOLLOG("Added: " & $logpath & $sFileName) $logconta += 1 If Not FileDelete($logpath & $sFileName) Then GOLLOG("ERROR - Unable to DELETE log file " & $logpath & $sFileName) EndIf EndIf EndIf WEnd GOLLOG("Finished = " & $logconta & " log files zipped") EndFunc ;==>GOLzipLOG Func CFGctrl() ; check ini files and load section names GOLLOG("checkin' INI file..|nocrlf50") If FileExists($inifile) Then $guiactive = IniRead($inifile, "general", "GUI", "?") If $guiactive = "?" Then GOLLOG("INI incomplete, missing section 'general', value GUI") ExitwithError() EndIf $flagITA = IniRead($inifile, "general", "dataITA", "?") If $flagITA = "?" Then GOLLOG("INI incomplete, missing section 'general', value dataITA") ExitwithError() EndIf $flagpwdLastSet = IniRead($inifile, "general", "pwdLastSet", "?") If $flagpwdLastSet = "?" Then GOLLOG("INI incomplete, missing section 'general', value pwdLastSet") ExitwithError() EndIf GOLLOG("reading section names...|nocrlf50") $arrayINIsections = IniReadSectionNames($inifile) GOLLOG("N°" & $arrayINIsections[0] - 1 & " groups to process") Else $message1 = "error: no saved settings !?" GOLLOG($message1) ExitwithError() EndIf GOLLOG("..completed") EndFunc ;==>CFGctrl Func CFGload($section) ; load single ini file section values $INIgroup = IniRead($inifile, $section, "group", "?") $INItomail = IniRead($inifile, $section, "tomail", "?") $INItosend = IniRead($inifile, $section, "tosend", "?") $INIdays1 = IniRead($inifile, $section, "days1", "?") $INIdays2 = IniRead($inifile, $section, "days2", "?") $INImailsubject = IniRead($inifile, $section, "mailsubject", "?") $INIsmpt = IniRead($inifile, $section, "smtp", "?") $INIfromname = IniRead($inifile, $section, "fromname", "?") $INIfromaddress = IniRead($inifile, $section, "fromaddress", "?") EndFunc ;==>CFGload Func ExitwithError() GOLLOG("**********ERROR and STOP****************") Exit EndFunc ;==>ExitwithError The example .ini:
       
      [group1] group=G_IT_PASSWORD_MONITORED days1=5 days2=2 tomail=yourgroup@yourdomain.it ;tosend=user; send mails to the domain user mail address, otherwise send to specified address tosend=0 ;tosend ;1 send mails, 0 disable mails for testing mailsubject=Domain users going to expire passwords smtp=smtp.your.own.server fromname=Password Expiration Guardian fromaddress=PEG@NSC.it [group2] group=G_IT_PASSWORD_NOTIFIED days1=5 days2=2 tomail=user ;tosend=user; send mails to the domain user mail address, otherwise send to specified address tosend=0 ;tosend ;1 send mails, 0 disable mails for testing mailsubject=Password is expiring ! smtp=smtp.your.own.server fromname=Password Expiration Guardian fromaddress=PEG@NSC.it [general] GUI=1 ;1 gui ON for testing, 0 gui disabled dataITA = 1 ;1 translates datetime in italian, 0 for ENG pwdLastSet = 0 ;1 tries to reset the 'pwdLastSet' attribute (you must have permissions), 0 do nothing  
       
    • Ubermensch
      By Ubermensch
      Hello,
      I am currently trying to automatically click the "Yes" button in the ActiveX prompt/popup message after opening the IE (html).
      At 1st, I encounter the "Allow Blocked Content". I already resolve it just by changing settings in the IE Options. But after resolving the "Allow Blocked Content", there's a popup message appear.
      I have attached the ActiveX Prompt.
      Here is the 1st code that I try to use.
      #include <IE.au3> #include <MsgBoxConstants.au3> #include <WinAPI.au3> _IECreate("C:\Users\april\Documents\Logo\JRB\AutoIt\AutoBOT\AWD10\sampleAWD10.html",0,1,0) Local $oIE = _IEAttach("", "instance", 1) _IELoadWait($oIE) AdlibRegister("_ActiveXRun",250) Local $oLastName = _IEGetObjByName($oIE, "Text4") Local $oGetItem = _IEGetObjByName($oIE, "getitem") _IEAction($oGetItem, "click") MsgBox($MB_SYSTEMMODAL, "Form Element Value", _IEFormElementGetValue($oGetItem)) Func _ActiveXRun() $retWin = WinGetHandle("[Class:Button]","") $winTitle = "[HANDLE:" & $retWin &"]" $ctrlHandle = ControlGetHandle($winTitle,"", "[CLASS:Button; INSTANCE:2]") $ctrlTitle = "HANDLE:" & $ctrlHandle &"]" WinWaitActive($ctrlTitle,"[CLASS:Button; INSTANCE:2]",10) $k = ControlGetPos($winTitle, "","[CLASS:Button; INSTANCE:2]") $x = $k[0] $y = $k[1] WinActivate ($winTitle,"An ActiveX control on this page might be unsafe to interact with other parts of the page. Do you want to allow this interaction?") ControlFocus($winTitle,"An ActiveX control on this page might be unsafe to interact with other parts of the page. Do you want to allow this interaction?","[CLASS:Button; INSTANCE:2]") ControlClick($winTitle, "","[CLASS:Button; INSTANCE:2]","primary",1,$x,$y) ControlSend($winTitle, "", "[CLASS:Button; INSTANCE:2]", "{ENTER}", 0) EndFunc Here is the console output.
      >"C:\Program Files (x86)\AutoIt3\SciTE\..\AutoIt3.exe" "C:\Program Files (x86)\AutoIt3\SciTE\AutoIt3Wrapper\AutoIt3Wrapper.au3" /run /prod /ErrorStdOut /in "C:\Users\april\Documents\Logo\JRB\AutoIt\AutoBOT\AWD10\AWD10.1.au3" /UserParams +>12:44:11 Starting AutoIt3Wrapper v.17.224.935.0 SciTE v.3.7.3.0 Keyboard:00000409 OS:WIN_10/ CPU:X64 OS:X64 Environment(Language:0409) CodePage:0 utf8.auto.check:4 +> SciTEDir => C:\Program Files (x86)\AutoIt3\SciTE UserDir => C:\Users\april\AppData\Local\AutoIt v3\SciTE\AutoIt3Wrapper SCITE_USERHOME => C:\Users\april\AppData\Local\AutoIt v3\SciTE >Running AU3Check (3.3.14.2) from:C:\Program Files (x86)\AutoIt3 input:C:\Users\april\Documents\Logo\JRB\AutoIt\AutoBOT\AWD10\AWD10.1.au3 +>12:44:11 AU3Check ended.rc:0 >Running:(3.3.14.2):C:\Program Files (x86)\AutoIt3\autoit3.exe "C:\Users\april\Documents\Logo\JRB\AutoIt\AutoBOT\AWD10\AWD10.1.au3" --> Press Ctrl+Alt+Break to Restart or Ctrl+Break to Stop "C:\Users\april\Documents\Logo\JRB\AutoIt\AutoBOT\AWD10\AWD10.1.au3" (31) : ==> Subscript used on non-accessible variable.: $x = $k[0] $x = $k^ ERROR ->12:44:24 AutoIt3.exe ended.rc:1 +>12:44:24 AutoIt3Wrapper Finished. >Exit code: 1 Time: 13.76 I also tried a simpler code.
      include <IE.au3> #include <MsgBoxConstants.au3> #include <WinAPI.au3> _IECreate("C:\Users\april\Documents\Logo\JRB\AutoIt\AutoBOT\AWD10\sampleAWD10.html",0,1,0) Local $oIE = _IEAttach("", "instance", 1) _IELoadWait($oIE) $k = ControlGetPos("[CLASS:#32770]", "","[CLASS:Button; INSTANCE:2]") $x = $k[0] $y = $k[1] ControlClick("[CLASS:#32770]", "","[CLASS:Button; INSTANCE:2]","primary",1,$x,$y) Local $oLastName = _IEGetObjByName($oIE, "Text4") Local $oGetItem = _IEGetObjByName($oIE, "getitem") _IEAction($oGetItem, "click") MsgBox($MB_SYSTEMMODAL, "Form Element Value", _IEFormElementGetValue($oGetItem)) There's no error in the console output for the 2nd code I have tried.
      And here is the Window Info for the ActiveX prompt.
      >>>> Window <<<< Title: Internet Explorer Class: #32770 Position: 580, 338 Size: 376, 146 Style: 0x94C808C4 ExStyle: 0x00010101 Handle: 0x00000000001516FA >>>> Control <<<< Class: Button Instance: 2 ClassnameNN: Button2 Name: Advanced (Class): [CLASS:Button; INSTANCE:2] ID: 1 Text: &Yes Position: 184, 77 Size: 80, 22 ControlClick Coords: 37, 12 Style: 0x50010000 ExStyle: 0x00000004 Handle: 0x00000000001215DE >>>> Mouse <<<< Position: 228, 120 Cursor ID: 0 Color: 0xFFFFFF >>>> StatusBar <<<< >>>> ToolsBar <<<< >>>> Visible Text <<<< &No An ActiveX control on this page might be unsafe to interact with other parts of the page. Do you want to allow this interaction? &Yes >>>> Hidden Text <<<<  

    • legend
      By legend
      Hello
      I'm using the code below to send mails using our internal relay server. 
      We got a Helpdesk system named Remedy. Our users can send us a mails using outlook 2010, and we'll get a ticket.
      The problem is if I send a mail using the above script our ticket system can't display unicode characters, like ex: Æ Ø Å. It will display them as: questionmarks: "? ? ?" inside our ticket system. In the outlook inbox it looks fine showing unicode symbols, but in our ticket system the unicode characters will be replaced by questionmarks.
      The thing is, if they send a mail using outlook, it works fine, but using the script above it doesen't.
      I tried to save my script with encoding: UTF-8 with BOM, but it didn't fix it.
       
      All suggestions are very welcome
       
       
       
       
    • mLipok
      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:
       
    • mLipok
      By mLipok
      I want to present POP3.au3 UDF.
      Support topic is here: POP3.au3 UDF
       
      REMARK:
      Quoted-printable.au3 author @ProgAndy
      https://autoit.de/index.php/Thread/11350-UTF8-Sting-Convertieren/?postID=87721#post87721
       
×