Jump to content

Recommended Posts

Posted (edited)

In the past there was many questions about how to: "Automatic file upload using without user interaction"

https://www.autoitscript.com/forum/topic/92907-ie-8-input-namenomfic-typefile-idnomfic/
https://www.autoitscript.com/forum/topic/116899-cant-automate-input-typefile-tag-in-ie/?tab=comments#comment-815478
https://www.autoitscript.com/forum/topic/14883-input-typefile/
https://www.autoitscript.com/forum/topic/188708-how-to-set-the-value-of-an-input-typefile-element/
https://www.autoitscript.com/forum/topic/91513-how-can-i-auto-set-file-path-for-input-file-in-ie/
https://www.autoitscript.com/forum/topic/116899-cant-automate-input-typefile-tag-in-ie/
https://www.autoitscript.com/forum/topic/169190-how-to-script-file-upload-button/
https://www.autoitscript.com/forum/topic/145327-how-to-deal-with-ie-window-for-upload-a-fileinput-typefile/
https://www.autoitscript.com/forum/topic/140482-internet-explorer-input-file-problem/

 

I found solution here: 
https://stackoverflow.com/questions/33253517/upload-a-file-via-input-input-in-html-form-with-vba
and:
https://www.motobit.com/tips/detpg_uploadvbsie/

And I translate this code to AutoIt3 code:

; Upload file using http protocol And multipart/form-data
; v1.01
; 2001 Antonin Foller, PSTRUH Software
Global $oErrorHandler = ObjEvent("AutoIt.Error", _ErrFunc)

do_vbsUpload()

Func do_vbsUpload()

#cs
    ; We need at least two arguments (File & URL)

    ConsoleWrite('- ' & @ScriptLineNumber & @CRLF)

    If $CmdLine[0] < 2 Then InfoEcho()
    ConsoleWrite('- ' & @ScriptLineNumber & @CRLF)

    ; Are some required objects missing?
    If StringInStr(CheckRequirements(), "Error") > 0 Then InfoEcho()
    ConsoleWrite('- ' & @ScriptLineNumber & @CRLF)

    Local $s_FileName, $s_DestURL, $s_FieldName
    $s_FieldName = "FileField" ; Default field name

    For $i_argCounter = 1 To $CmdLine[0]
        ConsoleWrite('+ '& $i_argCounter& ' >> '  & $CmdLine[$i_argCounter] & @CRLF)
        Select
            Case $i_argCounter = 1
;~              $s_FileName = $CmdLine[$i_argCounter]
                $s_FileName = @ScriptFullPath
            Case $i_argCounter = 2
                $s_DestURL = $CmdLine[$i_argCounter]
            Case $i_argCounter = 3
                $s_FieldName = $CmdLine[$i_argCounter]
        EndSelect
    Next

    UploadFile($s_DestURL, $s_FileName, $s_FieldName)
#ce

    UploadFile('http://www.dobeash.com/test.html', @ScriptFullPath, 'fileExample')

EndFunc   ;==>do_vbsUpload


; ******************* upload - begin
; Upload file using input type=file
Func UploadFile($s_DestURL, $s_FileName, $s_FieldName)
    ; Boundary of fields.

    ; Be sure this string is Not In the source file
    Const $Boundary = "---------------------------0123456789012"

    ; Get source file As a binary data.
    Local $d_FileContents = GetFile($s_FileName)

    ; Build multipart/form-data document
    Local $s_FormData = BuildFormData($d_FileContents, $Boundary, $s_FileName, $s_FieldName)

    ; Post the data To the destination URL
    IEPostBinaryRequest($s_DestURL, $s_FormData, $Boundary)
EndFunc   ;==>UploadFile

; Build multipart/form-data document with file contents And header info
Func BuildFormData($d_FileContents, $Boundary, $s_FileName, $s_FieldName)
    Const $s_ContentType = "application/upload"

    ; The two parts around file contents In the multipart-form data.
    Local $s_Pre = "--" & $Boundary & @CRLF & mpFields($s_FieldName, $s_FileName, $s_ContentType)
    Local $s_Po = @CRLF & "--" & $Boundary & "--" & @CRLF

    ; Build form data using recordset binary field
    Const $i_adLongVarBinary = 205
    Local $oRS = ObjCreate("ADODB.Recordset")
    ; https://docs.microsoft.com/en-us/sql/ado/reference/ado-api/append-method-ado?view=sql-server-ver15
    $oRS.Fields.Append("b", $i_adLongVarBinary, StringLen($s_Pre) + BinaryLen($d_FileContents) + StringLen($s_Po))
    $oRS.Open()
    $oRS.AddNew()

    ; Convert Pre string value To a binary data
    Local $i_LenData = StringLen($s_Pre)
    $oRS("b").AppendChunk(StringToMB($s_Pre) & StringToBinary(Chr(0)))
    $s_Pre = $oRS("b").GetChunk($i_LenData)
    $oRS("b") = ""

    ; Convert Po string value To a binary data
    $i_LenData = StringLen($s_Po)
    $oRS("b").AppendChunk(StringToMB($s_Po) & StringToBinary(Chr(0)))
    $s_Po = $oRS("b").GetChunk($i_LenData)
    $oRS("b") = ""

    ; Join Pre & $d_FileContents & Po binary data
    $oRS("b").AppendChunk($s_Pre)
    $oRS("b").AppendChunk($d_FileContents)
    $oRS("b").AppendChunk($s_Po)
    $oRS.Update()
    Local $s_FormData = $oRS("b")
    $oRS.Close()
    Return $s_FormData
EndFunc   ;==>BuildFormData

; sends multipart/form-data To the URL using IE
Func IEPostBinaryRequest($s_URL, $s_FormData, $Boundary)
    ; Create InternetExplorer
    Local $oIE = ObjCreate("InternetExplorer.Application")

    ; You can uncoment Next line To see form results
    $oIE.Visible = True

    ; Send the form data To $s_URL As POST multipart/form-data request
    $oIE.Navigate($s_URL, '', '', $s_FormData, _
            "Content-Type: multipart/form-data; boundary=" & $Boundary & @CRLF)

    While $oIE.Busy
        Wait(1, "Upload To " & $s_URL)
    WEnd

    ; Get a result of the script which has received upload
;~   On Error Resume Next
    Local $s_IE_InnerHTML = $oIE.Document.body.innerHTML
    MsgBox(0, 'TEST #' & @CRLF & @ScriptLineNumber, $s_IE_InnerHTML)
    $oIE.Quit()
    Return $s_IE_InnerHTML
EndFunc   ;==>IEPostBinaryRequest

