473,320 Members | 2,107 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,320 software developers and data experts.

Execute a windows program from an anchor tag

gf
I believe I am close but I have spent several hours investigating this and
can't understand why it won't work. I have tried exec, system, and settled
on popen from reading various notes on the subject. I am wanting to launch
a file editor when I click on a link. This is strictly an internal
application so I don't need to worry about escaping shell/args. This is
what seems as if it should work, however it doesn't. This is on XP, latest
Apache 1.3.29 and PHP. The logic makes it into the "if" test and the file
exists. Thanks.

if (chdir("C:\\Program Files\\TextPad 4")) {
$cmd = "start \"textpad.exe\" x:\\web\\program.php";
pclose(popen($cmd, "r"));
}
Jul 17 '05 #1
11 2285
gf wrote:
I believe I am close but I have spent several hours investigating this and
can't understand why it won't work. I have tried exec, system, and settled
on popen from reading various notes on the subject. I am wanting to launch
a file editor when I click on a link. This is strictly an internal
application so I don't need to worry about escaping shell/args. This is
what seems as if it should work, however it doesn't. This is on XP, latest
Apache 1.3.29 and PHP. The logic makes it into the "if" test and the file
exists. Thanks.

if (chdir("C:\\Program Files\\TextPad 4")) {
$cmd = "start \"textpad.exe\" x:\\web\\program.php";
pclose(popen($cmd, "r"));
}


(not sure about this)
Bring up the "Windows Task Manager" (Ctrl+Shift+Esc on Windows 2000) and
see how many textpad's you have running :)

I guess the system account is running textpad, not the account you are
using to check your script.
--
--= my mail box only accepts =--
--= Content-Type: text/plain =--
--= Size below 10001 bytes =--
Jul 17 '05 #2
"gf" <gf******@earthlink.net> wrote in message
news:HD***************@newsread1.news.pas.earthlin k.net...
I believe I am close but I have spent several hours investigating this and
can't understand why it won't work. I have tried exec, system, and settled on popen from reading various notes on the subject. I am wanting to launch a file editor when I click on a link. This is strictly an internal
application so I don't need to worry about escaping shell/args. This is
what seems as if it should work, however it doesn't. This is on XP, latest Apache 1.3.29 and PHP. The logic makes it into the "if" test and the file
exists. Thanks.

if (chdir("C:\\Program Files\\TextPad 4")) {
$cmd = "start \"textpad.exe\" x:\\web\\program.php";
pclose(popen($cmd, "r"));
}


gf,
Could be that the effective PATH does not include ".",
so the .exe is not being found
even though you are in the relevant directory.
Try using the absolute path of the executable:
if (chdir("C:\\Program Files\\TextPad 4")) {
$cmd = "start \"C:\\Program Files\\TextPad 4\\textpad.exe\"
x:\\web\\program.php";
pclose(popen($cmd, "r"));
}

Just my $0.02
Doug
--
Remove the blots from my address to reply
Jul 17 '05 #3
gf
> gf,
Could be that the effective PATH does not include ".",
so the .exe is not being found
even though you are in the relevant directory.
Try using the absolute path of the executable:
if (chdir("C:\\Program Files\\TextPad 4")) {
$cmd = "start \"C:\\Program Files\\TextPad 4\\textpad.exe\"
x:\\web\\program.php";
pclose(popen($cmd, "r"));
}

Just my $0.02
Doug
--

I had tried that originally and then I read on another site that it was
recommended that you chdir first. But thanks.
Jul 17 '05 #4
gf
> (not sure about this)
Bring up the "Windows Task Manager" (Ctrl+Shift+Esc on Windows 2000) and
see how many textpad's you have running :)

I guess the system account is running textpad, not the account you are
using to check your script.
--


Only the single instance. It matters not what program command I try - none
will work.
Jul 17 '05 #5
gf wrote:
Only the single instance. It matters not what program command I try - none
will work.


Have you tried a non-interactive command?

maybe copy a file?

<?php
exec('cmd /c copy existing_file.txt new_file.txt');
?>

and check if the copy exists after you run the script
--
--= my mail box only accepts =--
--= Content-Type: text/plain =--
--= Size below 10001 bytes =--
Jul 17 '05 #6
Won't work if Apache is running as a service, because services don't have
access to the desktop.

Run Apache as a user-app instead.

Uzytkownik "gf" <gf******@earthlink.net> napisal w wiadomosci
news:HD***************@newsread1.news.pas.earthlin k.net...
I believe I am close but I have spent several hours investigating this and
can't understand why it won't work. I have tried exec, system, and settled on popen from reading various notes on the subject. I am wanting to launch a file editor when I click on a link. This is strictly an internal
application so I don't need to worry about escaping shell/args. This is
what seems as if it should work, however it doesn't. This is on XP, latest Apache 1.3.29 and PHP. The logic makes it into the "if" test and the file
exists. Thanks.

