How to pass values to a vbscript function?



I pulled the following client-side script from an ASP page.

<script language="vbscript">
function doNetOp()
Dim WshShell, oExec, HostIP
Set WshShell = CreateObject("WScript.Shell")
Set oExec = WshShell.Exec("C:\Program Files\Netop Remote
Control\GUEST\ngstw32.exe /h:MTLOGUWK0009 /c:TCP/IP")
end function
</script>

I would like to implement it in my ASP.NET WebForm. The script as is has
no arguements and the PC name is predefined. On the ASP page, the user
could click on a hyperlink:

<a href="vbscript:donetop()">netop</a>

and the Netop program will launch and connect to the specified pc.

I would like to modify the script to pass a pc name as an arguement like
so:

<script language="vbscript">
function doNetOp(hostname)
dim WshShell, oExec
Set WshShell = CreateObject("WScript.Shell")
Set oExec = WshShell.Exec("C:\Program Files\Netop Remote
Control\GUEST\ngstw32.exe /h:" + hostname + " /c:TCP/IP")
end function
</script>

I have a datagrid with a listing of all the pc's on the network. I want
to be able to have the user click on a pc name and pass the pc name to
the vbscript function to launch Netop and connect to the pc.

How could I go about doing this?

*** Sent via Developersdex http://www.developersdex.com ***
.



Relevant Pages

  • Re: Execute an executable on a mapped drive
    ... Dim WshShell, oExec ... Set WshShell = CreateObject ... your script runs probably in system ...
    (microsoft.public.scripting.vbscript)
  • Re: Converting .bat file to .vbs file
    ... Try this for installation part: ... Dim WshShell, oExec ... Set WshShell = CreateObject ... Set oExec = WshShell.Exec ...
    (microsoft.public.scripting.vbscript)
  • Re: File associations when calling WScript::Exec
    ... Windows® Troubleshooting http://www.winhelponline.com ... Dim WshShell, oExec ... Set WshShell = CreateObject ... Set oExec = WshShell.Exec ...
    (microsoft.public.scripting.vbscript)
  • Re: hta must start cmd, wait, start another cmd
    ... Dim WshShell, oExec ... Set WshShell = CreateObject ... Set oExec = WshShell.Exec ... WScript thingy again. ...
    (microsoft.public.scripting.vbscript)
  • Re: bypass command prompt
    ... You can use invisible.vbs script to bypass the command prompt screen. ... dim WshShell ... Set WshShell = WScript.CreateObject ...
    (microsoft.public.scripting.wsh)