; Infrormations In form field header.
Func mpFields($s_FieldName, $s_FileName, $s_ContentType)
    Local $s_MPTemplate = _ ; template For multipart header
            'Content-Disposition: form-data; name="{field}";' & _
            'FileName="{file}"' & @CRLF & _
            'Content-Type: {ct}' & @CRLF & @CRLF & _
            ''
    Local $s_Out
    $s_Out = StringReplace($s_MPTemplate, "{field}", $s_FieldName)
    $s_Out = StringReplace($s_Out, "{file}", $s_FileName)
    $s_Out = StringReplace($s_Out, "{ct}", $s_ContentType)
    Return $s_Out
EndFunc   ;==>mpFields


Func Wait($i_Seconds, $s_Message)
    MsgBox(64, '', $s_Message, $i_Seconds)
EndFunc   ;==>Wait


; Returns file contents As a binary data
Func GetFile($s_FileName)
    Local $oStream = ObjCreate("ADODB.Stream")
    $oStream.Type = 1 ; Binary
    $oStream.Open()
    $oStream.LoadFromFile($s_FileName)
    Local $d_GetFile = $oStream.Read()
    $oStream.Close()

    Return $d_GetFile
EndFunc   ;==>GetFile

; Converts OLE string To multibyte string
Func StringToMB($S)
    Local $I, $B
    For $I = 1 To StringLen($S)
        $B &= StringToBinary(Asc(StringMid($S, $I, 1)))
    Next
    Return $B
EndFunc   ;==>StringToMB
; ******************* upload - end

; ******************* Support
; Basic script info
Func InfoEcho()
    Local $sMsg = _
            "Upload file using http And multipart/form-data" & @CRLF & _
            "Copyright (C) 2001 Antonin Foller, PSTRUH Software" & @CRLF & _
            "use" & @CRLF & _
            "[cscript|wscript] fupload.vbs file $s_URL [fieldname]" & @CRLF & _
            "  file ... Local file To upload" & @CRLF & _
            "  $s_URL ... $s_URL which can accept uploaded data" & @CRLF & _
            "  fieldname ... Name of the source form field." & @CRLF & _
            @CRLF & CheckRequirements() & @CRLF & _
            ""
    ConsoleWrite('! ' & $sMsg & @CRLF)
EndFunc   ;==>InfoEcho

; Checks If all of required objects are installed
Func CheckRequirements()
    Local $sMsg = _
            "This script requires some objects installed To run properly." & @CRLF & _
            CheckOneObject("ADODB.Recordset") & @CRLF & _
            CheckOneObject("ADODB.Stream") & @CRLF & _
            CheckOneObject("InternetExplorer.Application") & @CRLF & _
            ""
    Return $sMsg
    ;   $sMsgBox $sMsg
EndFunc   ;==>CheckRequirements

; Checks If the one object is installed.
Func CheckOneObject($sClassName)
    Local $sMsg
    ObjCreate($sClassName)
    If @error = 0 Then
        $sMsg = "OK"
    Else
        $sMsg = "Error:" & @error
    EndIf
    Return $sClassName & " - " & $sMsg
EndFunc   ;==>CheckOneObject
; ******************* Support - end


 ; User's COM error function. Will be called if COM error occurs
Func _ErrFunc(ByRef $oError)
        ; Do anything here.
        ConsoleWrite(@ScriptName & " (" & $oError.scriptline & ") : ==> COM Error intercepted !" & @CRLF & _
                        @TAB & "err.number is: " & @TAB & @TAB & "0x" & Hex($oError.number) & @CRLF & _
                        @TAB & "err.windescription:" & @TAB & $oError.windescription & @CRLF & _
                        @TAB & "err.description is: " & @TAB & $oError.description & @CRLF & _
                        @TAB & "err.source is: " & @TAB & @TAB & $oError.source & @CRLF & _
                        @TAB & "err.helpfile is: " & @TAB & $oError.helpfile & @CRLF & _
                        @TAB & "err.helpcontext is: " & @TAB & $oError.helpcontext & @CRLF & _
                        @TAB & "err.lastdllerror is: " & @TAB & $oError.lastdllerror & @CRLF & _
                        @TAB & "err.scriptline is: " & @TAB & $oError.scriptline & @CRLF & _
                        @TAB & "err.retcode is: " & @TAB & "0x" & Hex($oError.retcode) & @CRLF & @CRLF)
EndFunc   ;==>_ErrFunc

 

But I miss something and the code not works as intendend.

Please join and contribute, in solving this issue, as this will be handy for entire community.

@mLipok

 

btw.
I think that this may be realated to ChrB() which I simply translate to StringToBinary()

Especialy this :

StringToBinary(Chr(0)))

could be the main issue.

But for now I'm tired and going to sleep.
Hope maybe tomorrow somebody solve this issue.

 

Edited by mLipok

Signature beginning:
Please remember: "AutoIt"..... *  Wondering who uses AutoIt and what it can be used for ? * Forum Rules *
ADO.au3 UDF * POP3.au3 UDF * XML.au3 UDF * IE on Windows 11 * How to ask ChatGPT for AutoIt Codefor 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 APIErrorLog.au3 UDF - A logging Library * Include Dependency Tree (Tool for analyzing script relations) * Show_Macro_Values.au3 *

 

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 * Dual Monitor resolution detection * * 2GUI on Dual Monitor System * _SciLexer.au3 UDF * SciTE - Lexer for console pane

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 * 

OpenOffice/LibreOffice/XLS Related: WriterDemo.au3 * XLS/MDB from scratch with ADOX

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) * IE in TaskSchedulerIE Embedded Control Versioning (use IE9+ and HTML5 in a GUI) * PDF Related:How to get reference to PDF object embeded in IE * IE on Windows 11

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 *

I also encourage you to check awesome @trancexx code:  * Create COM objects from modules without any demand on user to register anything. * Another COM object registering stuffOnHungApp handlerAvoid "AutoIt Error" message box in unknown errors  * HTML editor

winhttp.au3 related : * https://www.autoitscript.com/forum/topic/206771-winhttpau3-download-problem-youre-speaking-plain-http-to-an-ssl-enabled-server-port/

"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: 2023-04-24

Posted

small fix:

Func BuildFormData($d_FileContents, $Boundary, $s_FileName, $s_FieldName)
    Const $s_ContentType = "application/upload"

    ; The two parts around file contents In the multipart-form data.
    Local $s_Pre = "--" & $Boundary & @CRLF & mpFields($s_FieldName, $s_FileName, $s_ContentType)
    Local $s_Po = @CRLF & "--" & $Boundary & "--" & @CRLF

    ; Build form data using recordset binary field
    Const $i_adLongVarBinary = 205
    Local $oRS = ObjCreate("ADODB.Recordset")
    ; https://docs.microsoft.com/en-us/sql/ado/reference/ado-api/append-method-ado?view=sql-server-ver15
    $oRS.Fields.Append("b", $i_adLongVarBinary, StringLen($s_Pre) + BinaryLen($d_FileContents) + StringLen($s_Po))
    $oRS.Open()
    $oRS.AddNew()

    ; Convert Pre string value To a binary data
    Local $i_LenData = StringLen($s_Pre)
    $oRS.Fields.Item("b").AppendChunk(StringToMB($s_Pre) & StringToBinary(Chr(0)))
    $s_Pre = $oRS.Fields.Item("b").GetChunk($i_LenData)
    $oRS.Fields.Item("b") = ""

    ; Convert Po string value To a binary data
    $i_LenData = StringLen($s_Po)
    $oRS.Fields.Item("b").AppendChunk(StringToMB($s_Po) & StringToBinary(Chr(0)))
    $s_Po = $oRS.Fields.Item("b").GetChunk($i_LenData)
    $oRS.Fields.Item("b") = ""

    ; Join Pre & $d_FileContents & Po binary data
    $oRS.Fields.Item("b").AppendChunk($s_Pre)
    $oRS.Fields.Item("b").AppendChunk($d_FileContents)
    $oRS.Fields.Item("b").AppendChunk($s_Po)
    $oRS.Update()
    Local $s_FormData = $oRS.Fields.Item("b")
    $oRS.Close()
    Return $s_FormData
EndFunc   ;==>BuildFormData

not yet finished.

 

Signature beginning:
Please remember: "AutoIt"..... *  Wondering who uses AutoIt and what it can be used for ? * Forum Rules *
ADO.au3 UDF * POP3.au3 UDF * XML.au3 UDF * IE on Windows 11 * How to ask ChatGPT for AutoIt Codefor 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 APIErrorLog.au3 UDF - A logging Library * Include Dependency Tree (Tool for analyzing script relations) * Show_Macro_Values.au3 *

 

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 * Dual Monitor resolution detection * * 2GUI on Dual Monitor System * _SciLexer.au3 UDF * SciTE - Lexer for console pane

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 * 

OpenOffice/LibreOffice/XLS Related: WriterDemo.au3 * XLS/MDB from scratch with ADOX

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) * IE in TaskSchedulerIE Embedded Control Versioning (use IE9+ and HTML5 in a GUI) * PDF Related:How to get reference to PDF object embeded in IE * IE on Windows 11

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 *

I also encourage you to check awesome @trancexx code:  * Create COM objects from modules without any demand on user to register anything. * Another COM object registering stuffOnHungApp handlerAvoid "AutoIt Error" message box in unknown errors  * HTML editor

winhttp.au3 related : * https://www.autoitscript.com/forum/topic/206771-winhttpau3-download-problem-youre-speaking-plain-http-to-an-ssl-enabled-server-port/

"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: 2023-04-24

Posted (edited)

still not working but... modified code:

; https://www.motobit.com/tips/detpg_uploadvbsie/
; Upload file using http protocol And multipart/form-data
; v1.01
; 2001 Antonin Foller, PSTRUH Software
Global $oErrorHandler = ObjEvent("AutoIt.Error", _ErrFunc)

do_vbsUpload()

Func do_vbsUpload()

;~  UploadFile('http://www.dobeash.com/test.html', @ScriptFullPath, 'fileExample')
    UploadFile('http://www.dobeash.com/test.html', @ScriptName, 'fileExample')

EndFunc   ;==>do_vbsUpload


; ******************* upload - begin
; Upload file using input type=file
Func UploadFile($s_DestURL, $s_FileName, $s_FieldName)
    ; Boundary of fields.

    ; Be sure this string is Not In the source file
    Const $Boundary = "---------------------------0123456789012"

    ; Get source file As a binary data.
    Local $d_FileContents = GetFile($s_FileName)
    MsgBox(0, @ScriptLineNumber & ' ' & VarGetType($d_FileContents), BinaryToString($d_FileContents))


    ; Build multipart/form-data document
    Local $s_FormData = BuildFormData($d_FileContents, $Boundary, $s_FileName, $s_FieldName)

    MsgBox(0, @ScriptLineNumber & ' ' & VarGetType($s_FormData) & ' ' & BinaryLen($s_FormData), $s_FormData)
    ; Post the data To the destination URL
    IEPostBinaryRequest($s_DestURL, $s_FormData, $Boundary)
EndFunc   ;==>UploadFile

; Build multipart/form-data document with file contents And header info
Func BuildFormData($d_FileContents, $Boundary, $s_FileName, $s_FieldName)
    Const $s_ContentType = "application/upload"

    ; The two parts around file contents In the multipart-form data.
    Local $s_Pre = "--" & $Boundary & @CRLF & mpFields($s_FieldName, $s_FileName, $s_ContentType)
    Local $s_Po = @CRLF & "--" & $Boundary & "--" & @CRLF

    MsgBox(0, @ScriptLineNumber & '', $s_Pre)
    MsgBox(0, @ScriptLineNumber & '', $s_Po)

    ; Build form data using recordset binary field
    Const $i_adLongVarBinary = 205
    Local $oRS = ObjCreate("ADODB.Recordset")
    ; https://docs.microsoft.com/en-us/sql/ado/reference/ado-api/append-method-ado?view=sql-server-ver15
    $oRS.Fields.Append("b", $i_adLongVarBinary, StringLen($s_Pre) + BinaryLen($d_FileContents) + StringLen($s_Po))
    $oRS.Open()
    $oRS.AddNew()

    ; Convert Pre string value To a binary data
    Local $i_LenData = StringLen($s_Pre)
    $oRS.Fields("b").AppendChunk(StringToMB($s_Pre) & StringToBinary(Chr(0)))
    $oRS.Update()
    $s_Pre = $oRS.Fields("b").GetChunk($i_LenData)
    $oRS.Fields("b") = ""

    ; Convert Po string value To a binary data
    $i_LenData = StringLen($s_Po)
    $oRS.Fields("b").AppendChunk(StringToMB($s_Po) & StringToBinary(Chr(0)))
    $oRS.Update()
    $s_Po = $oRS.Fields("b").GetChunk($i_LenData)
    $oRS.Fields("b") = ""

    ; Join Pre & $d_FileContents & Po binary data
    $oRS.Fields("b").AppendChunk($s_Pre)
    $oRS.Fields("b").AppendChunk($d_FileContents)
    $oRS.Fields("b").AppendChunk($s_Po)
    $oRS.Update()
    Local $s_FormData = $oRS.Fields("b").value
    $oRS.Close()
    Return $s_FormData
EndFunc   ;==>BuildFormData