if (chdir("C:\\Program Files\\TextPad 4")) {
$cmd = "start \"textpad.exe\" x:\\web\\program.php";
pclose(popen($cmd, "r"));
}

Jul 17 '05 #7
gf
Assuming this to be the case, this is not practical. I would have to think
there is a way to give Apache access to the desktop, as other services have
access to the desktop.

"Chung Leong" <ch***********@hotmail.com> wrote in message
news:-P********************@comcast.com...
Won't work if Apache is running as a service, because services don't have
access to the desktop.

Run Apache as a user-app instead.

Uzytkownik "gf" <gf******@earthlink.net> napisal w wiadomosci
news:HD***************@newsread1.news.pas.earthlin k.net...
I believe I am close but I have spent several hours investigating this and can't understand why it won't work. I have tried exec, system, and
settled on popen from reading various notes on the subject. I am wanting to
launch a file editor when I click on a link. This is strictly an internal
application so I don't need to worry about escaping shell/args. This is
what seems as if it should work, however it doesn't. This is on XP, latest
Apache 1.3.29 and PHP. The logic makes it into the "if" test and the file
exists. Thanks.
if (chdir("C:\\Program Files\\TextPad 4")) {
$cmd = "start \"textpad.exe\" x:\\web\\program.php";
pclose(popen($cmd, "r"));
}

Jul 17 '05 #8
Duh. I didn't notice the "Allow service to interact with desktop" checkbox
in the service properties page.

Uzytkownik "gf" <gf******@earthlink.net> napisal w wiadomosci
news:nb****************@newsread1.news.pas.earthli nk.net...
Assuming this to be the case, this is not practical. I would have to think there is a way to give Apache access to the desktop, as other services have access to the desktop.

"Chung Leong" <ch***********@hotmail.com> wrote in message
news:-P********************@comcast.com...
Won't work if Apache is running as a service, because services don't have
access to the desktop.

Run Apache as a user-app instead.

Uzytkownik "gf" <gf******@earthlink.net> napisal w wiadomosci
news:HD***************@newsread1.news.pas.earthlin k.net...
I believe I am close but I have spent several hours investigating this
and can't understand why it won't work. I have tried exec, system, and
settled on popen from reading various notes on the subject. I am wanting

to launch a file editor when I click on a link. This is strictly an internal
application so I don't need to worry about escaping shell/args. This is
what seems as if it should work, however it doesn't. This is on XP, latest Apache 1.3.29 and PHP. The logic makes it into the "if" test and the file
exists. Thanks.
if (chdir("C:\\Program Files\\TextPad 4")) {
$cmd = "start \"textpad.exe\" x:\\web\\program.php";
pclose(popen($cmd, "r"));
}


Jul 17 '05 #9
gf
Thanks. I tried that and it makes no fifference. Really frustrating!

"Chung Leong" <ch***********@hotmail.com> wrote in message
news:PP********************@comcast.com...
Duh. I didn't notice the "Allow service to interact with desktop" checkbox
in the service properties page.

Uzytkownik "gf" <gf******@earthlink.net> napisal w wiadomosci
news:nb****************@newsread1.news.pas.earthli nk.net...
Assuming this to be the case, this is not practical. I would have to think
there is a way to give Apache access to the desktop, as other services

have
access to the desktop.

"Chung Leong" <ch***********@hotmail.com> wrote in message
news:-P********************@comcast.com...
Won't work if Apache is running as a service, because services don't have access to the desktop.

Run Apache as a user-app instead.

Uzytkownik "gf" <gf******@earthlink.net> napisal w wiadomosci
news:HD***************@newsread1.news.pas.earthlin k.net...
> I believe I am close but I have spent several hours investigating
this and can't understand why it won't work. I have tried exec, system, and
settled on popen from reading various notes on the subject. I am wanting to
launch a file editor when I click on a link. This is strictly an

internal application so I don't need to worry about escaping shell/args. This is
what seems as if it should work, however it doesn't. This is on XP,

latest
Apache 1.3.29 and PHP. The logic makes it into the "if" test and the file exists. Thanks.
>
> if (chdir("C:\\Program Files\\TextPad 4")) {
> $cmd = "start \"textpad.exe\" x:\\web\\program.php";
> pclose(popen($cmd, "r"));
> }



Jul 17 '05 #10
Did you, eh, restart the service?

Uzytkownik "gf" <gf******@earthlink.net> napisal w wiadomosci
news:po*****************@newsread1.news.pas.earthl ink.net...
Thanks. I tried that and it makes no fifference. Really frustrating!

"Chung Leong" <ch***********@hotmail.com> wrote in message
news:PP********************@comcast.com...
Duh. I didn't notice the "Allow service to interact with desktop" checkbox
in the service properties page.

Uzytkownik "gf" <gf******@earthlink.net> napisal w wiadomosci
news:nb****************@newsread1.news.pas.earthli nk.net...
Assuming this to be the case, this is not practical. I would have to

