mLipok

Chilkat.au3 UDF

5 posts in this topic

#1 ·  Posted (edited)

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, 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:

 

Edited by mLipok

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 - BETA * 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 * Best coding practices * 

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: 2017-06-04

Share this post


Link to post
Share on other sites



New version:

0.1.2
    2017/02/08
    .   Chnaged: few refactoring - mLipok
    .   Added: Function: _Chilkat_CSV_StringToArray() - mLipok
    .   Added: Function: _Chilkat_JSON_ObjFromString() - mLipok
    .   Added: Function: _Chilkat_JSON_ObjToString() - mLipok
    .   Added: $CHILKATOBJ_API - modes beginning for support to create object for future Chilkat Component version - mLipok

 


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 - BETA * 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 * Best coding practices * 

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: 2017-06-04

Share this post


Link to post
Share on other sites

As an example of how to use Chilkat.au3 UDF, you can check  TeamViewer.au3 UDF here:

 


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 - BETA * 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 * Best coding practices * 

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: 2017-06-04

Share this post


Link to post
Share on other sites

Example showing how to create CSV file from the scratch:
 

Func _Example_CSV_CreateFile()
    _Log_ChilkatExample('_Example_CSV_CreateFile')

    ;  https://www.example-code.com/vbscript/csv_create.asp
    Local $oCSV = _Chilkat_CSV_ObjCreate()
    If @error Then MsgBox($MB_ICONERROR, 'CSV ObjectCreate', '@error = ' & @error & @CRLF & '@extended = ' & @extended)

    ;  Indicate that the 1st row
    ;  should be treated as column names:
    $oCSV.HasColumnNames = True ;

    Local $bSuccess = $oCSV.SetColumnName(0, "year")
    $bSuccess = $oCSV.SetColumnName(1, "color")
    $bSuccess = $oCSV.SetColumnName(2, "country")
    $bSuccess = $oCSV.SetColumnName(3, "food")

    $bSuccess = $oCSV.SetCell(0, 0, "2001")
    $bSuccess = $oCSV.SetCell(0, 1, "red")
    $bSuccess = $oCSV.SetCell(0, 2, "France")
    $bSuccess = $oCSV.SetCell(0, 3, "cheese")

    $bSuccess = $oCSV.SetCell(1, 0, "2005")
    $bSuccess = $oCSV.SetCell(1, 1, "blue")
    $bSuccess = $oCSV.SetCell(1, 2, "United States")
    $bSuccess = $oCSV.SetCell(1, 3, "hamburger")

    ;  Write the CSV to a string and display:
    Local $sCSV_String ;
    $sCSV_String = $oCSV.SaveToString() ;
    MsgBox(0, '', $sCSV_String)

    ;  Save the CSV to a file:
    $bSuccess = $oCSV.SaveFile("_Example_CSV_CreateFile_Result.csv") ;
    If Not $bSuccess Then ConsoleWrite($oCSV.LastErrorText)

EndFunc   ;==>_Example_CSV_CreateFile

 


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 - BETA * 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 * Best coding practices * 

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: 2017-06-04

Share this post


Link to post
Share on other sites

Here is variation about previous example:
 

Func _Example_CSV_CreateFile()
    _Log_ChilkatExample('_Example_CSV_CreateFile')

    ; https://www.example-code.com/vbscript/csv_create.asp

    ;  Indicate that the 1st row
    ;  should be treated as column names:
    __MY_CSV_API(Null)
    __MY_CSV_API("year", "color", "country", "food")
    __MY_CSV_API("2001", "red", "France", "cheese")
    __MY_CSV_API("2005", "blue", "United States", "hamburger")

    Local $oCSV = __MY_CSV_API()

    ;  Write the CSV to a string and display:
    Local $sCSV_String
    $sCSV_String = $oCSV.SaveToString()
    MsgBox(0, '', $sCSV_String)

    ;  Save the CSV to a file:
    Local $bSuccess = $oCSV.SaveFile("_Example_CSV_CreateFile_Result.csv")
    If Not $bSuccess Then ConsoleWrite($oCSV.LastErrorText)

EndFunc   ;==>_Example_CSV_CreateFile

Func __MY_CSV_API($vCol0 = Default, $vCol1 = Default, $vCol2 = Default, $vCol3 = Default)
    Local Static $oCSV = Null

    If $vCol0 = Null Or $oCSV = Null Then ; Create New Object
        $oCSV = _Chilkat_CSV_ObjCreate()
        $oCSV.HasColumnNames = True
    ElseIf $vCol0 = Default And $vCol1 = Default And $vCol2 = Default And $vCol3 = Default Then
        Return $oCSV
    ElseIf $oCSV.NumColumns = 0 Then
        $oCSV.SetColumnName(0, $vCol0)
        $oCSV.SetColumnName(1, $vCol1)
        $oCSV.SetColumnName(2, $vCol2)
        $oCSV.SetColumnName(3, $vCol3)
    Else
        Local $iRow = $oCSV.NumRows
        $oCSV.SetCell($iRow, 0, $vCol0)
        $oCSV.SetCell($iRow, 1, $vCol1)
        $oCSV.SetCell($iRow, 2, $vCol2)
        $oCSV.SetCell($iRow, 3, $vCol3)
    EndIf

EndFunc   ;==>__MY_CSV_API

 


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 - BETA * 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 * Best coding practices * 

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: 2017-06-04

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

    • mLipok
      By mLipok
      ; #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 ; ================================================================================ This is an UDF modest beginning for Chilkat component:
      https://www.chilkatsoft.com/downloads_ActiveX.asp
      Some of AcitveX object bundled int this component (dll file) are Free, some other are commercial.

      Support topic: