Jump to content

FTP UDF (Updated 1-10)


JohnMC
 Share

Recommended Posts

  • Replies 45
  • Created
  • Last Reply

Top Posters In This Topic

Top Posters In This Topic

very easy to get this script working!

but this seems to break it...

this works:

$file = 'C:\file.txt'

_FtpPutFile($Hand, $file, '/')

this doesn't work:

$dir = 'C:\'
$file = 'file.txt'

_FtpPutFile($Hand, $dir & $file, '/')

EDIT - there's something else going on (probably something i'm doing wrong) - sometimes i can get it to transfer, sometimes not. passive mode has no effect.

Edited by atomman
Link to comment
Share on other sites

  • 2 weeks later...

Great point, i should add this, but i help me out here... are there known issues with some options, most notably the timeout ones, i dont know if im getting this mixed up with a different project, but i remember people complaing about how it never worked right, thats why i never botherd

also should i set these constants within this UDF, and are the values based on the posistion they have in the list on the msdn

JohnMC, if you will be interested to take a look at my version of UDF. There is a function _InternetGetOption () and _InternetSetOption. Actually it is in WinINet.au3, but I changed it to make it easier to use directly to FTP.

FTP.au3

Edited by Yashied
Link to comment
Share on other sites

  • 3 weeks later...

JohnMC, if you will be interested to take a look at my version of UDF. There is a function _InternetGetOption () and _InternetSetOption. Actually it is in WinINet.au3, but I changed it to make it easier to use directly to FTP.

I am using the latest FTP_EX udf...i believe. Everything works so far but cannot get the _FTPCommand work. is there an example for this function? thaks

Dr SherlockAlways a way

Link to comment
Share on other sites

  • 1 month later...

OOps should have looked into .FTP.au3

_FTPConnect($FTPopen, $IPvalue2, $USERNAMEvalue, $PASSvalue, $PORTvalue)

:D

Question to UDF developer.

I found this tool 'DLL Export Viewer v1.35' that can read/export sellected DLL functions and i was looking it those you used in your UDF.

So i thought that there are plenty of other parameters that i could add to my own UDF's for personal use and maybe for public release later on, but i have one problem.

Problem is that in your UDF you are referencing to DLL functions not as i see them. I mean for example FtpPutFile looking at it through FLL Explort viewer shows me that there are several FtpPutFile functions such as:

FtpPutFileW

FtpPutFileEx

FtpPutFileA

How in gods name and where did u find FtpPutFile ?

Edited by lessstoopid
Link to comment
Share on other sites

  • 1 year later...

Well done, I used your UDF in their scripts. But why did you not use the functions InternetSetOption (for example, to set the timeout response from the FTP server). Without this script can not answer a long time. In my scripts I have used it. To set the timeout it will look like this:

const $INTERNET_OPTION_RECEIVE_TIMEOUT = 6

const $TimeOut = 60 * 1000 ; ms

local $WININET_HANDLE = DllOpen('wininet.dll')

_InternetSetOptions($hInternet, $INTERNET_OPTION_RECEIVE_TIMEOUT, $TimeOut)

func _InternetSetOptions($hInternet, $iOption, $iValue)
    
    local $tBuffer = DllStructCreate('int Value')
    
    DllStructSetData($tBuffer, 'Value', $iValue)
    DllCall($WININET_HANDLE, 'int', 'InternetSetOptionW', 'hwnd', $hInternet, 'int', $iOption, 'ptr', DllStructGetPtr($tBuffer), 'int', DllStructGetSize($tBuffer))
    $tBuffer = 0
    if (@error) or (_WinAPI_GetLastError() > 0) then
        return SetError(1, 0, 0)
    endif
    
    return SetError(0, 0, 1)
endfunc; _InternetSetOptions

The following list shows the options that can be set for $iOption:

INTERNET_OPTION_CONTEXT_VALUE

INTERNET_OPTION_CONNECT_TIMEOUT

INTERNET_OPTION_CONNECT_RETRIES

INTERNET_OPTION_CONNECT_BACKOFF

INTERNET_OPTION_CONTROL_SEND_TIMEOUT

INTERNET_OPTION_CONTROL_RECEIVE_TIMEOUT

INTERNET_OPTION_DATA_SEND_TIMEOUT

INTERNET_OPTION_DATA_RECEIVE_TIMEOUT

INTERNET_OPTION_READ_BUFFER_SIZE

INTERNET_OPTION_WRITE_BUFFER_SIZE

INTERNET_OPTION_USERNAME

INTERNET_OPTION_PASSWORD

INTERNET_OPTION_PROXY

INTERNET_OPTION_USER_AGENT

INTERNET_OPTION_RECEIVE_TIMEOUT

http://msdn.microsoft.com/en-us/library/ms918381.aspx

I would like to use this to set a proxy for my embedded IE. can you show an example of that? also, what is $hInternet?

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

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