; sends multipart/form-data To the URL using IE
Func IEPostBinaryRequest($s_URL, $s_FormData, $Boundary)
    ; Create InternetExplorer
    Local $oIE = ObjCreate("InternetExplorer.Application")

    ; You can uncoment Next line To see form results
    $oIE.Visible = True

    ; Send the form data To $s_URL As POST multipart/form-data request
    $oIE.Navigate($s_URL, '', '', $s_FormData, _
            "Content-Type: multipart/form-data; boundary=" & $Boundary & @CRLF)

    While $oIE.Busy
        Wait(1, "Upload To " & $s_URL)
    WEnd

    ; Get a result of the script which has received upload
;~   On Error Resume Next
    Local $s_IE_InnerHTML = $oIE.Document.body.innerHTML
    MsgBox(0, @ScriptLineNumber & ' TEST', $s_IE_InnerHTML)
    $oIE.Quit()
    Return $s_IE_InnerHTML
EndFunc   ;==>IEPostBinaryRequest

; Infrormations In form field header.
Func mpFields($s_FieldName, $s_FileName, $s_ContentType)
    Local $s_MPTemplate = _ ; template For multipart header
            'Content-Disposition: form-data; name="{field}";' & _
            'FileName="{file}"' & @CRLF & _
            'Content-Type: {ct}' & @CRLF & @CRLF & _
            ''
    Local $s_Out
    $s_Out = StringReplace($s_MPTemplate, "{field}", $s_FieldName)
    $s_Out = StringReplace($s_Out, "{file}", $s_FileName)
    $s_Out = StringReplace($s_Out, "{ct}", $s_ContentType)
    Return $s_Out
EndFunc   ;==>mpFields

Func Wait($i_Seconds, $s_Message)
    MsgBox(64, '', $s_Message, $i_Seconds)
EndFunc   ;==>Wait


; Returns file contents As a binary data
Func GetFile($s_FileName)
    Local $oStream = ObjCreate("ADODB.Stream")
    $oStream.Type = 1 ; Binary
    $oStream.Open()
    $oStream.LoadFromFile(@ScriptDir & '\' & $s_FileName)
    Local $d_GetFile = $oStream.Read()
    $oStream.Close()

    Return $d_GetFile
EndFunc   ;==>GetFile

; Converts OLE string To multibyte string
Func StringToMB($S)
    Local $I, $B
    For $I = 1 To StringLen($S)
        $B &= StringToBinary(Asc(StringMid($S, $I, 1)))
    Next
    Return $B
EndFunc   ;==>StringToMB
; ******************* upload - end

; User's COM error function. Will be called if COM error occurs
Func _ErrFunc(ByRef $oError)
    ; Do anything here.
    ConsoleWrite(@ScriptName & " (" & $oError.scriptline & ") : ==> COM Error intercepted !" & @CRLF & _
            @TAB & "err.number is: " & @TAB & @TAB & "0x" & Hex($oError.number) & @CRLF & _
            @TAB & "err.windescription:" & @TAB & $oError.windescription & @CRLF & _
            @TAB & "err.description is: " & @TAB & $oError.description & @CRLF & _
            @TAB & "err.source is: " & @TAB & @TAB & $oError.source & @CRLF & _
            @TAB & "err.helpfile is: " & @TAB & $oError.helpfile & @CRLF & _
            @TAB & "err.helpcontext is: " & @TAB & $oError.helpcontext & @CRLF & _
            @TAB & "err.lastdllerror is: " & @TAB & $oError.lastdllerror & @CRLF & _
            @TAB & "err.scriptline is: " & @TAB & $oError.scriptline & @CRLF & _
            @TAB & "err.retcode is: " & @TAB & "0x" & Hex($oError.retcode) & @CRLF & @CRLF)
EndFunc   ;==>_ErrFunc

 

Edited by mLipok

Signature beginning:
Please remember: "AutoIt"..... *  Wondering who uses AutoIt and what it can be used for ? * Forum Rules *
ADO.au3 UDF * POP3.au3 UDF * XML.au3 UDF * IE on Windows 11 * How to ask ChatGPT for AutoIt Codefor 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 APIErrorLog.au3 UDF - A logging Library * Include Dependency Tree (Tool for analyzing script relations) * Show_Macro_Values.au3 *

 

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 * Dual Monitor resolution detection * * 2GUI on Dual Monitor System * _SciLexer.au3 UDF * SciTE - Lexer for console pane

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 * 

OpenOffice/LibreOffice/XLS Related: WriterDemo.au3 * XLS/MDB from scratch with ADOX

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) * IE in TaskSchedulerIE Embedded Control Versioning (use IE9+ and HTML5 in a GUI) * PDF Related:How to get reference to PDF object embeded in IE * IE on Windows 11

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 *

I also encourage you to check awesome @trancexx code:  * Create COM objects from modules without any demand on user to register anything. * Another COM object registering stuffOnHungApp handlerAvoid "AutoIt Error" message box in unknown errors  * HTML editor

winhttp.au3 related : * https://www.autoitscript.com/forum/topic/206771-winhttpau3-download-problem-youre-speaking-plain-http-to-an-ssl-enabled-server-port/

"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: 2023-04-24

Posted (edited)

once this was already disscused:

But there was not any translated Au3 script.

 

My recent version:

#include <FileConstants.au3>
#include <WinAPIConv.au3>

; https://www.motobit.com/tips/detpg_uploadvbsie/
; Upload file using http protocol And multipart/form-data
; v1.01
; 2001 Antonin Foller, PSTRUH Software
Global $oErrorHandler = ObjEvent("AutoIt.Error", _ErrFunc)

do_vbsUpload()

Func do_vbsUpload()
;~  UploadFile('http://www.dobeash.com/test.html', @ScriptFullPath, 'fileExample')
    UploadFile('https://www.newocr.com/', @ScriptFullPath, 'userfile')
EndFunc   ;==>do_vbsUpload


; ******************* upload - begin
; Upload file using input type=file
Func UploadFile($s_DestURL, $s_FileName, $s_FieldName)
    ; Boundary of fields.

    ; Be sure this string is Not In the source file
    Const $BOUNDARY = "--<<Boundary>>" & @YEAR & @MON & @MDAY & @MIN & @SEC & @MSEC & "<<Boundary>>--"

    ; Get source file As a binary data.
    Local $d_FileContents = GetFile($s_FileName)

    ; Build multipart/form-data document
    Local $s_FormData = BuildFormData($d_FileContents, $BOUNDARY, $s_FileName, $s_FieldName)

    ClipPut($s_FormData)
    MsgBox(0, @ScriptLineNumber & ' ' & VarGetType($s_FormData) & ' ' & BinaryLen($s_FormData), $s_FormData)
    ; Post the data To the destination URL
    IEPostBinaryRequest($s_DestURL, $s_FormData, $BOUNDARY)
EndFunc   ;==>UploadFile

