How to reference the window opened by WScript.Shell?

D

DL

Hi,

In IE7, I use WScript.Shell to open up a Firefox window, here's how I
tried to use a var to reference this new window named windowB like

WSH = new ActiveXObject("WScript.Shell");
windowB = WSH.run(" {firefox executable here + an html file}");

Now, how could I execute a javascript function in windowB from the
opener? The windowB has opened up an html file, which has a
javascript called nameSelf, the content of which is alert("I'm window
B").

My attempt to call it from the opener like windowB.nameSelf() failed.
Err msg: object does not support this property or method. How to? (If
possible).

Thanks.
 
R

rf

DL said:
Hi,

In IE7, I use WScript.Shell to open up a Firefox window,

Why?

Oh I see. In your prior thread on the subject you complain that IE does not
support the canvas element.

Have a look at excanvas (ExplorerCanvas). Allows IE to seamlessly run stuff
designed for the canvas element. IMHO you would have far better luck with
this than trying to get IE and Firefox talking to each other.
 
D

DL

Why?

Oh I see. In your prior thread on the subject you complain that IE does not
support the canvas element.

Have a look at excanvas (ExplorerCanvas). Allows IE to seamlessly run stuff
designed for the canvas element. IMHO you would have far better luck with
this than trying to get IE and Firefox talking to each other.

Yes, if ExplorerCanvas is reliable I would have chosen that option a
while ago. I tried it again to no avail. SourceForge's discussion
board (which I assume the premier resource for it) has exceedingly few
QAs about this method. Or it's not such a resource?
http://sourceforge.net/forum/forum.php?forum_id=554201

The problem I encountered with it is, err msg: "line 120...
document.getElementById('...') is null or not an object..."

[Source code]
Javascript:
....
document.getElementById("doSave").onclick = function() {
saveTheCanvas(...);
}
....

HTML interface:
....
<input type="button" id="doSave" value="Save"> // line 120
....

FYI, browser in question is IE7.
 
T

Thomas 'PointedEars' Lahn

DL said:
[...]
Yes, if ExplorerCanvas is reliable I would have chosen that option a
while ago. I tried it again to no avail. SourceForge's discussion
board (which I assume the premier resource for it) has exceedingly few
QAs about this method. Or it's not such a resource?
http://sourceforge.net/forum/forum.php?forum_id=554201

First blaming others for your problems makes you look like a luser.
Don't do that.

The problem I encountered with it is, err msg: "line 120...
document.getElementById('...') is null or not an object..."

[Source code]
Javascript:
....
document.getElementById("doSave").onclick = function() {
saveTheCanvas(...);
}
....

HTML interface:
....
<input type="button" id="doSave" value="Save"> // line 120
....

Chances are that the problem you encountered has nothing to do with
ExplorerCanvas. For the error message indicates that it occurs *before* the
saveTheCanvas(...) call is executed (that supposedly accesses the canvas
object). Something goes wrong with retrieving the reference for the `input'
element object with ID "doSave" instead. Maybe your markup is *otherwise*
not Valid (the `canvas' is not specified in HTML 4.01), or you might be
trying to access the element object before the corresponding element was parsed.


PointedEars
 
R

rf

DL said:
Yes, if ExplorerCanvas is reliable I would have chosen that option a
while ago. I tried it again to no avail.

The tutorial that is mentioned on the excanvas page has examples that seem
to be reliable enough.

SourceForge's discussion
board (which I assume the premier resource for it) has exceedingly few
QAs about this method. Or it's not such a resource?
http://sourceforge.net/forum/forum.php?forum_id=554201

The problem I encountered with it is, err msg: "line 120...
document.getElementById('...') is null or not an object..."

So fix your error.
[Source code]
Javascript:
...
document.getElementById("doSave").onclick = function() {
saveTheCanvas(...);
}

I just looked at the tutorial examples mentioned above. Nowhere do I find
the string "doSave", nor "saveTheCanvas".
HTML interface:
...
<input type="button" id="doSave" value="Save"> // line 120

The line number mentioned in IE error messages is usually the line number
*in a .js file*, not the line number in some .html file.
FYI, browser in question is IE7.

ISTM that you would have a far better of fixing whatever errors you have
introduced into whatever you did with excanvas than to get some totally
frail connection between IE and FF working.

But then, the choice of IE as "the web browser for a piece of software" is
totally bizarre. What is this "market share" thing? Do you mean your
software will only work on computers with IE installed?
 
R

rf

[alternate reply]

So, if you insist on using IE in some application why also insist on using
an element (canvas) that IE simply does not support?

Why not use the technology the IE *does* support, VML? This,. after all, is
what excanvas uses. It "translates" canvas into VML.
 
D

DL

[alternate reply]

So, if you insist on using IE in some application why also insist on using
an element (canvas) that IE simply does not support?

Why not use the technology the IE *does* support, VML? This,. after all, is
what excanvas uses. It "translates" canvas into VML.

Thank you all. All points see valid. I attempted to use
ExplorerCanvas again. Here's a simple test file, the same directory
has both excanvas.js and excanvas-compressed.js with both dated
05/04/2007. Now, zero error, however, one can't draw anything on the
canvas. What could be wrong?

<html>
<head>
<title>Canvas tutorial</title>
<!--[if IE]><script type="text/javascript" src="excanvas.js"></
script><![endif]-->
<script type="text/javascript">
function draw(){
var canvas = document.getElementById('tutorial');
if (canvas.getContext){
var ctx = canvas.getContext('2d');
}
}
</script>
<style type="text/css">
canvas { border: 1px solid black; }
</style>
</head>
<body onload="draw();">
<canvas id="tutorial" width="150" height="150"></canvas>
</body>
</html>


Also. With a canvas related file (with both html and js) and running
fine with Firefox, it calls two properties or methods, namely clientX
and clientY for the two coordinates, ExplorerCanvas seems unable to
recognize them, how to circumvent them? Or ?
 
R

rf

DL said:
DL said:
DL wrote:
Hi,
In IE7, I use WScript.Shell to open up a Firefox window,

Oh I see. In your prior thread on the subject you complain that IE
does not support the canvas element.

[alternate reply]

So, if you insist on using IE in some application why also insist on
using an element (canvas) that IE simply does not support?

Why not use the technology the IE *does* support, VML? This,. after
all, is what excanvas uses. It "translates" canvas into VML.

Thank you all. All points see valid. I attempted to use
ExplorerCanvas again.

Did you explore VML?
Here's a simple test file, the same directory
has both excanvas.js and excanvas-compressed.js with both dated
05/04/2007. Now, zero error, however, one can't draw anything on the
canvas. What could be wrong?

Why is it that you can take something so simple and make it not work. And
after doing so wonder why and decide that the entire technology is not
suitable?

This:
https://developer.mozilla.org/En/A_Basic_RayCaster
works.

Download the stuff from here:
http://sourceforge.net/project/showfiles.php?group_id=163391
Try the examples in the examples folder. They work. All four of them. In FF
and IE.

Fiddle with them. Change stuff. They still work.

<html>
<head>
<title>Canvas tutorial</title>
<!--[if IE]><script type="text/javascript" src="excanvas.js"></
script><![endif]-->
<script type="text/javascript">
function draw(){
var canvas = document.getElementById('tutorial');
if (canvas.getContext){
var ctx = canvas.getContext('2d');
}
}
</script>
<style type="text/css">
canvas { border: 1px solid black; }
</style>
</head>
<body onload="draw();">
<canvas id="tutorial" width="150" height="150"></canvas>
</body>
</html>

I see nowhere in the above where you actually draw something.
Also. With a canvas related file (with both html and js) and running
fine with Firefox, it calls two properties or methods, namely clientX
and clientY for the two coordinates, ExplorerCanvas seems unable to
recognize them, how to circumvent them? Or ?

Oh My &deity. Debugging 101.

Why does your stuff not work?

Why do the examples mentioned above work?

What is the difference?



I also repeat my prior question: If you are restricting your "application"
to IE then why are you not using VML? It *does* work. I have not looked but
I suspect that microsofts web site has many examples you could use as
starting points.


I have provided you with pointers to enough web sites where what you want to
do *is* done. I have no further interest in answering your questions as to
why *you* can not do it.

Good luck with your "application" ;-)
 
