#89865 - 2002-11-27 11:54 PM
FTP via InetCtls.Inet.1
|
Kdyer
KiX Supporter
Registered: 2001-01-03
Posts: 6241
Loc: Tigard, OR
|
Appears to work.. But..
Cannot do a -
$ftpo.execute , $dirchg
For example.. code:
BREAK ON CLS ;InetCtls.Inet.1 ;Msinet.ocx
; - http://cwashington.netreach.net/depo/view.asp?Index=419&ScriptType=vbscript ; - http://www.bridgeport.edu/~mahmood/cs555_utils.doc ;;dim $objArgs
$ftpo = CreateObject("InetCtls.Inet.1") IF @error <> '0' ?@error + " encountered - leaving now, could not find InetCtls.Inet.1" SLEEP 3 EXIT 2 ENDIF ?"Looks good" SLEEP 1 $url = "ftp://www.yoururl.com" $rdir = "remotedir" $user = "user" $pass = "yourpass" $slfile = "C:\cr.dbf" $ftpo.url = $url $ftpo.username = $user $ftpo.password = $pass ?"Connecting..." $dirchg = "CD " + $rdir $ftpo.execute chr(44) $dirchg ;$ftpo.execute , $dirchg ; -- KiXtart does not like this
$tst = $ftpo.execute chr(44) "dir" ?$tst get $ $sSendfl = "SEND " + $slfile $ftpo.Execute chr(44) $sSendfl ?"Closing" $ftpo.execute chr(44) "Close" ?"Done!" $fso = nothing $ftpo = nothing SLEEP 2
Thanks,
Kent
|
Top
|
|
|
|
#89869 - 2002-11-28 01:01 AM
Re: FTP via InetCtls.Inet.1
|
Kdyer
KiX Supporter
Registered: 2001-01-03
Posts: 6241
Loc: Tigard, OR
|
Jooel,
This is more of a "proof of concept" or experiment than anything else. Most people will not have "InetCtls.Inet.1" available to them as they do not have Visual Studio installed.
Kent
|
Top
|
|
|
|
#89871 - 2002-11-28 06:18 AM
Re: FTP via InetCtls.Inet.1
|
Kdyer
KiX Supporter
Registered: 2001-01-03
Posts: 6241
Loc: Tigard, OR
|
Code is too weird...
I think I will dig into XML-related area for this..
I know you can use the FTP program M$ gives you, but I was wanting to play with this under COM.
Kent
|
Top
|
|
|
|
#89873 - 2002-11-29 07:40 AM
Re: FTP via InetCtls.Inet.1
|
Kdyer
KiX Supporter
Registered: 2001-01-03
Posts: 6241
Loc: Tigard, OR
|
Nice idea..
But too weird and not everybody has the required objects to do this.
Think I will work with Howard's DLL. Win32Admin.DLL updated
I was going to go with Internet Data Transfer Library for MS-Access as what the target audience will be using it for transferring a Database.. But, Howard's code usage is much simpler.
This was originally prompted by Looking for a good FTP Client.
code:
break on $db = "N:\usersdatabase\users.mdb" ; -- Step one - Determine where MS-Access installed for the executable $Access = READVALUE("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\App Paths\MSACCESS.EXE","") ; -- Step two - Compact the database each time before transfer as there will be alot of inserts done on it ; -- Developer's Note: MS-Access is notorious for "bloat" when inserts are done and/records removed RUN $Access + " " + $db + "//compact" SLEEP 1 ; -- Step three - Start the FTP Process $Win32Admin = createobject("Win32Admin") ; Method FTP($RemoteServer, $Account, $Password, $Mode, $LocalDir, $RemoteDir, $Action, $Filename) ; $Mode -> [ascii|binary] ; $Action -> [get|put|size] ; ; Performs the specified FTP operation. ; Be sure to double the "@" in the password or email address if used for anonymous logons.
$RemoteServer = 'someserver.com' $Account = 'userid' $Password = 'password' $Mode = 'binary' $LocalDir = 'n:\usersdatabase' $RemoteDir = 'database' $Action = 'put' $Filename = 'users.mdb'
IF $Win32Admin.FTP( $RemoteServer, $Account, $Password, $Mode, $LocalDir, $RemoteDir, $Action, $Filename) ? ? "FTP successful" ? else ? ? "FTP Failed! @serror" ? endif
Thanks,
Kent
|
Top
|
|
|
|
#89878 - 2002-11-30 07:20 PM
Re: FTP via InetCtls.Inet.1
|
Kdyer
KiX Supporter
Registered: 2001-01-03
Posts: 6241
Loc: Tigard, OR
|
|
Top
|
|
|
|
#89879 - 2002-11-30 07:28 PM
Re: FTP via InetCtls.Inet.1
|
Kdyer
KiX Supporter
Registered: 2001-01-03
Posts: 6241
Loc: Tigard, OR
|
Started to do a conversion..
code:
break on ; --- http://groups.google.com/groups?q=xmlhttp+ftp&hl=en&lr=&ie=UTF-8&selm=%23ZHFbJr3BHA.2488%40tkmsftngp04&rnum=2 $sxmldata = GetXML("ftp://ftp.microsoft.com/bussys/readme.txt","","") ?$sxmldata
FUNCTION GetXML($surl,$susr,$spasswd) ; Create an xmlhttp object: DIM $oxml $oxml = CreateObject("Microsoft.XMLHTTP") ;Opens the connection to the remote server. ;rtn = xml.Open((B)) $oxml.open "GET" chr(44) $surl chr(44) $false chr(44) $susr chr(44) $spasswd ; Actually Sends the request and returns the data: $oxml.send DO WHILE $oxml.readystate<>4 SLEEP 10 LOOP UNTIL $getxml = $oxml.responsetext ENDFUNCTION
Kent
|
Top
|
|
|
|
#89882 - 2002-11-30 08:10 PM
Re: FTP via InetCtls.Inet.1
|
Kdyer
KiX Supporter
Registered: 2001-01-03
Posts: 6241
Loc: Tigard, OR
|
|
Top
|
|
|
|
Moderator: Shawn, ShaneEP, Ruud van Velsen, Arend_, Jochen, Radimus, Glenn Barnas, Allen, Mart
|
0 registered
and 208 anonymous users online.
|
|
|