; Build multipart/form-data document with file contents And header info
Func BuildFormData($d_FileContents, $BOUNDARY, $s_FileName, $s_FieldName)
    Const $s_ContentType = "application/upload"

    ; The two parts around file contents In the multipart-form data.
    Local $s_Prefix = "--" & $BOUNDARY & @CRLF & mpFields($s_FieldName, $s_FileName, $s_ContentType)
    Local $s_Postfix = @CRLF & "--" & $BOUNDARY & "--" & @CRLF

    MsgBox(0, @ScriptLineNumber & '', $s_Prefix & @CRLF & '************' & @CRLF & $s_Postfix)


    ; Build form data using recordset binary field
    Const $i_adLongVarBinary = 205
    Local $oRS = ObjCreate("ADODB.Recordset")
    ; https://docs.microsoft.com/en-us/sql/ado/reference/ado-api/append-method-ado?view=sql-server-ver15
    $oRS.Fields.Append("b", $i_adLongVarBinary, StringLen($s_Prefix) + BinaryLen($d_FileContents) + StringLen($s_Postfix))
    $oRS.Open()
    $oRS.AddNew()

    ; Convert Pre string value To a binary data
    Local $i_LenData = StringLen($s_Prefix)
    $oRS.Fields("b").AppendChunk(StringToMB($s_Prefix) & StringToBinary(Chr(0)))
    $oRS.Update()
    $s_Prefix = $oRS.Fields("b").GetChunk($i_LenData)
    $oRS.Fields("b") = ""

    ; Convert Po string value To a binary data
    $i_LenData = StringLen($s_Postfix)
    $oRS.Fields("b").AppendChunk(StringToMB($s_Postfix) & StringToBinary(Chr(0)))
    $oRS.Update()
    $s_Postfix = $oRS.Fields("b").GetChunk($i_LenData)
    $oRS.Fields("b") = ""

    ; Join Pre & $d_FileContents & Po binary data
    $oRS.Fields("b").AppendChunk($s_Prefix)
    $oRS.Fields("b").AppendChunk($d_FileContents)
    $oRS.Fields("b").AppendChunk($s_Postfix)
    $oRS.Update()
    Local $s_FormData = $oRS.Fields("b").value
    $oRS.Close()
    Return $s_FormData
EndFunc   ;==>BuildFormData

; sends multipart/form-data To the URL using IE
Func IEPostBinaryRequest($s_URL, $s_FormData, $BOUNDARY)
    ; Create InternetExplorer
    Local $oIE = ObjCreate("InternetExplorer.Application")

    ; You can uncoment Next line To see form results
    $oIE.Visible = True

    ; Send the form data To $s_URL As POST multipart/form-data request
    Local $iResult = $oIE.Navigate($s_URL, '', '', $s_FormData, _
            "Content-Type: multipart/form-data; boundary=" & $BOUNDARY & @CRLF)
    ConsoleWrite('! $iResult=' & $iResult & @CRLF)


    While $oIE.Busy
        Wait(1, "Upload To " & $s_URL)
    WEnd

    ; Get a result of the script which has received upload
;~   On Error Resume Next
    Local $s_IE_InnerHTML = $oIE.Document.body.innerHTML
    MsgBox(0, @ScriptLineNumber & ' TEST', $s_IE_InnerHTML)
    $oIE.Quit()
    Return $s_IE_InnerHTML
EndFunc   ;==>IEPostBinaryRequest

; Infrormations In form field header.
Func mpFields($s_FieldName, $s_FileName, $s_ContentType)
    Local $s_MPTemplate = _ ; template For multipart header
            'Content-Disposition: form-data; name="{field}"; filename="{file}"' & @CRLF & _
            'Content-Type: {ct}' & @CRLF & @CRLF & _
            ''
    Local $s_Out = $s_MPTemplate
    $s_Out = StringReplace($s_Out, "{field}", $s_FieldName)
    $s_Out = StringReplace($s_Out, "{file}", $s_FileName)
    $s_Out = StringReplace($s_Out, "{ct}", $s_ContentType)
    Return $s_Out
EndFunc   ;==>mpFields

Func Wait($i_Seconds, $s_Message)
    MsgBox(64, '', $s_Message, $i_Seconds)
EndFunc   ;==>Wait


; Returns file contents As a binary data
Func GetFile($s_FileName)
    Local $oStream = ObjCreate("ADODB.Stream")
    $oStream.Type = 1 ; adTypeBinary
;~  https://docs.microsoft.com/en-us/sql/ado/reference/ado-api/charset-property-ado?view=sql-server-ver15
;~  Charset is used only with text Stream objects (Type is adTypeText). This property is ignored if Type is adTypeBinary.
;~  "unicode", "iso-8859-1", "Windows-1252"
;~  $oStream.Charset = "Windows-1252"

    $oStream.Open()
    $oStream.LoadFromFile($s_FileName)
    Local $d_GetFile = $oStream.Read()
    $oStream.Close()

    Return $d_GetFile
EndFunc   ;==>GetFile

; Converts OLE string To multibyte string
Func StringToMB($S)
    Local $I, $B
    For $I = 1 To StringLen($S)
        $B &= StringToBinary(Asc(StringMid($S, $I, 1)))
    Next
    Return $B
EndFunc   ;==>StringToMB
; ******************* upload - end

; User's COM error function. Will be called if COM error occurs
Func _ErrFunc(ByRef $oError)
    ; Do anything here.
    ConsoleWrite(@ScriptName & " (" & $oError.scriptline & ") : ==> COM Error intercepted !" & @CRLF & _
            @TAB & "err.number is: " & @TAB & @TAB & "0x" & Hex($oError.number) & @CRLF & _
            @TAB & "err.windescription:" & @TAB & $oError.windescription & @CRLF & _
            @TAB & "err.description is: " & @TAB & $oError.description & @CRLF & _
            @TAB & "err.source is: " & @TAB & @TAB & $oError.source & @CRLF & _
            @TAB & "err.helpfile is: " & @TAB & $oError.helpfile & @CRLF & _
            @TAB & "err.helpcontext is: " & @TAB & $oError.helpcontext & @CRLF & _
            @TAB & "err.lastdllerror is: " & @TAB & $oError.lastdllerror & @CRLF & _
            @TAB & "err.scriptline is: " & @TAB & $oError.scriptline & @CRLF & _
            @TAB & "err.retcode is: " & @TAB & "0x" & Hex($oError.retcode) & @CRLF & @CRLF)
EndFunc   ;==>_ErrFunc

 

Edited by mLipok

