473,323 Members | 1,550 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,323 software developers and data experts.

STARTING NOTEPAD.exe from WEBPAGE

I have a webpage that is on my local machine.
The page will open NOTEPAD.exe on the local machine.

My intentions is to have a JAVAscript and a form. It seems that I
have some code problems:

Can anyone help?

The code is listed below:

<HTML>
<HEAD>

<SCRIPT type="text/javascript" LANGUAGE="JavaScript">
function executeCommands(inputparms)
{
// Instantiate the Shell object and invoke its execute method.

var oShell = new ActiveXObject("Shell.Application");

var commandtoRun = "C:\\WINDOWS\\Notepad.exe";
if (inputparms != "")
{
var commandParms = document.Form1.filename.value;
}

// Invoke the execute method.
oShell.ShellExecute(commandtoRun, commandParms, "", "open", "1");
}
</SCRIPT>

</HEAD>

<BODY>
<FORM name="Form1">
<CENTER>
<BR><BR>
<H1>Execute PC Commands From HTML </H1>
<BR><BR>
<File Name to Open:<Input type="text" name="filename" size="20"/>
<BR><BR>
<input type="Button" name="Button1" value="Run Notepad.exe"
onClick="executeCommands()" />

<BR><BR>
<input type="Button" name="Button2" value="Run Notepad.exe with
Parameters" onClick="executeCommands(' + hasPARMS + ')" />
</CENTER>
</FORM>
</BODY>

</HTML>

Apr 24 '07 #1
3 19016
ke*************@gmail.com wrote:
I have a webpage that is on my local machine.
The page will open NOTEPAD.exe on the local machine.

My intentions is to have a JAVAscript and a form. It seems that I
have some code problems:

Can anyone help?

The code is listed below:

<HTML>
<HEAD>

<SCRIPT type="text/javascript" LANGUAGE="JavaScript">
function executeCommands(inputparms)
{
// Instantiate the Shell object and invoke its execute method.

var oShell = new ActiveXObject("Shell.Application");

var commandtoRun = "C:\\WINDOWS\\Notepad.exe";
if (inputparms != "")
{
var commandParms = document.Form1.filename.value;
}

// Invoke the execute method.
oShell.ShellExecute(commandtoRun, commandParms, "", "open", "1");
}
</SCRIPT>

</HEAD>

<BODY>
<FORM name="Form1">
<CENTER>
<BR><BR>
<H1>Execute PC Commands From HTML </H1>
<BR><BR>
<File Name to Open:<Input type="text" name="filename" size="20"/>
<BR><BR>
<input type="Button" name="Button1" value="Run Notepad.exe"
onClick="executeCommands()" />

<BR><BR>
<input type="Button" name="Button2" value="Run Notepad.exe with
Parameters" onClick="executeCommands(' + hasPARMS + ')" />
</CENTER>
</FORM>
</BODY>

</HTML>
There are a few things wrong. However, I don't play Internet Explorer.

And as much as I hate to post this link (only because it is not viewable
via the web), here it is:

VK wrote a minimalistic "application launcher." Hence "al."

http://www.geocities.com/schools_ring/al.zip

Download that and view the HTML document within to get an idea of where
your code is going bonkers.

--
-Lost
Remove the extra words to reply by e-mail. Don't e-mail me. I am
kidding. No I am not.
Apr 24 '07 #2
On Apr 23, 10:57 pm, -Lost <maventheextrawo...@techie.comwrote:
kevin.a.swee...@gmail.com wrote:
I have a webpage that is on my local machine.
The page will open NOTEPAD.exe on the local machine.
My intentions is to have a JAVAscript and a form. It seems that I
have some code problems:
Can anyone help?
The code is listed below:
<HTML>
<HEAD>
<SCRIPT type="text/javascript" LANGUAGE="JavaScript">
function executeCommands(inputparms)
{
// Instantiate the Shell object and invoke its execute method.
var oShell = new ActiveXObject("Shell.Application");
var commandtoRun = "C:\\WINDOWS\\Notepad.exe";
if (inputparms != "")
{
var commandParms = document.Form1.filename.value;
}
// Invoke the execute method.
oShell.ShellExecute(commandtoRun, commandParms, "", "open", "1");
}
</SCRIPT>
</HEAD>
<BODY>
<FORM name="Form1">
<CENTER>
<BR><BR>
<H1>Execute PC Commands From HTML </H1>
<BR><BR>
<File Name to Open:<Input type="text" name="filename" size="20"/>
<BR><BR>
<input type="Button" name="Button1" value="Run Notepad.exe"
onClick="executeCommands()" />
<BR><BR>
<input type="Button" name="Button2" value="Run Notepad.exe with
Parameters" onClick="executeCommands(' + hasPARMS + ')" />
</CENTER>
</FORM>
</BODY>
</HTML>

