This works.
Downloads the file and then removes it from the server.
I'm sure it could be cleaned up... can anyone advise how ?
Code:
#SingleInstance, force
#NoEnv
#include FileHelper.ahk ; http://www.autohotkey.com/forum/topic19608.html
#include libcurl.ahk
if ( CurlGlobalInit( "libcurl" ) != 0 )
ExitApp
hCurlEasy := CurlEasyInit()
CurlEasyDefineOptions()
CurlGetInfoDefine()
CurlShowErrors()
;### DOWNLOAD ###
Url = ftp://192.168.1.254/test.txt
hFile := CreateFile( A_ScriptDir . "\test.txt", 2 )
CurlEasySetOption( hCurlEasy, CURLOPT_URL, &URL )
VarSetCapacity(CURL_ERROR, CURL_ERROR_SIZE + 1)
CurlEasySetOption( hCurlEasy, CURLOPT_ERRORBUFFER, &CURL_ERROR )
CurlEasySetOption( hCurlEasy, CURLOPT_NOPROGRESS, 0 )
pCurlProgressFunction := RegisterCallback("CurlProgressFunction", "C F")
CurlEasySetOption( hCurlEasy, CURLOPT_PROGRESSFUNCTION, pCurlProgressFunction )
pCurlWriteFunction := RegisterCallback("CurlWriteFunction", "C F")
CurlEasySetOption( hCurlEasy, CURLOPT_WRITEFUNCTION, pCurlWriteFunction )
If ( CurlEasyPerform( hCurlEasy ) )
MsgBox % CURL_ERROR ;%
Progress, Off
CloseHandle(hFile)
;### DELETE ###
Url = ftp://192.168.1.254
CurlSlistAppend(list, "DELE test.txt")
CurlEasyReset(hCurlEasy)
CurlEasySetOption( hCurlEasy, CURLOPT_URL, &URL )
CurlEasySetOption( hCurlEasy, CURLOPT_QUOTE, list)
CurlEasySetOption( hCurlEasy, CURLOPT_VERBOSE, 0)
CurlEasySetOption( hCurlEasy, CURLOPT_NOPROGRESS, 1)
VarSetCapacity(CURL_ERROR, CURL_ERROR_SIZE + 1)
CurlEasySetOption( hCurlEasy, CURLOPT_ERRORBUFFER, &CURL_ERROR )
If ( CurlEasyPerform( hCurlEasy ) )
MsgBox % CURL_ERROR ;%
CurlEasyCleanup( hCurlEasy )
CurlFreeLibrary()
return
CurlProgressFunction(clientp, dltotal_l, dltotal_h, dlnow_l, dlnow_h, ultotal_l, ultotal_h, ulnow_l, ulnow_h)
{
dltotal := MergeDouble( dltotal_l, dltotal_h )
dlnow := MergeDouble( dlnow_l, dlnow_h )
KBTotal := Round( dltotal / 1024, 2 )
KBNow := Round( dlnow / 1024, 2 )
Percent := Round( dlnow / dltotal * 100, 2 )
Progress, %Percent%, %KBNow% of %KBTotal% KB (%Percent% `%)
Return 0
}
CurlWriteFunction(pBuffer, size, nitems, pOutStream)
{
global hFile
WriteFile(hFile, pBuffer, size*nitems)
return size*nitems
}
Also anyway to make the progress appear in a border less gui and update ?
If I add 'b' to the progress it goes border less, but flickers !
Thanks

I've got this working. But have a slight problem.
My progress bar appears, but is blank for about 5 seconds as curl connects to my server.
Once the file starts to download the progress bar is fine.
Is there any way to only display the progress bar as the download starts, not as it attempts to connect ??