vbscript - Argument passing in vbs -


i have executable (wget.exe) wish run invisibly through simple vbs file - have little experience vbs. wget.exe receives single parameter, url of online file download text file in current directory, protocol , all.

my issue lies in passing paramaters through invisibility script. following script works flawlessly:

set wshshell = wscript.createobject("wscript.shell")  wshshell.run """path\to\wget.exe"" http://www.url.com/helloworld", 0 , false 

however, uses string literal url parameter. when try change vbs accept parameter of own pass executable, fails when run. altered script follows:

set wshshell = wscript.createobject("wscript.shell")  wshshell.run """c:\users\alienware\desktop\game\wget.exe""wscript.arguments.item(0)", 0 , false  

i've fiddled , played hours on end, no avail. it's extremely simple i'm missing, ask fresh set of eyes tell me going wrong here.

thanks in advance.

no space between program name , url. item within quotes passing wscript.arguments.item(0) actual url (there no item(0) top level domain).

the url has 100% correct. unlike browser there no code fix urls.

the purpose of program error details.

how correct url type url in browser, navigate, , correct url in address bar. other way use properties of link etc url.

also microsoft.xmlhttp maps microsoft.xmlhttp.1.0. hkey_classes_root\msxml2.xmlhttp maps msxml2.xmlhttp.3.0. try later one

try way using xmlhttp. edit url's etc. if seems work comment out if / end if dump info if seeming work. it's vbscript vbscript works in vb6.

 on error resume next  set file = wscript.createobject("microsoft.xmlhttp")  file.open "get", "http://www.microsoft.com/en-au/default.aspx", false  'this ie 8 headers  file.setrequestheader "user-agent", "mozilla/4.0 (compatible; msie 8.0; windows nt 6.0; trident/4.0; slcc1; .net clr 2.0.50727; media center pc 5.0; .net clr 1.1.4322; .net clr 3.5.30729; .net clr 3.0.30618; .net4.0c; .net4.0e; bcd2000; bcd2000)"  file.send  if err.number <> 0      line =""     line  = line &  vbcrlf & ""      line  = line &  vbcrlf & "error getting file"      line  = line &  vbcrlf & "=================="      line  = line &  vbcrlf & ""      line  = line &  vbcrlf & "error " & err.number & "(0x" & hex(err.number) & ") " & err.description      line  = line &  vbcrlf & "source " & err.source      line  = line &  vbcrlf & ""      line  = line &  vbcrlf & "http error " & file.status & " " & file.statustext     line  = line &  vbcrlf &  file.getallresponseheaders     wscript.echo line     err.clear     wscript.quit  end if  on error goto 0   set bs = createobject("adodb.stream")  bs.type = 1  bs.open  bs.write file.responsebody  bs.savetofile "c:\users\test.txt", 2 

also see if these other objects work.

c:\users>reg query hkcr /f xmlhttp  hkey_classes_root\microsoft.xmlhttp hkey_classes_root\microsoft.xmlhttp.1.0 hkey_classes_root\msxml2.serverxmlhttp hkey_classes_root\msxml2.serverxmlhttp.3.0 hkey_classes_root\msxml2.serverxmlhttp.4.0 hkey_classes_root\msxml2.serverxmlhttp.5.0 hkey_classes_root\msxml2.serverxmlhttp.6.0 hkey_classes_root\msxml2.xmlhttp hkey_classes_root\msxml2.xmlhttp.3.0 hkey_classes_root\msxml2.xmlhttp.4.0 hkey_classes_root\msxml2.xmlhttp.5.0 hkey_classes_root\msxml2.xmlhttp.6.0 end of search: 12 match(es) found. 

also aware there limit on how many times can call particular xmlhttp object before lockout occurs. if happens, , when debugging code, change different xmlhttp object


Comments

Popular posts from this blog

javascript - Jquery show_hide, what to add in order to make the page scroll to the bottom of the hidden field once button is clicked -

javascript - Highcharts multi-color line -

javascript - Enter key does not work in search box -