Signature beginning:
Please remember: "AutoIt"..... *  Wondering who uses AutoIt and what it can be used for ? * Forum Rules *
ADO.au3 UDF * POP3.au3 UDF * XML.au3 UDF * IE on Windows 11 * How to ask ChatGPT for AutoIt Codefor 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 APIErrorLog.au3 UDF - A logging Library * Include Dependency Tree (Tool for analyzing script relations) * Show_Macro_Values.au3 *

 

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 * Dual Monitor resolution detection * * 2GUI on Dual Monitor System * _SciLexer.au3 UDF * SciTE - Lexer for console pane

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 * 

OpenOffice/LibreOffice/XLS Related: WriterDemo.au3 * XLS/MDB from scratch with ADOX

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) * IE in TaskSchedulerIE Embedded Control Versioning (use IE9+ and HTML5 in a GUI) * PDF Related:How to get reference to PDF object embeded in IE * IE on Windows 11

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 *

I also encourage you to check awesome @trancexx code:  * Create COM objects from modules without any demand on user to register anything. * Another COM object registering stuffOnHungApp handlerAvoid "AutoIt Error" message box in unknown errors  * HTML editor

winhttp.au3 related : * https://www.autoitscript.com/forum/topic/206771-winhttpau3-download-problem-youre-speaking-plain-http-to-an-ssl-enabled-server-port/

"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: 2023-04-24

Posted

hm...

I even try VBS (attached in ZIP ) ... with no success.

I hope that HTTP master like @trancexx and ENCODING master like @jchd will find some spare time to look at this.
Also @Danp2 our WDDriver master could look at this.

Hope together we can find complete solution.

 

IE_Automated_FileUpload.zip

Signature beginning:
Please remember: "AutoIt"..... *  Wondering who uses AutoIt and what it can be used for ? * Forum Rules *
ADO.au3 UDF * POP3.au3 UDF * XML.au3 UDF * IE on Windows 11 * How to ask ChatGPT for AutoIt Codefor 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 APIErrorLog.au3 UDF - A logging Library * Include Dependency Tree (Tool for analyzing script relations) * Show_Macro_Values.au3 *

 

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 * Dual Monitor resolution detection * * 2GUI on Dual Monitor System * _SciLexer.au3 UDF * SciTE - Lexer for console pane

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 * 

OpenOffice/LibreOffice/XLS Related: WriterDemo.au3 * XLS/MDB from scratch with ADOX

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) * IE in TaskSchedulerIE Embedded Control Versioning (use IE9+ and HTML5 in a GUI) * PDF Related:How to get reference to PDF object embeded in IE * IE on Windows 11

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 *

I also encourage you to check awesome @trancexx code:  * Create COM objects from modules without any demand on user to register anything. * Another COM object registering stuffOnHungApp handlerAvoid "AutoIt Error" message box in unknown errors  * HTML editor

winhttp.au3 related : * https://www.autoitscript.com/forum/topic/206771-winhttpau3-download-problem-youre-speaking-plain-http-to-an-ssl-enabled-server-port/

"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: 2023-04-24

Posted

@Danp2 I wonder if you can do the same with WebDriver ?

I think that still many use IE especially in corporate environment where they can not install web driver.

 

Signature beginning:
Please remember: "AutoIt"..... *  Wondering who uses AutoIt and what it can be used for ? * Forum Rules *
ADO.au3 UDF * POP3.au3 UDF * XML.au3 UDF * IE on Windows 11 * How to ask ChatGPT for AutoIt Codefor 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 APIErrorLog.au3 UDF - A logging Library * Include Dependency Tree (Tool for analyzing script relations) * Show_Macro_Values.au3 *

 

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 * Dual Monitor resolution detection * * 2GUI on Dual Monitor System * _SciLexer.au3 UDF * SciTE - Lexer for console pane

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 * 

OpenOffice/LibreOffice/XLS Related: WriterDemo.au3 * XLS/MDB from scratch with ADOX

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) * IE in TaskSchedulerIE Embedded Control Versioning (use IE9+ and HTML5 in a GUI) * PDF Related:How to get reference to PDF object embeded in IE * IE on Windows 11

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 *

I also encourage you to check awesome @trancexx code:  * Create COM objects from modules without any demand on user to register anything. * Another COM object registering stuffOnHungApp handlerAvoid "AutoIt Error" message box in unknown errors  * HTML editor

winhttp.au3 related : * https://www.autoitscript.com/forum/topic/206771-winhttpau3-download-problem-youre-speaking-plain-http-to-an-ssl-enabled-server-port/

"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: 2023-04-24

Posted

We still have some GOV page which needs IE :)

 

Signature beginning:
Please remember: "AutoIt"..... *  Wondering who uses AutoIt and what it can be used for ? * Forum Rules *
ADO.au3 UDF * POP3.au3 UDF * XML.au3 UDF * IE on Windows 11 * How to ask ChatGPT for AutoIt Codefor 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 APIErrorLog.au3 UDF - A logging Library * Include Dependency Tree (Tool for analyzing script relations) * Show_Macro_Values.au3 *

 

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 * Dual Monitor resolution detection * * 2GUI on Dual Monitor System * _SciLexer.au3 UDF * SciTE - Lexer for console pane

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 * 

OpenOffice/LibreOffice/XLS Related: WriterDemo.au3 * XLS/MDB from scratch with ADOX

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) * IE in TaskSchedulerIE Embedded Control Versioning (use IE9+ and HTML5 in a GUI) * PDF Related:How to get reference to PDF object embeded in IE * IE on Windows 11

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 *

I also encourage you to check awesome @trancexx code:  * Create COM objects from modules without any demand on user to register anything. * Another COM object registering stuffOnHungApp handlerAvoid "AutoIt Error" message box in unknown errors  * HTML editor

winhttp.au3 related : * https://www.autoitscript.com/forum/topic/206771-winhttpau3-download-problem-youre-speaking-plain-http-to-an-ssl-enabled-server-port/

"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: 2023-04-24

Posted (edited)
4 minutes ago, Danp2 said:

See _WD_SelectFiles, which allows you to select files for uploading.

is there also function to post request and get downloaded PDF or other file as a binary without saving them as file on local drive ?

 

Edited by mLipok

Signature beginning:
Please remember: "AutoIt"..... *  Wondering who uses AutoIt and what it can be used for ? * Forum Rules *
ADO.au3 UDF * POP3.au3 UDF * XML.au3 UDF * IE on Windows 11 * How to ask ChatGPT for AutoIt Codefor 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 APIErrorLog.au3 UDF - A logging Library * Include Dependency Tree (Tool for analyzing script relations) * Show_Macro_Values.au3 *

 

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 * Dual Monitor resolution detection * * 2GUI on Dual Monitor System * _SciLexer.au3 UDF * SciTE - Lexer for console pane

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 * 

