Jump to content

Recommended Posts

Posted

News :

The bug is there with any Windows, but not Windows 11 and Server 2022.

AutoIt use IE (Trident) engine ?

But, I need to get it works with Windows 10 and Server 2019.

Posted (edited)

Ditto (simpler)

$source = "https://www.treshaut.net/tels/Installations_Auto/date_maj2.txt"
$dest = "test.txt"
RunWait('curl -L -s -k ' & $source & ' -o "' & $dest & '"', "", @SW_HIDE)

or

$out = _Get("https://www.treshaut.net/tels/Installations_Auto/date_maj2.txt")
ConsoleWrite($out & @crlf)

Func _Get($url)
   Local $cmd = "curl -L -s -k " & $url
   Local $iPID = Run($cmd, "", @SW_HIDE, 2)  ;$STDOUT_CHILD
   ProcessWaitClose($iPID)
   Local $output = StdoutRead($iPID)
   Return $output
EndFunc

 

Edited by mikell
Posted

Thank you for the curl suggestion.

But, do you think it's possible with AutoIt native functions ?

(it can help me, for example, to reuse my existing progress bar for downloading big files with AutoIt, from the same https server)

Posted

Curl is the more reliable way

BTW you can populate a progressbar while downloading using curl, example below

#include <AutoItConstants.au3>

$source = "https://www.autoitscript.com/autoit3/files/archive/autoit/autoit-v3.3.14.5.zip"
$file = StringRegExpReplace($source, '.*/([^/]+)$', "$1")

$cmd = 'curl -L -k ' & $source & ' -o "' & @scriptdir & '\' & $file & '"'
Local $iPID = Run($cmd, "", @SW_HIDE, $STDOUT_CHILD+$STDERR_CHILD)
ProgressOn($file, "")
While 1
    $tmp = StderrRead($iPID)
    If @error Then Exitloop
    If $tmp <> "" and StringRegExp($tmp, '(?i)[kmg]') Then
        $pc = StringRegExp($tmp, '(\d+)', 1)
        If not @error Then ProgressSet($pc[0], $pc[0] & " %")
    EndIf
Wend
ProgressOff()
Msgbox(0,"", $file & " : done")

 

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
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...