Jump to content

Recommended Posts

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:

  Reveal hidden contents

Signature last update: 2023-04-24

  • Developers
Posted

I think you shouldn't be downloading an exe (curl.exe) and shelling without any notification/= or asking first.
Maybe you could change the UDF by using the set of WINHTTP udf's made by trancexx?

Jos
 

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Posted
  On 1/5/2017 at 6:42 PM, Jos said:

Maybe you could change the UDF by using the set of WINHTTP udf's made by trancexx?

Expand  

This was my second thought about this UDF.

 

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:

  Reveal hidden contents

Signature last update: 2023-04-24

  • Moderators
Posted

Perhaps we should give people who post UDFs a short time to get feedback from the community and improve the scripts, before we rush to add them to the Wiki.

"Profanity is the last vestige of the feeble mind. For the man who cannot express himself forcibly through intellect must do so through shock and awe" - Spencer W. Kimball

How to get your question answered on this forum!

Posted

Perhaps .... , on the other hand, if in this way, we do not overlook or forget about a little used UDF?
See what's on the Wiki Page, it was even a few years ago?
Now this is actually a treasure trove.

I think that the assessment of the UDF should be taken in the thread and not on the list of UDFs. Of course, if a UDF proves to be dangerous, they should be removed from the list.

 

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:

  Reveal hidden contents

Signature last update: 2023-04-24

  • Developers
Posted

Let's not argue in this thread, but agree with @JLogan3o13 to first let it mature before publishing in the WiKi.
Further discussion can be done via PM. ;) 

Jos

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Posted

Ok.

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:

  Reveal hidden contents

Signature last update: 2023-04-24

Posted

Thanks @mLipok !

I try for days to get functions like _SendPhoto work, to upload files like photos, videos, audios ecc to Telegram Server without cURL,  just with HTTP API, but without any result. At the end I use cURL and the best way to keep end user with less things to do is let UDF provide itself to download and use cURL executable file. The library download the exe file from official web site of cURL (https://curl.haxx.se/download.html) , it's 100% safe and secure, I can post a VirusTotal scan if you need to verify or at least tell me how to make it work without cURL :sweating:

  • Developers
Posted
  On 1/5/2017 at 10:49 PM, LinkOut said:

it's 100% safe and secure

Expand  

Understand, but it is for me more the fact you are downloading an exe without informing the user of the script. You could also simply state your script needs CURL and have the user of the script download themselves or even allow them to indicate where it is located in case they already have CURL installed.

Jos 

 

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Posted

Ok, I will change the script to inform the user that the UDF need cURL executable. If the user agree, the script download itself the .exe, otherwise user can adapt th code to find a pre-downloaded curl.exe. I will add this also on the GitHub page. Thanks ^_^

Posted

In relation to the change from cURL to winhttp , @LinkOut please check my Crowding API UDF , and Crowdin API documentation.
On Crowdin site in documentation there are examples for cURL , but I have used winhttp.

This should show you how to make a first step.

 

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:

  Reveal hidden contents

Signature last update: 2023-04-24

  • Developers
Posted (edited)

I took one of the examples posted by trancexx and modified it to the below alternative UDF for SendPhoto:

#include <WinHttp.au3>

;~ ConsoleWrite("Test _SendMsg      -> "  & @TAB & _SendMsg($ChatID,"Test _SendMsg") & @CRLF)
;~ ConsoleWrite("Test _SendPhoto    -> " & @TAB & _SendPhoto($ChatID, "d:\temp\image.jpg", "Test _SendPhoto") & @CRLF)
ConsoleWrite("Test _SendPhoto    -> " & @TAB & _SendPhotoN($ChatID, "d:\temp\image.jpg", "Test _SendPhoto") & @CRLF)


; @SEND MEDIA FUNCTION using WINHTTP ================================================================================
Func _SendPhotoN($ChatID, $Path, $Caption = "")
    Local $Query = $URL & '/sendPhoto'
    $sForm = _
            '<form action="' & $Query & '" method="post" enctype="multipart/form-data">' & _
            ' <input type="text" name="chat_id"/>' & _
            ' <input type="file" name="photo"/>' & _
            ' <input type="text" name="caption"/>' & _
            '</form>'

    ; Initialize and get session handle
    $hOpen = _WinHttpOpen()
    $hConnect = $sForm ; will pass form as string so this is for coding correctness because $hConnect goes in byref
    ; Register callback function
    _WinHttpSimpleFormFill_SetUploadCallback(UploadCallback)
    ; Fill form
    $sHTML = _WinHttpSimpleFormFill($hConnect, $hOpen, _
            Default, _
            "name:chat_id", $ChatID, _
            "name:photo", $Path, _
            "name:caption", $Caption)
    ; Collect error number
    $iErr = @error
    ; Unregister callback function
    _WinHttpSimpleFormFill_SetUploadCallback(0)
    ; Kill progress bar window
    ; Close handles
    _WinHttpCloseHandle($hConnect)
    _WinHttpCloseHandle($hOpen)

    If $iErr Then
        MsgBox(4096, "Error", "Error number = " & $iErr)
        ConsoleWrite("! error:" & $iErr & @CRLF & $sHTML & @CRLF)
    Else
        ConsoleWrite($sHTML & @CRLF)
    EndIf
    Return $iErr

EndFunc   ;==>_SendPhotoN

This is working nicely for me :)

Jos

Edited by Jos
Updated the form to contain all param's

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Posted

Wow.. it works!! Ok, asap I'll rewrite the UDFs and remove cURL. One question about this:

_WinHttpSimpleFormFill_SetUploadCallback(UploadCallback)

what is "UploadCallback" exactly? SciTe return me error and I've changed it to '1' just for test and worked anyway.

Posted
  On 1/6/2017 at 10:38 AM, mLipok said:

In relation to the change from cURL to winhttp , @LinkOut please check my Crowding API UDF , and Crowdin API documentation.
On Crowdin site in documentation there are examples for cURL , but I have used winhttp.

This should show you how to make a first step.

 

Expand  

I'm reading your UDF.

Posted

Good for you, I hope ;)
 

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:

  Reveal hidden contents

Signature last update: 2023-04-24

  • Developers
Posted (edited)
  On 1/7/2017 at 6:06 PM, LinkOut said:

Wow.. it works!! Ok, asap I'll rewrite the UDFs and remove cURL. One question about this:

_WinHttpSimpleFormFill_SetUploadCallback(UploadCallback)

what is "UploadCallback" exactly? SciTe return me error and I've changed it to '1' just for test and worked anyway.

Expand  

Sorry about that, I forgot to copy that as well into the posted example:

; Callback function. For example, update progress control
Func UploadCallback($iPrecent)
    If $iPrecent = 100 Then
        ; ProgressSet(100, "Done", "Complete")
        Sleep(800) ; give some time for the progress bar to fill-in completely
    Else
        ; ProgressSet($iPrecent, $iPrecent & "%")
    EndIf
EndFunc   ;==>UploadCallback

It was used in the original example to update the percentage uploaded, but I have removed the Progress as we probably talk here about small files.

.. or simply remove the 2 Callback lines as you don't need them for this function

Just add Func and you should be in business.

Jos

Edited by Jos

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

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...