PATH Environmental Variable start/run permission

J

jtfaulk

I've created an application that I need to launch from a web browser.
So I tried these steps:

1. on the install I modified the PATH environmental variable to include
the path on the application directory.
2. on the web pages uses java script to call ShellExecute to call the
application.

This actually does launch the application; however there seems to be a
permission error. Because if I simply launch the application normally
(either by clicking the executable or the shortcut) the app launches
fine. However when I launch from the javascript shellexecute it errors
out at the line of code when I try to delete some temp files.

Bascially it doesn't have permission to delete the temp files when i
launch the app from the java script; but does when I lauch from the
shortcut.

Does anybody have any idea how I can remedy this?
 
M

Martin Honnen

I've created an application that I need to launch from a web browser.
So I tried these steps:

1. on the install I modified the PATH environmental variable to include
the path on the application directory.
2. on the web pages uses java script to call ShellExecute to call the
application.

"java script"? And "ShellExecute"? Is ShellExecute a function a browser
exposes to JavaScript? Which browser is that?
I think you need to be more specific, you might be targetting Windows
and IE and try to access the WSH shell object or the Windows shell
object but perhaps you are doing something completely different.
 
J

jtfaulk

Danny said:
Yes, he's ranting about WSH.exe calls through an activeX object in IE win32
ONLY.

On the specific matter, you're not supposed to be launching any
executables to begin with from js, and the permission issue is due to
settings on activeX scripts defaults on IE-win32, bear in mind that is good
only in win32 IE, not elsewhere, and for NTFS filesystems, it may also
encounter OS permission enforcements based on the account logged in.
Either way, if you need to run/access executables, use a server sided
language, ASP or PHP or if you need it for IE only, VBS.


Danny


Ok I figured this out what was our problem: it was NOT a permission
issue.

You can in fact use the ShellExecute in js to launch applications (no
prob). The problem was how we were determining the CurAppPath (or the
path of the directory where the application is currently installed).
When we launched the application normally this worked fine; but when we
tried to launch it from the shellexecute in js the path I got was wrong
(i'm not sure is it was the path where the browser was located or where
the scrun (?) was located). So when we fixed that it was ok; no
permission errors.

Thank you
 
M

Martin Honnen

You can in fact use the ShellExecute in js to launch applications (no
prob).

If it works with your particular settings and requirements then fine,
but in general with normal security settings IE does not allow a web
page loaded via HTTP to do stuff like

var wshShell = new ActiveXObject('WScript.Shell');
wshShell.Run('notepad.exe');

the object creation will not be allowed.

And with Windows XP SP 2 and IE there script and ActiveX in HTML
documents loaded from the file system is disabled by default and only if
the user after a warning allows it the page is reloaded with script and
ActiveX enabled.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,755
Messages
2,569,537
Members
45,020
Latest member
GenesisGai

Latest Threads

Top