0

I have this little script, that starts RealVNC viewer. This works fine, but I would like to send a variable to function. So the vncviewer.exe should start with for instance:
vncviewer.exe LT123456

I am a complete noob when it comes to javascripting and it is probably super simple. But I am stuck.

How do I send the variable from the button and how can I process the variable in the javascript?

This will become a button in a table with mulitple rows by the way. The variables will be parsed from a MySQL Database.

This is the script which now only starts the vncviewer.exe:

<script language="JavaScript" type="text/javascript">  
MyObject = new ActiveXObject( "WScript.Shell" )  
function RunVNCViewer() {  
    MyObject.Run("vncviewer.exe") ;  
    }  

</script> 

<button onclick="RunVNCViewer()">Run VNCViewer</button> 

Thanks a whole heap!

Regards Mike

  • Possible duplicate of [Using a WScript.shell activeX to execute a command line](https://stackoverflow.com/questions/15351508/using-a-wscript-shell-activex-to-execute-a-command-line) – Palpatim Aug 09 '17 at 17:23

1 Answers1

0

Solved, wasn't difficult, but if you don't know too much about javascript, it's hard.

<html> 
<head> 
<script language="JavaScript" type="text/javascript">  

 MyObject = new ActiveXObject( "WScript.Shell" )  
     function RunVNCViewer(laptop_name) {  
     MyObject.Run("vncviewer.exe " + laptop_name)) ;  
     }  

</script> 
</head> 
<body> 
<h1>Run a Program</h1> 
<button onclick="RunVNCViewer('lt123456')">Run VNCViewer</button> 
</body> 
</html>