There are a few things wrong. However, I don't play Internet Explorer.

And as much as I hate to post this link (only because it is not viewable
via the web), here it is:

VK wrote a minimalistic "application launcher." Hence "al."

http://www.geocities.com/schools_ring/al.zip

Download that and view the HTML document within to get an idea of where
your code is going bonkers.

--
-Lost
Remove the extra words to reply by e-mail. Don't e-mail me. I am
kidding. No I am not.

This script works like a charm in Mozilla only, I know by you note
you don't play in IE, but is it possible to get it to work in IE as
well?

kevin

Apr 24 '07 #3
VK
On Apr 24, 6:17 pm, kevin.a.swee...@gmail.com wrote:
his script works like a charm in Mozilla only, I know by you note
you don't play in IE, but is it possible to get it to work in IE as
well?
If you are talking about http://www.geocities.com/schools_ring/al.zip
then it works for any browser supporting XPCOM or WShell over ActiveX
hence any Gecko-based browser and IE>=4 (that includes Firefox, IE6,
IE7)
Obviously it requires security settings down to low - at the very
least "Ask before launching unsigned components". If current settings
are "Never launch unsigned components" then this script will be
silently disregarded, this is what is happening on your IE. My script
is targeted to specific intranet solutions with controllable security
environment. For the default Internet security environment it is
pretty much useless. For the latter case you need a full standing
XPCOM/ActiveX module signed by a valid security certificate in order
to trig security permission dialog client-side.

Apr 28 '07 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: spmm# | last post by:
Hi! Can someone explain how I can properly start (e.g.) notepad from an ASP.NET/C# page?? I've been googling for a day now, but no one seems to experience the same trouble as I do. I gave...
2
by: Ale | last post by:
I try to start a program with process.start method. It normally starts but no window is displayed, i only see the application process running on the taskmanager. I think the process is executed...
3
by: Thomas Wenzl [MVP] | last post by:
Hello, Initial situation: - ASP.NET application. - Users upload a file - that file has to be converted into another file format using a unmanged application that uses a lot of COM components ...
2
by: spmm# | last post by:
Hi! Can someone explain to me how I can start ms access from a ASP.NET/C# page properly?? I've been googling for a day now, but no one seems to experience the same trouble as I do. I gave the...
2
by: andreas | last post by:
hi, In windows xp in the start launch menu when i put notepad "c:\test.txt" i get notepad with test.txt in it. in vb.net when i state system.diagnostics.process.start("notepad.exe" i get...
2
by: tshad | last post by:
I have a Windows Service I am trying to get to work, which is not working correct, but one of the things it does is start Notepad.exe. The program seems to be doing this and it shows in the...
9
by: =?Utf-8?B?Vmlua2k=?= | last post by:
Hello Everyone, I have this code for sendKeys. This simply sends a text to the notepad. This method runs fine, but I don't see the notepad and the text entered in that notepad. Is there any way...
1
by: kevin.a.sweeney | last post by:
I would like to open an application from a hyperlink on a webpage. 1. the webpage is located on my local machine. 2. the application is located on my local machine. 3. the application will run...
1
by: Sanka | last post by:
Does anyone know any VB code where I can move the HTML coding that I have in a Notepad file to the source code of a webpage? Thanks Sanka
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.