473,563 Members | 2,709 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

JavaScript ActiveXObject error

I need some immediate guidance with an error I am facing using an
ActiveXObject to instantiate a DLL and use the object to launch a
command on the local client. I use this great DLL called LaunchinIE
which works for the most part. But I am running into a hurdle in my
application, as described below...

I have set up an ASP page with the following code on the web server:

<html>
<head>
<title>Testin g Application Launch In IE</title>
<script language="JavaS cript">
function launchApp(strCm dLine)
{
var obj = new ActiveXObject(" LaunchinIE.Laun ch");
obj.LaunchAppli cation(strCmdLi ne);
}
</script>
</head>
<body>
<script language="JavaS cript">
var qt = '"';
var strCmdLine = 'C:\\ddc32\\ddc 32.exe ';
strCmdLine += 'ddc(dsp(30, Application Login, Logging in to
Application..., 3) if w4w(2, Missing Client ID) else if w4i(40,GenQL,)
wait(6) skw(0,GenQL TSTUSER{enter}T STPWD{enter}) endif endif dsp()) &&
';
strCmdLine += qt+'C:\\Program Files\\GenQL\\g enql.exe'+qt + ' ';
strCmdLine += 'GenQL.App Name=Desktop70' ;
launchApp(strCm dLine);
</script>
</body>
</html>

On the client system, I registered the launchinIE.dll component that
suppresses the IE security prompt for opening or saving an executable.
Now, when I try to access this page from the client, the first part of
the command works, i.e. the ddc32 winbatch executable. But the second
part of the command is not recognized and a message box shows up
stating that the command is unknown.

Surprisingly, if I try the exact two commands from the DOS command
line, i.e.

C:\ddc32\ddc32. exe ddc(dsp(30, Application Login, Logging in to
Application..., 3) if w4w(2, Missing Client ID) else if w4i(40,GenQL,)
wait(6) skw(0,GenQL TSTUSER{enter}T STPWD{enter}) endif endif dsp()) &&
"C:\Program Files\GenQL\gen ql.exe" GenQL.App Name=Desktop70

.... both commands are executed in sequence and work just fine. Since
the command is included in JavaScript, I had to escape the reverse
slash and alias the double quote character with a variable "qt". Also,
the && is more like Unix, where the result of the first command
decides whether or not to execute the second command. In other words,
if the first command returns TRUE, the second command is executed only
then. I know your DLL works just fine, because if I replace this long
command with something simpler like...

C:\ddc32\displa y1.bat ashwin && C:\ddc32\displa y2.bat raj

.... it works just fine. I feel this may be a JavaScript type of issue,
and it is somehow unable to parse the argument to the first command
ddc32, thereby failing the second command.

I greatly appreciate any help!
Jul 23 '05 #1
5 12445
> ... I use this great DLL called LaunchinIE
which works for the most part. But I am running into a hurdle in my
application, as described below...


In that you are callng a method of a 3rd party component, your best bet is
to contact the author (email address from the site:
rockin_AT_whirl ywiryweb.com).

--
Michael Harris
Microsoft.MVP.S cripting
Sammamish WA US

Jul 23 '05 #2
Mike,

I have done that too, and I think the author has been very forthcoming
in his support. Even then, this is an issue related to JavaScript,
because I can replace that long command string with something similar
like...

myObj.launchApp lication("mdisp lay1.bat ashwin && display2.bat raj");

....within LaunchinIE and it works just fine. But the similar syntax
and a different pair of commands (below) do not work. I think it may
have something to do with escaping the parentheses, ampersands or some
other character(s). The exact same pair of commands executed in a DOS
window works just fine, but not when invoked from the LaunchinIE
component the exact same way.

Thanks for your response.

--Ashwin

"Michael Harris \(MVP\)" <mikhar at mvps dot org> wrote in message news:<eh******* *******@TK2MSFT NGP11.phx.gbl>. ..
... I use this great DLL called LaunchinIE
which works for the most part. But I am running into a hurdle in my
application, as described below...


In that you are callng a method of a 3rd party component, your best bet is
to contact the author (email address from the site:
rockin_AT_whirl ywiryweb.com).

Jul 23 '05 #3
forum7 wrote:
Mike,

I have done that too, and I think the author has been very forthcoming
in his support. Even then, this is an issue related to JavaScript,
because I can replace that long command string with something similar
like...

myObj.launchApp lication("mdisp lay1.bat ashwin && display2.bat raj");

The rules for command lines executed via the component's LaunchApplicati on
method are probably the same as those for WshShell.Run since it is likely
just a wrapper around ShellExecuteEx.

Since the && only has meaning to the command shell (e.g. cmd.exe), you have
to be explicit and include the command processor in your command line

"%comspec% /c ...all that other stuff..."

A command line like

c:\foo.bat && c:\foo.bat

works because the command shell instance is started implicitly via the BAT
file association.

A command line like

notepad.exe && notepad.exe

would fail at the && since the command shell is not launched implicitly.

A command line like

%comspec% /c notepad.exe && notepad.exe

would work because the command shell is launched explicitly...

...within LaunchinIE and it works just fine. But the similar syntax
and a different pair of commands (below) do not work. I think it may
have something to do with escaping the parentheses, ampersands or some
other character(s). The exact same pair of commands executed in a DOS
window works just fine, but not when invoked from the LaunchinIE
component the exact same way.