OpenOffice/LibreOffice/XLS Related: WriterDemo.au3 * XLS/MDB from scratch with ADOX

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) * IE in TaskSchedulerIE Embedded Control Versioning (use IE9+ and HTML5 in a GUI) * PDF Related:How to get reference to PDF object embeded in IE * IE on Windows 11

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 *

I also encourage you to check awesome @trancexx code:  * Create COM objects from modules without any demand on user to register anything. * Another COM object registering stuffOnHungApp handlerAvoid "AutoIt Error" message box in unknown errors  * HTML editor

winhttp.au3 related : * https://www.autoitscript.com/forum/topic/206771-winhttpau3-download-problem-youre-speaking-plain-http-to-an-ssl-enabled-server-port/

"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: 2023-04-24

Posted
12 minutes ago, mLipok said:

is there also function to post request and get downloaded PDF or other file as a binary without saving them as file on local drive ?

Not sure. I don't believe there is anything in the W3C specs regarding this. But there are preferences / settings that can be dynamically set to control file downloads. My general understanding is that you can pretty much automate anything that you can manually perform in the browser.

Posted (edited)

maybe this way:

https://blog.codecentric.de/en/2010/07/file-downloads-with-selenium-mission-impossible/

or here:

https://dzone.com/articles/how-to-download-amp-upload-files-using-selenium-wi

Quote

Download a File In Selenium WebDriver Using The Browser Profile Setting

By leveraging the browser profile setting, you can download files in Selenium WebDriver without interacting with the download window pop-up. You need to trick the browser profile. Here I have given an example for Google Chrome browser and Mozilla Firefox browser.

Add this code into your Selenium Java testing suite.

Google Chrome

System.setProperty("webdriver.chrome.driver", "/Users/neeraj.kumar/Desktop/chromedriver");
ChromeOptions options = new ChromeOptions();
Map<String, Object> prefs = new HashMap<String, Object>();
prefs.put("download.prompt_for_download", false);
options.setExperimentalOption("prefs", prefs);
RemoteWebDriver driver = new ChromeDriver(options);
Mozilla Firefox
FirefoxProfile profile=new FirefoxProfile();
profile.setPreference("browser.helperApps.neverAsk.openFile", "application/octet-stream");
WebDriver driver=new FirefoxDriver(profile);

 

 

Edited by mLipok

Signature beginning:
Please remember: "AutoIt"..... *  Wondering who uses AutoIt and what it can be used for ? * Forum Rules *
ADO.au3 UDF * POP3.au3 UDF * XML.au3 UDF * IE on Windows 11 * How to ask ChatGPT for AutoIt Codefor 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 APIErrorLog.au3 UDF - A logging Library * Include Dependency Tree (Tool for analyzing script relations) * Show_Macro_Values.au3 *

 

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 * Dual Monitor resolution detection * * 2GUI on Dual Monitor System * _SciLexer.au3 UDF * SciTE - Lexer for console pane

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 * 

OpenOffice/LibreOffice/XLS Related: WriterDemo.au3 * XLS/MDB from scratch with ADOX

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) * IE in TaskSchedulerIE Embedded Control Versioning (use IE9+ and HTML5 in a GUI) * PDF Related:How to get reference to PDF object embeded in IE * IE on Windows 11

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 *

I also encourage you to check awesome @trancexx code:  * Create COM objects from modules without any demand on user to register anything. * Another COM object registering stuffOnHungApp handlerAvoid "AutoIt Error" message box in unknown errors  * HTML editor

winhttp.au3 related : * https://www.autoitscript.com/forum/topic/206771-winhttpau3-download-problem-youre-speaking-plain-http-to-an-ssl-enabled-server-port/

"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: 2023-04-24

Posted

Signature beginning:
Please remember: "AutoIt"..... *  Wondering who uses AutoIt and what it can be used for ? * Forum Rules *
ADO.au3 UDF * POP3.au3 UDF * XML.au3 UDF * IE on Windows 11 * How to ask ChatGPT for AutoIt Codefor 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 APIErrorLog.au3 UDF - A logging Library * Include Dependency Tree (Tool for analyzing script relations) * Show_Macro_Values.au3 *

 

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 * Dual Monitor resolution detection * * 2GUI on Dual Monitor System * _SciLexer.au3 UDF * SciTE - Lexer for console pane

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 * 

OpenOffice/LibreOffice/XLS Related: WriterDemo.au3 * XLS/MDB from scratch with ADOX

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) * IE in TaskSchedulerIE Embedded Control Versioning (use IE9+ and HTML5 in a GUI) * PDF Related:How to get reference to PDF object embeded in IE * IE on Windows 11

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 *

I also encourage you to check awesome @trancexx code:  * Create COM objects from modules without any demand on user to register anything. * Another COM object registering stuffOnHungApp handlerAvoid "AutoIt Error" message box in unknown errors  * HTML editor

winhttp.au3 related : * https://www.autoitscript.com/forum/topic/206771-winhttpau3-download-problem-youre-speaking-plain-http-to-an-ssl-enabled-server-port/

"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: 2023-04-24

Posted

Hello I think using https://www.newocr.com/ it will be a little complex because it use probably some cookies etc it also upload the image first then process it. maybe using the API it would be better/easier. here is a sample using other web site. You don't need to use same code than vbs You're using AutoIt so please take advantage of its own functions.

 

Global $oErrorHandler = ObjEvent("AutoIt.Error", _ErrFunc)

_TestUploadIE()

Func _TestUploadIE()
    FileDelete("FileExample.txt")
    FileWrite("FileExample.txt", "Hello World-" & Random(1000000, 9999999, 1))
    Local $oIE = ObjCreate("InternetExplorer.Application")
    ; You can uncoment Next line To see form results
    $oIE.Visible = True
    Local $sBOUNDARY = "---------------------------24464570528145"
    Local $sUrl = "https://cgi-lib.berkeley.edu/ex/fup.cgi"
    Local $sPostHeaders = "Content-Type: multipart/form-data; boundary=" & $sBOUNDARY & @CRLF

    Local $sPost = "--" & $sBOUNDARY & @CRLF & _
            'Content-Disposition: form-data; name="upfile"; filename="CompatibilityView.txt"' & @CRLF & _
            'Content-Type: text/plain' & @CRLF & @CRLF & _
            BinaryToString(FileRead("FileExample.txt")) & @CRLF & _
            "--" &  $sBOUNDARY & @CRLF & _
            'Content-Disposition: form-data; name="note"' & @CRLF & @CRLF & @CRLF & _
            "--" &  $sBOUNDARY & "--" & @CRLF

    Local $bPost = StringToBinary($sPost)
    ConsoleWrite($sPost)
    $oIE.Navigate($sUrl, Null, Null, $bPost, $sPostHeaders)

    While $oIE.Busy
        Wait(1, "Upload To " & $sUrl)
    WEnd