R

rf

rf said:
I have provided you with pointers to enough web sites where what you
want to do *is* done. I have no further interest in answering your
questions as to why *you* can not do it.

Belay that last bit. I probably *do* have a further interest, if only out of
curiosity.

But you should at least make an effort to provide a URL to something you
have actually tried.

Take one of the examples and bend it to what you want to do.

More to the point tell us what you are trying to do.
 
D

DL

This:https://developer.mozilla.org/En/A_Basic_RayCaster
works.

Download the stuff from here:http://sourceforge.net/project/showfiles.php?group_id=163391
Try the examples in the examples folder. They work. All four of them. In FF
and IE.

Fiddle with them. Change stuff. They still work.

To me, the key about canvas (physical or digital) is to provide a
platform for one to draw something on it, hence, when I draw the
example, I simply copied it and tried it (admittedly without thinking,
fault on my part). Now, let's move on.
adding the "content" or "context" for a canvas like the following
begins to add some meaning to it:

var canvas = document.getElementById("canvas");
var ctx = canvas.getContext("2d");
...

ctx.fillStyle = "rgb(200,0,0)";
ctx.fillRect (10, 10, 55, 50);

However, that's far from being good enough. As stated, I need to be
able to use a canvas a platform for drawing. So, now two obstacles
remain.
a) the X and Y coordinates