Thanks for your response.

--Ashwin

"Michael Harris \(MVP\)" <mikhar at mvps dot org> wrote in message
news:<eh******* *******@TK2MSFT NGP11.phx.gbl>. ..
... I use this great DLL called LaunchinIE
which works for the most part. But I am running into a hurdle in my
application, as described below...


In that you are callng a method of a 3rd party component, your best
bet is to contact the author (email address from the site:
rockin_AT_whirl ywiryweb.com).


--
Michael Harris
Microsoft.MVP.S cripting

Jul 23 '05 #4
Mike,

Your suggestion did help! Now, I am able to get the two commands to
get executed via the component's LaunchApplicati on method. The
problem, however, is that the command shell window (blank) is open for
the duration of execution of the two commands. I tried looking up the
argument list for cmd.exe to see if there was some way to suppress
this window or auto-close in a given amount of time. I could not find
anything. This is not a show-stopper, but there may be risks
associated with having that window open for a long time. Do you have
any suggestions?

You have been extremely helpful -- thank you so much!

--Ashwin

"Michael Harris \(MVP\)" <mi****@mvps.or g> wrote in message news:<ew******* *******@TK2MSFT NGP12.phx.gbl>. ..

The rules for command lines executed via the component's LaunchApplicati on
method are probably the same as those for WshShell.Run since it is likely
just a wrapper around ShellExecuteEx.

Since the && only has meaning to the command shell (e.g. cmd.exe), you have
to be explicit and include the command processor in your command line

"%comspec% /c ...all that other stuff..."

A command line like

c:\foo.bat && c:\foo.bat

works because the command shell instance is started implicitly via the BAT
file association.

A command line like

notepad.exe && notepad.exe

would fail at the && since the command shell is not launched implicitly.

A command line like

%comspec% /c notepad.exe && notepad.exe

would work because the command shell is launched explicitly...

Jul 23 '05 #5
> Your suggestion did help! Now, I am able to get the two commands to
get executed via the component's LaunchApplicati on method. The
problem, however, is that the command shell window (blank) is open for
the duration of execution of the two commands. I tried looking up the
argument list for cmd.exe to see if there was some way to suppress
this window or auto-close in a given amount of time. I could not find
anything. This is not a show-stopper, but there may be risks
associated with having that window open for a long time. Do you have
any suggestions?


Unless the author of the component included support in the LaunchApplicati on
method for a window style argument (such as WshShell.Run does) to run in a
hidden window, then I don't know of any way for cmd.exe to hide itself.

--
Michael Harris
Microsoft.MVP.S cripting
Sammamish WA US

Jul 23 '05 #6

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

Similar topics

26
15187
by: Don | last post by:
I'm writing an html page with some JavaScript that reads a web page into a client-side temp file, then reformats it, then submits that same file as a URL to the browser for display, via "locate.replace". I can do all this if the html page containing the script originates on the client machine, but don't know how to get access to a...
18
7317
by: William | last post by:
I have the following javascript function that updates a scroll_list and sends the updated entry (with its index) to a server script ( i.e. http://mkmxg00/cgi/confirmUpload.pl ) for further processing: function saveText( scroll_list, t_area, listToBeUpdated ) { scroll_list.options.text = t_area.text; scroll_list.options.value= t_area.value;...
6
3070
by: acord | last post by:
Hi, In a html page, I don't know how to load in a php page from javascript. I've already defined a <div id="treemenu"> in the html page. The executed content from the php script is supposed loaded into the treemenu div. What is the best way to achieve this? I got error where the treemenu didn't close/open on the treenode, as when I clicked...
10
4609
by: seanism | last post by:
Hello all I am new to javascript and I am attempting to write a site in JS / PHP to jump on the ajax band wagon. I am getting the following error and have not been able to locate a solution for it yet. From what I have read some people say it could have to do with xmlrequest being busy or something like that. Error: " nsresult:...
7
3201
by: julian.tklim | last post by:
Hi, I need to build an editable Datagrid with add & delete buttons on each row using javascript. DataGrid need not be pre-populated with values. To make the thing complicated, one of the column need to be a date picker field. I know things will be easier with ASPX datagrid.
90
11009
by: charlesmusco | last post by:
Hi all. I have the following problem. I have an xml file, while I will list below and I am trying to add nodes to the xml document based on user input to a form. The XML doc is ... <?xml version="1.0"?> <board> <message>
3
3451
by: SM | last post by:
Hello, Im trying to access elements in my XML file using the JavaScript DOM but i'm not sure how. I use AJAX to access the XML and then use the responseXML property to access the XML file data. I want to extract all the tracks from a specific CD. Right now, im using an array to stock all the data but its just a question of time before...
1
2716
by: critchey1 | last post by:
Hey everyone, i've been playing around with trying to get some scripts to work with detecting whether flash player is installed on your computer or not. I found a flash detection kit on the adobe site which had a client side detection method using javascript. Basically what im trying to get it to do is if flash player is installed, use the...
2
9018
by: joelkeepup | last post by:
Hi, I made a change this morning and now im getting an error that says either "a is undefined or null" or "e is undefined or null" the microsoft ajax line is below, I have no idea how to figure this problem out. Any suggestions? thanks Joel
0
7664
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
0
7583
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
0
8106
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
0
6250
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
1
5484
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 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 a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
5213
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
0
3642
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
0
3626
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
923
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

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.