EndFunc   ;==>_TestUploadIE


Func Wait($i_Seconds, $s_Message)
    MsgBox(0, '', $s_Message, $i_Seconds)
EndFunc   ;==>Wait

; User's COM error function. Will be called if COM error occurs
Func _ErrFunc(ByRef $oError)
    ; Do anything here.
    ConsoleWrite(@ScriptName & " (" & $oError.scriptline & ") : ==> COM Error intercepted !" & @CRLF & _
            @TAB & "err.number is: " & @TAB & @TAB & "0x" & Hex($oError.number) & @CRLF & _
            @TAB & "err.windescription:" & @TAB & $oError.windescription & @CRLF & _
            @TAB & "err.description is: " & @TAB & $oError.description & @CRLF & _
            @TAB & "err.source is: " & @TAB & @TAB & $oError.source & @CRLF & _
            @TAB & "err.helpfile is: " & @TAB & $oError.helpfile & @CRLF & _
            @TAB & "err.helpcontext is: " & @TAB & $oError.helpcontext & @CRLF & _
            @TAB & "err.lastdllerror is: " & @TAB & $oError.lastdllerror & @CRLF & _
            @TAB & "err.scriptline is: " & @TAB & $oError.scriptline & @CRLF & _
            @TAB & "err.retcode is: " & @TAB & "0x" & Hex($oError.retcode) & @CRLF & @CRLF)
EndFunc   ;==>_ErrFunc

Saludos

Posted

Interestning.
Why you use :
https://cgi-lib.berkeley.edu/ex/fup.cgi 
?

When I try this URL then browser redirect me:

 

Quote

No data uploaded

Please enter it in fup.html.

is it related to:

<form method="POST" enctype="multipart/form-data" action="fup.cgi">
File to upload: <input type="file" name="upfile"><br>
Notes about the file: <input type="text" name="note"><br>
<br>
<input type="submit" value="Press"> to upload the file!
</form>

?
 

Signature beginning:
Please remember: "AutoIt"..... *  Wondering who uses AutoIt and what it can be used for ? * Forum Rules *
ADO.au3 UDF * POP3.au3 UDF * XML.au3 UDF * IE on Windows 11 * How to ask ChatGPT for AutoIt Codefor 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 APIErrorLog.au3 UDF - A logging Library * Include Dependency Tree (Tool for analyzing script relations) * Show_Macro_Values.au3 *

 

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 * Dual Monitor resolution detection * * 2GUI on Dual Monitor System * _SciLexer.au3 UDF * SciTE - Lexer for console pane

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 * 

OpenOffice/LibreOffice/XLS Related: WriterDemo.au3 * XLS/MDB from scratch with ADOX

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) * IE in TaskSchedulerIE Embedded Control Versioning (use IE9+ and HTML5 in a GUI) * PDF Related:How to get reference to PDF object embeded in IE * IE on Windows 11

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 *

I also encourage you to check awesome @trancexx code:  * Create COM objects from modules without any demand on user to register anything. * Another COM object registering stuffOnHungApp handlerAvoid "AutoIt Error" message box in unknown errors  * HTML editor

winhttp.au3 related : * https://www.autoitscript.com/forum/topic/206771-winhttpau3-download-problem-youre-speaking-plain-http-to-an-ssl-enabled-server-port/

"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: 2023-04-24

Posted

Two more questions

  1. Are you able to do the same on the same URL with attached PDF ?
  2. Are you also able to do the same but with: http://www.dobeash.com/test.html ... ( there is no CGI ) ?

IE_Automated_FileUpload.pdf

Signature beginning:
Please remember: "AutoIt"..... *  Wondering who uses AutoIt and what it can be used for ? * Forum Rules *
ADO.au3 UDF * POP3.au3 UDF * XML.au3 UDF * IE on Windows 11 * How to ask ChatGPT for AutoIt Codefor 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 APIErrorLog.au3 UDF - A logging Library * Include Dependency Tree (Tool for analyzing script relations) * Show_Macro_Values.au3 *

 

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 * Dual Monitor resolution detection * * 2GUI on Dual Monitor System * _SciLexer.au3 UDF * SciTE - Lexer for console pane

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 * 

OpenOffice/LibreOffice/XLS Related: WriterDemo.au3 * XLS/MDB from scratch with ADOX

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) * IE in TaskSchedulerIE Embedded Control Versioning (use IE9+ and HTML5 in a GUI) * PDF Related:How to get reference to PDF object embeded in IE * IE on Windows 11

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 *

I also encourage you to check awesome @trancexx code:  * Create COM objects from modules without any demand on user to register anything. * Another COM object registering stuffOnHungApp handlerAvoid "AutoIt Error" message box in unknown errors  * HTML editor

winhttp.au3 related : * https://www.autoitscript.com/forum/topic/206771-winhttpau3-download-problem-youre-speaking-plain-http-to-an-ssl-enabled-server-port/

"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: 2023-04-24

Posted
1 hour ago, Danyfirex said:

You don't need to use same code than vbs You're using AutoIt so please take advantage of its own functions.

Yeah I know but I just use example from that site and wanted to translate them 1<>1 ;)

 

Signature beginning:
Please remember: "AutoIt"..... *  Wondering who uses AutoIt and what it can be used for ? * Forum Rules *
ADO.au3 UDF * POP3.au3 UDF * XML.au3 UDF * IE on Windows 11 * How to ask ChatGPT for AutoIt Codefor 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 APIErrorLog.au3 UDF - A logging Library * Include Dependency Tree (Tool for analyzing script relations) * Show_Macro_Values.au3 *

 

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 * Dual Monitor resolution detection * * 2GUI on Dual Monitor System * _SciLexer.au3 UDF * SciTE - Lexer for console pane

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 * 

OpenOffice/LibreOffice/XLS Related: WriterDemo.au3 * XLS/MDB from scratch with ADOX

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) * IE in TaskSchedulerIE Embedded Control Versioning (use IE9+ and HTML5 in a GUI) * PDF Related:How to get reference to PDF object embeded in IE * IE on Windows 11

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 *

I also encourage you to check awesome @trancexx code:  * Create COM objects from modules without any demand on user to register anything. * Another COM object registering stuffOnHungApp handlerAvoid "AutoIt Error" message box in unknown errors  * HTML editor

winhttp.au3 related : * https://www.autoitscript.com/forum/topic/206771-winhttpau3-download-problem-youre-speaking-plain-http-to-an-ssl-enabled-server-port/

"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: 2023-04-24

Posted

I use the post url. In the example as you see in the action html page source. I'll check the site that you post above and let you know.

 

Saludos

Posted

I use the post url. In the example as you see in the action html page source. I'll check the site that you post above and let you know.

 

Saludos

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
×
×
  • Create New...