var bMouseIsDown = false;
canvas.onmousedown = function(e) {
bMouseIsDown = true;
LastX = e.clientX - canvas.offsetLeft + document.body.scrollLeft;
LastY = e.clientY - canvas.offsetTop + document.body.scrollTop;
}
clientX seems browser specific, that is, Firefox and possibley Opera
supports it while IE6/7 won't because same code runs fine with Firefox
3.3. Am I wrong?

b) save whatever that has been drawn on the canvas (later)

Thanks.
<html>
  <head>
    <title>Canvas tutorial</title>
   <!--[if IE]><script type="text/javascript" src="excanvas.js"></
script><![endif]-->
    <script type="text/javascript">
      function draw(){
        var canvas = document.getElementById('tutorial');
        if (canvas.getContext){
          var ctx = canvas.getContext('2d');
        }
      }
    </script>
    <style type="text/css">
      canvas { border: 1px solid black; }
    </style>
  </head>
  <body onload="draw();">
    <canvas id="tutorial" width="150" height="150"></canvas>
  </body>
</html>

I see nowhere in the above where you actually draw something.
 
R

rf

DL said:
To me, the key about canvas (physical or digital) is to provide a
platform for one to draw something on it, hence, when I draw the
example, I simply copied it and tried it (admittedly without thinking,
fault on my part). Now, let's move on.
adding the "content" or "context" for a canvas like the following
begins to add some meaning to it:

Hang on. We have degenerated into a discussion on how to use the canvas
element.

Don't you think you should *know* how to use the canvas element before you
cause IE to spawn an instance of FF to display that element, or to use
excanvas to allow IE to emulate that element?
 
D

DL

Hang on. We have degenerated into a discussion on how to use the canvas
element.

I would respectfully disagree on the word of "degenerated" used here.
But rather one may described it as "deviated" from pure language point
of view. However, the subject matter is, an ability to draw and save
its output.
Don't you think you should *know* how to use the canvas element before you
cause IE to spawn an instance of FF to display that element, or to use
excanvas to allow IE to emulate that element?- Hide quoted text -

Fair enough. I'll chew on the opportunity cost etc ...
 

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,770
Messages
2,569,584
Members
45,075
Latest member
MakersCBDBloodSupport

Latest Threads

Top