think
there is a way to give Apache access to the desktop, as other services

have
access to the desktop.

"Chung Leong" <ch***********@hotmail.com> wrote in message
news:-P********************@comcast.com...
> Won't work if Apache is running as a service, because services don't

have
> access to the desktop.
>
> Run Apache as a user-app instead.
>
> Uzytkownik "gf" <gf******@earthlink.net> napisal w wiadomosci
> news:HD***************@newsread1.news.pas.earthlin k.net...
> > I believe I am close but I have spent several hours investigating

this and can't understand why it won't work. I have tried exec, system, and settled on popen from reading various notes on the subject. I am wanting
to
launch a file editor when I click on a link. This is strictly an

internal application so I don't need to worry about escaping shell/args. This is what seems as if it should work, however it doesn't. This is on XP,

latest
Apache 1.3.29 and PHP. The logic makes it into the "if" test and the file exists. Thanks.
> >
> > if (chdir("C:\\Program Files\\TextPad 4")) {
> > $cmd = "start \"textpad.exe\" x:\\web\\program.php";
> > pclose(popen($cmd, "r"));
> > }



Jul 17 '05 #11
gf
Of course.

"Chung Leong" <ch***********@hotmail.com> wrote in message
news:7J********************@comcast.com...
Did you, eh, restart the service?

Uzytkownik "gf" <gf******@earthlink.net> napisal w wiadomosci
news:po*****************@newsread1.news.pas.earthl ink.net...
Thanks. I tried that and it makes no fifference. Really frustrating!

"Chung Leong" <ch***********@hotmail.com> wrote in message
news:PP********************@comcast.com...
Duh. I didn't notice the "Allow service to interact with desktop" checkbox in the service properties page.

Uzytkownik "gf" <gf******@earthlink.net> napisal w wiadomosci
news:nb****************@newsread1.news.pas.earthli nk.net...
> Assuming this to be the case, this is not practical. I would have to think
> there is a way to give Apache access to the desktop, as other services have
> access to the desktop.
>
> "Chung Leong" <ch***********@hotmail.com> wrote in message
> news:-P********************@comcast.com...
> > Won't work if Apache is running as a service, because services don't have
> > access to the desktop.
> >
> > Run Apache as a user-app instead.
> >
> > Uzytkownik "gf" <gf******@earthlink.net> napisal w wiadomosci
> > news:HD***************@newsread1.news.pas.earthlin k.net...
> > > I believe I am close but I have spent several hours
investigating
this
> and can't understand why it won't work. I have tried exec, system, and > settled on popen from reading various notes on the subject. I am wanting
to
> launch a file editor when I click on a link. This is strictly an

internal
> application so I don't need to worry about escaping shell/args.
This is > what seems as if it should work, however it doesn't. This is on XP,
latest
> Apache 1.3.29 and PHP. The logic makes it into the "if" test and

the file
> exists. Thanks.
> > >
> > > if (chdir("C:\\Program Files\\TextPad 4")) {
> > > $cmd = "start \"textpad.exe\" x:\\web\\program.php";
> > > pclose(popen($cmd, "r"));
> > > }
>
>



Jul 17 '05 #12

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

Similar topics

13
by: BlackHawke | last post by:
Our program, game program Andromeda Online (www.andromedaonline.net) uses two programs- one to play the game, another to patch the game as updates come out. Players actually launch the updater...
5
by: max(01)* | last post by:
hello. i wrote a very simple tkinter demo program that uses menus, buttons, labels, entries, frames and secondary toplevels. it is a python version of a java program made by a colleague. ...
1
by: Thomas | last post by:
Hi all, I want to execute a new program in a c++ program without beeing blocked. After the child process is created both processes should run idependend. My method at the moment: execute(...
1
by: Bowen Simmons | last post by:
OK. I have a test html page: "To.html": <html> <head> <title>To</title> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> <script language="JavaScript">
4
by: Chris | last post by:
I posted this in the C# language group, then thought it might be more appropriate in this group. I would not cross-post except I want the answer so badly. I built small C# Web and Web Service...
2
by: JohnR | last post by:
Let's say I have an MDI parent form with a textbox. If I create an MDI child form and, at runtime, move the MDI child window over the textbox on the MDI parent, the textbox appears in front of the...
4
by: Rod Gill | last post by:
Hi, I have a form that when opened in the designer appears of the screen. The form selector can't be dragged (or resized) and if I scroll right and down to centralise it the form simply jumps...
1
by: klynn | last post by:
I just built a .NET app where I put in the page an anchor such as: <a id="whatever" href="somesite" target="_blank">My anchor</a> for just one of my clients, when they click this anchor, ALL of...
3
by: Spartanicus | last post by:
I need to execute a function after a link to a section within the same document has been clicked and the navigation has occurred. When using the onclick event handler the JS function is executed...
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
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...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
0
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.