#179339 - 2007-08-15 02:21 PM
Re: Problem with ftpget( ) UDF.
[Re: Mart]
|
Maurits
Fresh Scripter
Registered: 2007-04-23
Posts: 16
Loc: The Netherlands
|
I know I can use windows ftp. I'm using it right now in my update script. All works great. Accept that when users log in and my loginscipt calls the update script everyone can see the commands I send to the ftp server. I don't want that to happen but windows ftp can't hide all the commands.
This is a part of my script I'm now using with windows ftp:
md $locatie + "\temp\" + @WKSTA
cd $locatie + "\temp\" + @WKSTA
shell "ftp -v -i -s:$locatie\utils\ftp.opd $rs6000" Because of all the commands you see when you log in I wanted te use FTPget()
|
Top
|
|
|
|
#179343 - 2007-08-15 03:03 PM
Re: Problem with ftpget( ) UDF.
[Re: Maurits]
|
Witto
MM club member
   
Registered: 2004-09-29
Posts: 1828
Loc: Belgium
|
SetConsole("Hide") maybe? FTPInput.txt
open ftp.microsoft.com
user anonymous pass anonymous
cd ResKit/win2000
mget jt.*
quit
FTPTest.kix
Break ON
$SO = SetConsole("Hide")
Shell 'ftp -i -n -v -s:C:\test\FTPInput.txt'
$so = SetConsole("Show")
|
Top
|
|
|
|
#179391 - 2007-08-16 10:44 AM
Re: Problem with ftpget( ) UDF.
[Re: Witto]
|
Maurits
Fresh Scripter
Registered: 2007-04-23
Posts: 16
Loc: The Netherlands
|
SetConsole("Hide") maybe? FTPTest.kix
Break ON
$SO = SetConsole("Hide")
Shell 'ftp -i -n -v -s:C:\test\FTPInput.txt'
$so = SetConsole("Show")
I have tested above but it doesn't work. Thanks for your input.
|
Top
|
|
|
|
#179394 - 2007-08-16 12:07 PM
Re: Problem with ftpget( ) UDF.
[Re: Maurits]
|
Witto
MM club member
   
Registered: 2004-09-29
Posts: 1828
Loc: Belgium
|
Have you tried the input file and the script file I wrote? If you launch it at a command prompt, the command prompt dissapears. But I make reappear with $so = SetConsole("Show") because otherwise, the command stays running in background Don't forget to change the path to the place where you stored the example input file: -s:C:\test\FTPInput.txt
If you would launch the script at a command prompt like this: start kix32 ftptest.kix you would see twice a window popping up:
- At the beginning of the script, before
$SO = SetConsole("Hide") - At the end of the script, after
$SO = SetConsole("Show")
Than, the window should disappear. In that case, you can drop the last SetConsole.
|
Top
|
|
|
|
#179395 - 2007-08-16 01:27 PM
Re: Problem with ftpget( ) UDF.
[Re: Maurits]
|
Richard H.
Administrator
   
Registered: 2000-01-24
Posts: 4946
Loc: Leatherhead, Surrey, UK
|
I'll repost once as I'm getting confused as to whom you are responding...
Did you try the following:
To get a directory list you just need to get the HTML page and parse it. Here is a rough example adapted from FTPGet() - you may need to change the parsing rules depending on the response from the Web server. Note, there is no sanity checking on the path or the returned data type. GIGO. Break ON
$=SetOption("Explicit","ON")
Dim $sFile,$sFileList,$sURL
$sURL="ftp://ftp.microsoft.com/deskapps"
$sFileList=FTPDir($sURL)
If $sFileList
"Entries in "+$sURL+":"+@CRLF
For Each $sFile in Split($sFileList,@CRLF)
$sFile+" is a "+IIf(Right($sFile,1)="/","DIRECTORY","FILE")+@CRLF
Next
Else
"There are no entries in "+$sURL+@CRLF
EndIf
Function FTPDir($sURL,Optional $sUser, $sPass, $iForce)
Dim $oFTP,$,$iERROR,$sLine,$iParse,$sLoc,$dwSM
$iERROR=0
$iParse=0
$sLoc="HKCU\Software\Microsoft\Windows\CurrentVersion\Internet Settings"
$sUser=""+$sUser
If $iForce
$dwSM = Readvalue($sLoc,"Syncmode5")
$=writevalue($sLoc,"Syncmode5",3,"REG_DWORD")
EndIf
$oFTP = CreateObject("Microsoft.XMLHTTP")
If @error $ftpget=1 Else
If $sUser $oFTP.Open("GET", $sURL, Not 1, $sUser, $sPass) Else $oFTP.Open("GET", $sURL, Not 1) EndIf
If @error $ftpget=3 Else
$oFTP.Send
For Each $sLine in Split($oFTP.responseBody,@CRLF)
Select
Case InStr($sLine,"<PRE>") $iParse=1
Case InStr($sLine,"</PRE>") $iParse=0
Case $iParse
$sLine=Split($sLine+'<A HREF="','<A HREF="')[1]
$sLine=Split($sLine,'"')[0]
If $sLine $FTPDir=$FTPDir+@CRLF+$sLine EndIf
EndSelect
Next
EndIf
EndIf
$oFTP=0
If $iForce $=WriteValue($sLoc,"Syncmode5",$dwSM,"REG_DWORD") EndIf
$FTPDir=SubStr($FTPDir,3)
Exit $iERROR
EndFunction
;
; vim: ts=4 sw=4 ai filetype=kix
|
Top
|
|
|
|
#179396 - 2007-08-16 05:07 PM
Re: Problem with ftpget( ) UDF.
[Re: Maurits]
|
Witto
MM club member
   
Registered: 2004-09-29
Posts: 1828
Loc: Belgium
|
Or this (please copy, paste, modify -s:C:\test\FTPInput.txt and give it a try) FTPInput.txt
open ftp.microsoft.com
user anonymous pass anonymous
cd ResKit/win2000
mget jt.*
quit
FTPTest.kix
BREAK ON
Shell '%comspec% /c "ftp -i -n -v -s:C:\test\FTPInput.txt" > nul'
A window is opened but no screen output is shown.
|
Top
|
|
|
|
#179397 - 2007-08-16 05:20 PM
Re: Problem with ftpget( ) UDF.
[Re: Witto]
|
Witto
MM club member
   
Registered: 2004-09-29
Posts: 1828
Loc: Belgium
|
Just found this web page FTP via ASP without using 3rd-party components Just some copy and paste without looking up the syntax
BREAK ON
$objShell = CreateObject("WSCRIPT.SHELL")
$Catch = $objShell.Run('%comspec% /c "ftp -i -n -v -s:C:\test\FTPInput.txt" > nul',0,-1)
Now launch this with start wkix32 ftptest.kix As far as I can see, the script is running silent now. [Edit] Here is some more information about the Run method of WScript.Shell Windows Script Host Run Method (Windows Script Host) I think you need at least the .NET FrameWork 2.0 [/Edit]
Edited by Witto (2007-08-16 05:40 PM) Edit Reason: Added link to syntax for wshscript.run
|
Top
|
|
|
|
Moderator: Glenn Barnas, NTDOC, Arend_, Jochen, Radimus, Allen, ShaneEP, Ruud van Velsen, Mart
|
0 registered
and 1574 anonymous users online.
|
|
|