Page 1 of 4 1234>
Topic Options
#89865 - 2002-11-27 11:54 PM FTP via InetCtls.Inet.1
Kdyer Offline
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
_________________________
Utilize these resources:
UDFs (Full List)
KiXtart FAQ & How to's

Top
#89866 - 2002-11-28 12:31 AM Re: FTP via InetCtls.Inet.1
Chris S. Offline
MM club member
*****

Registered: 2002-03-18
Posts: 2368
Loc: Earth
Did you try putting it in parens ()?
Top
#89867 - 2002-11-28 12:36 AM Re: FTP via InetCtls.Inet.1
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
this I think is the basic problem of ppl trying to translate from vb...

kent, writing this for what?

anyway, like chris said, it looks like it should be:
code:
$ftpo.execute( chr(44)+$dirchg)

_________________________
!

download KiXnet

Top
#89868 - 2002-11-28 12:55 AM Re: FTP via InetCtls.Inet.1
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
mmm, checked from typelib, there seems to be more to it:
quote:
Sub Execute ([ByVal URL], [ByVal Operation], [ByVal InputData], [ByVal InputHdrs])
_________________________
!

download KiXnet

Top
#89869 - 2002-11-28 01:01 AM Re: FTP via InetCtls.Inet.1
Kdyer Offline
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
_________________________
Utilize these resources:
UDFs (Full List)
KiXtart FAQ & How to's

Top
#89870 - 2002-11-28 01:05 AM Re: FTP via InetCtls.Inet.1
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
well, something to learn, didn't know it's from VS [Eek!]
_________________________
!

download KiXnet

Top
#89871 - 2002-11-28 06:18 AM Re: FTP via InetCtls.Inet.1
Kdyer Offline
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
_________________________
Utilize these resources:
UDFs (Full List)
KiXtart FAQ & How to's

Top
#89872 - 2002-11-28 06:36 AM Re: FTP via InetCtls.Inet.1
Bryce Offline
KiX Supporter
*****

Registered: 2000-02-29
Posts: 3167
Loc: Houston TX
CuteFTP has a COM interface.
Top
#89873 - 2002-11-29 07:40 AM Re: FTP via InetCtls.Inet.1
Kdyer Offline
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
_________________________
Utilize these resources:
UDFs (Full List)
KiXtart FAQ & How to's

Top
#89874 - 2002-11-29 08:03 AM Re: FTP via InetCtls.Inet.1
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
and I thought you were just playing...
doesn't IE have way for this too.
_________________________
!

download KiXnet

Top
#89875 - 2002-11-29 08:20 AM Re: FTP via InetCtls.Inet.1
Kdyer Offline
KiX Supporter
*****

Registered: 2001-01-03
Posts: 6241
Loc: Tigard, OR
I may play as time permits.

Isn't there something in xmlhttp or maybe xmlftp?

I did see - http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnsmart02/html/sa02a1.asp and downloaded the example, but still uses FTP.EXE.

Hmmm maybe something with wininet?

Kent
_________________________
Utilize these resources:
UDFs (Full List)
KiXtart FAQ & How to's

Top
#89876 - 2002-11-29 10:21 AM Re: FTP via InetCtls.Inet.1
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
mmm... is that scriptable?
_________________________
!

download KiXnet

Top
#89877 - 2002-11-29 10:41 AM Re: FTP via InetCtls.Inet.1
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
xmlhttp object should be able, but how can kixtart manage that stream coming in?

it can't write it to file...

let me see if we have such an udf...
_________________________
!

download KiXnet

Top
#89878 - 2002-11-30 07:20 PM Re: FTP via InetCtls.Inet.1
Kdyer Offline
KiX Supporter
*****

Registered: 2001-01-03
Posts: 6241
Loc: Tigard, OR
Jooel,

I think I found it -

http://groups.google.com/groups?q=xmlhttp+ftp&hl=en&lr=&ie=UTF-8&selm=%23ZHFbJr3BHA.2488%40tkmsftngp04&rnum=2

Thanks,

Kent
_________________________
Utilize these resources:
UDFs (Full List)
KiXtart FAQ & How to's

Top
#89879 - 2002-11-30 07:28 PM Re: FTP via InetCtls.Inet.1
Kdyer Offline
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
_________________________
Utilize these resources:
UDFs (Full List)
KiXtart FAQ & How to's

Top
#89880 - 2002-11-30 07:30 PM Re: FTP via InetCtls.Inet.1
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
well, that is the text way but how to get the streams...
this neither gives you the real text as it converts it. responsebody is returned as-is
and btw, with kix you can just do:
code:
$net=createobject("microsoft.xmlhttp")
$net.open("GET",$address,not 1)
$net.send
$THEFILE=$net.responsebody

to get the binary stuff you would need to change the last line to:
$THEFILE=$net.responsestream

but that we cannot process.
_________________________
!

download KiXnet

Top
#89881 - 2002-11-30 07:32 PM Re: FTP via InetCtls.Inet.1
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
oh, this is btw the object checker uses
_________________________
!

download KiXnet

Top
#89882 - 2002-11-30 08:10 PM Re: FTP via InetCtls.Inet.1
Kdyer Offline
KiX Supporter
*****

Registered: 2001-01-03
Posts: 6241
Loc: Tigard, OR
Jooel,

I think this may shed some light on the Binary piece..

http://groups.google.com/groups?q=GetXML+binary&hl=en&lr=&ie=UTF-8&selm=3ddb8491%240%2411028%24afc38c87%40news.optusnet.com.au&rnum=5

Kent
_________________________
Utilize these resources:
UDFs (Full List)
KiXtart FAQ & How to's

Top
#89883 - 2002-11-30 08:11 PM Re: FTP via InetCtls.Inet.1
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
thanks, back in 5 with code...
_________________________
!

download KiXnet

Top
#89884 - 2002-11-30 08:15 PM Re: FTP via InetCtls.Inet.1
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
then need a ftp site to test on...
_________________________
!

download KiXnet

Top
Page 1 of 4 1234>


Moderator:  Shawn, ShaneEP, Ruud van Velsen, Arend_, Jochen, Radimus, Glenn Barnas, Allen, Mart 
Hop to:
Shout Box

Who's Online
0 registered and 681 anonymous users online.
Newest Members
MaikSimon, kvn317, kixtarts2025, SERoyalty, mytar
17872 Registered Users

Generated in 0.188 seconds in which 0.102 seconds were spent on a total of 13 queries. Zlib compression enabled.

Search the board with:
superb Board Search
or try with google:
Google
Web kixtart.org