The last line then runs the FTP utility that comes with Windows Vista to
transfer the JPG file to a web server (available for free from nearly all Internet
service providers). Normally, FTP is an interactive program, requiring
that the user type commands into the console, but the -n and -s options
shown here eliminate the need for user interaction. Replace myhost.com with
the name of the server containing your web account. Example 9-4 shows the
FTP script used by the WSH script in Example 9-3; type it into a plain-text
file and save it as ftpscript.txt.
The FTP script, like a batch file, is simply a text file containing the commands
(in order) that you??™d otherwise type manually into the FTP console
window. Naturally, you??™ll want to replace the specifics, like mylogin and
mypassword, with your own login and password, respectively, and public_html
with the directory containing your public HTML files. Note that all commands
must be typed lowercase. Type FTP -? at the Command Prompt for
more command-line parameters.
Example 9-3. Internet fishtank script
On Error Resume Next
ImageFile = "c:\camera\fish.jpg"
Call FileDelete(ImageFile)
Call RunProgram("c:\camera\camera.exe " & ImageFile, True)
If Not FileExists(ImageFile) Then WScript.Quit
Call RunProgram ("ftp -n -s:c:\camera\ftpscript.txt myhost.com", False)
Example 9-4. FTP script for use with Internet-fishtank script
user mylogin
pass mypassword
bin
cd public_html
put c:\camera\fish.
Pages:
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766