Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Download from Internet

Status
Not open for further replies.

Volkmaniac

Technical User
Mar 19, 2003
104
0
0
US
Is there a way I can specify the path I save a file to if I download the file from an internet site? For instance, if you download a program off the internet you'll get the "Save As" prompt and it will usually default to the last directory that you saved a file. Is there a way you can change the "Save As" directory?
 
I'm running the script in Telnet, but I'm actually downloading the file from a website through Windows. In other words, I'm using ProComm to login to the website, choose the file, then then downloading (or saving) it to my hard drive. I'm having the script type in the actual web address (with the file at the end) so it automatically chooses the file I need. I get a File Download prompt in Windows "Save As" but it will automatically save to the last directory where I downloaded a file off the internet. I'd like to change the "Save As" directory in Windows.


proc main
string sFile,sFile2,sFile3,sFile4,sFile5,sFile6
string sACS,sACS2
string sPath

integer szMonth, szDay, szYear, szHour, szMin, szSec
ltimeints $LTIME szYear szMonth szDay szHour szMin szSec

strfmt sFile "10571%d" szYear
strdelete sFile 5 1
strfmt sFile2 "%02d%02d" szMonth szDay
strdelete sFile2 0 1
strfmt sFile3 "%s.%s" sFile, sFile2
statmsg "%s" sFile3

strfmt sFile4 "105710SN"
strfmt sFile5 "%02d%02d" szMonth szDay
strdelete sFile5 0 1
strfmt sFile6 "%s.%s" sFile4, sFile5
statmsg "%s" sFile6

strfmt sPath "S:\Client Services\ACS\%02d%02d" szMonth szDay
set dnldpath sPath ;path I'd like to download the file
fetch dnldpath sPath

strfmt sACS " sFile3 ;1st file
run sACS ;go to the internet address
pause 2
winactivate "Enter Network Password"
winfocus "Enter Network Password"
sendkeystr "XXXXXX" login
sendvkey 9
pause 1
sendkeystr "XXXXXX" password
sendvkey 9 ;TAB
pause 1
sendvkey 9
pause 1
sendvkey 13 ;ENTER KEY
pause 10
strfmt sACS2 " sFile6 ;second file to download
run sACS2

endproc
 
I don't know how to change the download directory that IE uses (imagine it's a registry value of some sort), but can you navigate the Save As dialog (activating it like you did the login dialog) and set the directory to the specified value using the sendkeystr command?


aspect@aspectscripting.com
 
I'll ask our systems admin about the registry values. I tried using sendkeystr but it will not work. I also tried using the TAB key but the only thing that works is using the mouse to change the paths. It's still much easier than typing in the address, locating and downloading the file but I want to totally automate the task.

 
What version of IE are you using? If you right click on one of the links on this page (say the link to my site) and select Save Target As, are you seeing the same kind of dialog box?


aspect@aspectscripting.com
 
There are a large group of files contained in the site. I actually include the file name in the internet thread so the "Save As" dialog box pops up as soon as the password is entered. I'll just have to find another way.

Thanks,

Volkmaniac
 
I found out a way to change the registry values by creating a file. This will create and run a vbscript file that will instantly change the internet explorer download directory.

strfmt sSet "Set WshShell = WScript.CreateObject(`"Wscript.Shell`")"
statmsg "%s" sSet

strfmt sWrite "WshShell.RegWrite `"HKEY_CURRENT_USER\Software\Microsoft\Internet Explorer\Download Directory`",`"S:\Client Services\ACS\%02d%02d\`",`"REG_SZ`"" szMonth szDay
statmsg "%s" sWrite

strfmt sCR "%c" 13 ;string to hold carriage return
strfmt sLF "%c" 10 ;string to hold linefeed

fopen 1 "C:\WINNT\test.vbs" CREATE TEXT
fputs 1 sSet
fwrite 1 sCR 1
fwrite 1 sLF 1
fputs 1 sWrite
fclose 1
pause 1

run "C:\WINNT\test.vbs"
pause 3
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top