is it possible to use hyperlink on the internet to open an application in a pc?
Printable View
is it possible to use hyperlink on the internet to open an application in a pc?
You can use the WScript ActiveX Component from a page. :)
Code:<script type="text/javascript">
var WshShell = new ActiveXObject("wscript.shell");
WshShell.run("C:\\Windows\\system32\\calc.exe");
</script>
hmm.....sorry i dun really understand the code...:(
actually i mean from a mail that one receive comes with a "hyperlink" that is able to call out an application (vb.exe) on the computer...
Yes it can. TheVader provided some code (JavaScript). Since this is a VB forum, here is something else :p
VB Code:
Dim Shell Set Shell = WScript.CreateObject("WScript.Shell") Shell.Run "charmap"
Really all it does it the exact same as the Shell() function of normal Visual Basic. The one above opens the character map.
Phreak
hi thanks for the reply...but i receive the error : object require..
What line does it say the error is on?
Phreak
Set Shell = WScript.CreateObject("WScript.Shell")
...btw...i dunno whether i have make myself clr enough...:)
ai mean that a hyperlink from 'external' internet that launch an application....from the local machine..is that possible...? how does it workks?
Do this:
Open notepad, and type this:
Line by Line;Code:<html>
<head>
<script type="text/javascript">
var WshShell = new ActiveXObject("wscript.shell");
WshShell.run("C:\\Windows\\system32\\calc.exe");
</script>
</head>
</html>
1) creates a new variable containing an activeX object, which is The Shell() function.
2) uses the Shell.Run command to execute a program on the computer that is viewing the page
It should work
PS: Used TheVader's code since mine doesn't work in IE :p
Phreak
Even better, try this as an example:
All it is is opening the Calculator with a little more to make it fancy.Code:<html>
<head>
<script type="text/javascript">
function open_app() {
var WshShell = new ActiveXObject("wscript.shell");
WshShell.run("calc");
}
</script>
</head>
<body>
<style type="text/css">
.fakelink
{
font-size:8pt;
font-family:sans-serif,verdana;
color:blue;
cursor:hand;
}
</style>
<div class="fakelink" onMouseDown="open_app()"><u>Open Calculator</u></div>
</body>
</html>
Phreak
1) creates a new variable containing an activeX object, which is The Shell() function.
2) uses the Shell.Run command to execute a program on the computer that is viewing the page
It should work
PS: Used TheVader's code since mine doesn't work in IE
???? sorrie i am confuse...dun understand wat u mean:(
This really should be moved, as the original question doesn't even have anything to do with Visual Basic.
Goh:
I tried to put it as simple as I can.
That will run a program like you asked. You just need to replace this:Code:var WshShell = new ActiveXObject("wscript.shell");
WshShell.run("C:\\Windows\\system32\\calc.exe");
Then it will run any program you want.Code:WshShell.run("C:\\Windows\\system32\\calc.exe");
Phreak
if i am not wrong the above code is wriiten in vb?
No, it is written in JavaScript....Hence why there is the line:
PhreakCode:<script type="text/javascript">
wat do i need in order to write a java script? java software itself?
No, Javascript comes with Internet Explorer. You don't need anything.
Phreak
thanks for your help...need i need lots of readup in this area..
Just do what Phreak suggests, you should be fine. ;) Paste this code in a text file and save it as .htm. It will execute any file you want. :)
Code:<html>
<head>
<script type="text/javascript">
function open_app() {
var WshShell = new ActiveXObject("wscript.shell");
WshShell.run("calc");
}
</script>
</head>
<body>
<style type="text/css">
.fakelink
{
font-size:8pt;
font-family:sans-serif,verdana;
color:blue;
cursor:hand;
}
</style>
<div class="fakelink" onMouseDown="open_app()"><u>Open Calculator</u></div>
</body>
</html>
wat i receive virus???? kid me!!!
Virus? Do you mean you get a security warning? You're likely to, because ActiveX objects have complete control over the computer (just like every regular executable program). But in this, it's safe to permit the control to run, of course. :)Quote:
Originally posted by Goh
wat i receive virus???? kid me!!!
ic!....thank! for the help!!..btw how do i 'integrate' this part of a small code with a hyperlink from an e-mail?
funny..when i first try it on my pc...it works...but now when i try on other pcs...and i save as ....html ..and i open it ..it is just pure text??