Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.javascript > #17377 > unrolled thread
| Started by | Cezary Tomczyk <cezary.tomczyk@gmail.com> |
|---|---|
| First post | 2012-11-29 14:58 +0100 |
| Last post | 2012-12-01 17:12 +0100 |
| Articles | 10 — 3 participants |
Back to article view | Back to comp.lang.javascript
Refreshing ActiveX controls Cezary Tomczyk <cezary.tomczyk@gmail.com> - 2012-11-29 14:58 +0100
Re: Refreshing ActiveX controls Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2012-11-29 17:42 +0100
Re: Refreshing ActiveX controls Cezary Tomczyk <cezary.tomczyk@gmail.com> - 2012-11-29 21:36 +0100
Re: Refreshing ActiveX controls Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2012-11-29 23:20 +0100
Re: Refreshing ActiveX controls Cezary Tomczyk <cezary.tomczyk@gmail.com> - 2012-11-30 00:27 +0100
Re: Refreshing ActiveX controls Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2012-12-01 16:42 +0100
Re: Refreshing ActiveX controls JJ <jaejunks@glegooilma-swapit.com> - 2012-11-29 23:37 +0000
Re: Refreshing ActiveX controls Cezary Tomczyk <cezary.tomczyk@gmail.com> - 2012-11-30 00:53 +0100
Re: Refreshing ActiveX controls JJ <jaejunks@glegooilma-swapit.com> - 2012-12-01 06:36 +0000
Re: Refreshing ActiveX controls Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2012-12-01 17:12 +0100
| From | Cezary Tomczyk <cezary.tomczyk@gmail.com> |
|---|---|
| Date | 2012-11-29 14:58 +0100 |
| Subject | Refreshing ActiveX controls |
| Message-ID | <k97pll$gnv$1@speranza.aioe.org> |
Any idea how to refresh ActiveX controls without restarting IE? (or probably any browser that support ActiveX). I was thinking about something similar to refresh method (https://developer.mozilla.org/en-US/docs/DOM/PluginArray), but for ActiveX. -- Cezary Tomczyk http://www.ctomczyk.pl/
[toc] | [next] | [standalone]
| From | Thomas 'PointedEars' Lahn <PointedEars@web.de> |
|---|---|
| Date | 2012-11-29 17:42 +0100 |
| Message-ID | <1463591.kyDlKFe50m@PointedEars.de> |
| In reply to | #17377 |
Cezary Tomczyk wrote:
> Any idea how to refresh ActiveX controls without restarting IE? (or
> probably any browser that support ActiveX).
Several. Depends on what *exactly* you are looking for.
--
var bugRiddenCrashPronePieceOfJunk = (
navigator.userAgent.indexOf('MSIE 5') != -1
&& navigator.userAgent.indexOf('Mac') != -1
) // Plone, register_function.js:16
[toc] | [prev] | [next] | [standalone]
| From | Cezary Tomczyk <cezary.tomczyk@gmail.com> |
|---|---|
| Date | 2012-11-29 21:36 +0100 |
| Message-ID | <k98h0r$g5b$1@speranza.aioe.org> |
| In reply to | #17378 |
W dniu 2012-11-29 17:42, Thomas 'PointedEars' Lahn pisze:
> Cezary Tomczyk wrote:
>
>> Any idea how to refresh ActiveX controls without restarting IE? (or
>> probably any browser that support ActiveX).
>
> Several. Depends on what *exactly* you are looking for.
I'll try do describe it how it works in steps:
1. The user goes to the requested page. Let's say http://www.test.com/
2. I check if user has already installed required external software.
This software has a specified "ProgID" and ActiveX Class ID.
Short code:
var found, obj;
if (typeof window.ActiveXObject !== 'undefined') {
try {
obj = new window.ActiveXObject('here is full ProgID');
found = typeof obj !== 'undefined';
} catch (e) {
}
}
3. If "found" is true then this means that required external software is
installed and user will be moved to the next step. If not then I
triggering download process and must wait for end of installation.
External software will do all necessary changes inside ActiveX after
installation is complete.
Now, I check every n seconds (using setTimeout instead of setInterval)
if required software is already installed. I can not check required
"ProgID" until I restart manually Internet Explorer. That's the problem.
All I want is to refresh ActiveX list of all Controls and read required
data from ActiveX (check if required "control" is already installed)
without restart Internet Explorer.
--
Cezary Tomczyk
http://www.ctomczyk.pl/
[toc] | [prev] | [next] | [standalone]
| From | Thomas 'PointedEars' Lahn <PointedEars@web.de> |
|---|---|
| Date | 2012-11-29 23:20 +0100 |
| Message-ID | <34728788.KEVs06lIuy@PointedEars.de> |
| In reply to | #17379 |
Cezary Tomczyk wrote:
> Thomas 'PointedEars' Lahn pisze:
>> Cezary Tomczyk wrote:
>>> Any idea how to refresh ActiveX controls without restarting IE? (or
>>> probably any browser that support ActiveX).
>> Several. Depends on what *exactly* you are looking for.
>
> I'll try do describe it how it works in steps:
>
> 1. The user goes to the requested page. Let's say http://www.test.com/
There is a real test.com. For examples, please use the .example TLD or the
example.com SLD:
<http://tools.ietf.org/html/rfc2606>
If you have a problem with a Web site, however, it is of course best to post
the real URI.
> 2. I check if user has already installed required external software.
> This software has a specified "ProgID" and ActiveX Class ID.
>
> Short code:
>
> var found, obj;
>
> if (typeof window.ActiveXObject !== 'undefined') {
> try {
> obj = new window.ActiveXObject('here is full ProgID');
> found = typeof obj !== 'undefined';
I do not think `obj' is ever going to be `undefined' at this line. You can
just as well assign `true', or skip `found' and only work with `obj' (which
you might want to initialize with `null').
See also jsx.net.http.Request.prototype._getXHR() in
<http://pointedears.de/websvn/filedetails.php?repname=JSX&path=%2Ftrunk%2Fhttp.js>
(a bit slow currently).
> } catch (e) {
> }
> }
>
> 3. If "found" is true then this means that required external software is
> installed and user will be moved to the next step. If not then I
> triggering download process and must wait for end of installation.
> External software will do all necessary changes inside ActiveX after
> installation is complete.
>
> Now, I check every n seconds (using setTimeout instead of setInterval)
> if required software is already installed. I can not check required
> "ProgID" until I restart manually Internet Explorer. That's the problem.
>
> All I want is to refresh ActiveX list of all Controls and read required
> data from ActiveX (check if required "control" is already installed)
> without restart Internet Explorer.
You should reconsider that approach. There should be an event for the
successfully loaded ActiveX control which you can add an event listener for,
or the control can execute code itself.
PointedEars
--
Use any version of Microsoft Frontpage to create your site.
(This won't prevent people from viewing your source, but no one
will want to steal it.)
-- from <http://www.vortex-webdesign.com/help/hidesource.htm> (404-comp.)
[toc] | [prev] | [next] | [standalone]
| From | Cezary Tomczyk <cezary.tomczyk@gmail.com> |
|---|---|
| Date | 2012-11-30 00:27 +0100 |
| Message-ID | <k98r15$bfb$1@speranza.aioe.org> |
| In reply to | #17380 |
W dniu 2012-11-29 23:20, Thomas 'PointedEars' Lahn pisze:
> Cezary Tomczyk wrote:
>
>> Thomas 'PointedEars' Lahn pisze:
>>> Cezary Tomczyk wrote:
>>>> Any idea how to refresh ActiveX controls without restarting IE? (or
>>>> probably any browser that support ActiveX).
>>> Several. Depends on what *exactly* you are looking for.
>>
>> I'll try do describe it how it works in steps:
>>
>> 1. The user goes to the requested page. Let's say http://www.test.com/
>
> There is a real test.com. For examples, please use the .example TLD or the
> example.com SLD:
>
> <http://tools.ietf.org/html/rfc2606>
Or even example.net and example.org. Will use those names next time.
> If you have a problem with a Web site, however, it is of course best to post
> the real URI.
Actually I can not post a real URL, but I am not sure if this could help
anything. The main point of the problem is elsewhere.
>> 2. I check if user has already installed required external software.
>> This software has a specified "ProgID" and ActiveX Class ID.
>>
>> Short code:
>>
>> var found, obj;
>>
>> if (typeof window.ActiveXObject !== 'undefined') {
>> try {
>> obj = new window.ActiveXObject('here is full ProgID');
>> found = typeof obj !== 'undefined';
>
> I do not think `obj' is ever going to be `undefined' at this line. You can
> just as well assign `true', or skip `found' and only work with `obj' (which
> you might want to initialize with `null').
Not really. I tested in IE9:
var obj = new window.ActiveXObject('NonExistsProgID');
window.console.log(typeof obj);
The result is: undefined.
> See also jsx.net.http.Request.prototype._getXHR() in
> <http://pointedears.de/websvn/filedetails.php?repname=JSX&path=%2Ftrunk%2Fhttp.js>
> (a bit slow currently).
I know that file and I even studied more closely not so long time ago :-)
I see your part of initializing XHR object, but there is also some weird
parts for me. You define:
x = null;
and later in part between /*@if (@_jscript_version >= 5) and @end @*/ in
catch(e){} you sets x = null, which I do not know why. It is defined x =
null at the beginning.
Not sure if part for /* IceBrowser */ is still necessary.
However, generally speaking code could inspire many coders.
>> } catch (e) {
>> }
>> }
>>
>> 3. If "found" is true then this means that required external software is
>> installed and user will be moved to the next step. If not then I
>> triggering download process and must wait for end of installation.
>> External software will do all necessary changes inside ActiveX after
>> installation is complete.
>>
>> Now, I check every n seconds (using setTimeout instead of setInterval)
>> if required software is already installed. I can not check required
>> "ProgID" until I restart manually Internet Explorer. That's the problem.
>>
>> All I want is to refresh ActiveX list of all Controls and read required
>> data from ActiveX (check if required "control" is already installed)
>> without restart Internet Explorer.
>
> You should reconsider that approach. There should be an event for the
> successfully loaded ActiveX control which you can add an event listener for,
> or the control can execute code itself.
Hm, interesting. If you have any links that can explain more about that
then I would be glad to get them. In the meantime I will check what
Google returns about that.
--
Cezary Tomczyk
http://www.ctomczyk.pl/
[toc] | [prev] | [next] | [standalone]
| From | Thomas 'PointedEars' Lahn <PointedEars@web.de> |
|---|---|
| Date | 2012-12-01 16:42 +0100 |
| Message-ID | <1563677.z3s4TtHaWU@PointedEars.de> |
| In reply to | #17381 |
Cezary Tomczyk wrote:
> W dniu 2012-11-29 23:20, Thomas 'PointedEars' Lahn pisze:
>> Cezary Tomczyk wrote:
>>> Thomas 'PointedEars' Lahn pisze:
>>>> Cezary Tomczyk wrote:
>>>>> Any idea how to refresh ActiveX controls without restarting IE? (or
>>>>> probably any browser that support ActiveX).
>>>> Several. Depends on what *exactly* you are looking for.
>>> I'll try do describe it how it works in steps:
>>>
>>> 1. The user goes to the requested page. Let's say http://www.test.com/
>> There is a real test.com. For examples, please use the .example TLD […]
>> If you have a problem with a Web site, however, it is of course best to
>> post the real URI.
>
> Actually I can not post a real URL, but I am not sure if this could help
> anything. The main point of the problem is elsewhere.
It would help as you do not say which ActiveX control you are trying to
load/install, and one would have a test case this way.
>>> 2. I check if user has already installed required external software.
>>> This software has a specified "ProgID" and ActiveX Class ID.
>>>
>>> Short code:
>>>
>>> var found, obj;
>>>
>>> if (typeof window.ActiveXObject !== 'undefined') {
>>> try {
>>> obj = new window.ActiveXObject('here is full ProgID');
>>> found = typeof obj !== 'undefined';
>>
>> I do not think `obj' is ever going to be `undefined' at this line. You
>> can just as well assign `true', or skip `found' and only work with `obj'
>> (which you might want to initialize with `null').
>
> Not really. I tested in IE9:
>
> var obj = new window.ActiveXObject('NonExistsProgID');
> window.console.log(typeof obj);
>
> The result is: undefined.
I cannot reproduce that:
,----
| >> var x = 42; x = new ActiveXObject("foo"); console.log(x)
| "Automatisierungsserver kann Objekt nicht erstellen."
(That is German for "Automation server can't create object.")
| >> navigator.userAgent
| "Mozilla/5.0 (compatible; MSIE 9.0; Windows NT 6.0; Trident/5.0; SLCC1;
| .NET CLR 2.0.50727; eSobiSubscriber 2.0.4.16; .NET CLR 3.5.30729; .NET
| CLR 3.0.30729; .NET4.0C; .NET4.0E)"
`----
That is Internet Explorer 9.0.8112.16421 on Windows Vista Business 32 bit
Service Pack 2.
I think you are mistaken here:
,----
| >> var y = new ActiveXObject("foo");
| "Automatisierungsserver kann Objekt nicht erstellen."
| >> console.log(y)
| PROTOKOLL: undefined
| >> try { var z = new ActiveXObject("foo"); console.log(z); } catch (e) {
| >> console.log(42); }
| PROTOKOLL: 42
`----
(`console' is not supposed to be a property of the object referred to by
`window'.)
If you enter those two lines separately into the script console, each will
be executed in different /Program/s sharing the same lexical environment
(like eval code in non-strict mode).
The first line contains a /VariableStatement/ with an /Initialiser/. If the
automation object cannot be created by `ActiveXObject', it will throw an
exception (whose `message' property value you can see displayed). So the
variable is declared, but it is not initialized later. As a result, it
keeps its original value, in this case the implicit `undefined', whose
string representation is displayed.
But as you can see in the final try-catch statement, if `ActiveXObject'
throws an exception, execution never reaches the following `console.log(z);'
statement in the *same* /Program/, and continues at the `console.log(42);'
statement if the exception is handled (as it is here). This is consistent
with ECMAScript Ed. 5.1, section "12.14 The `try' Statement", and
corresponding sections back to Ed. 3 when exceptions were introduced.
>> See also jsx.net.http.Request.prototype._getXHR() in
>>
<http://pointedears.de/websvn/filedetails.php?repname=JSX&path=%2Ftrunk%2Fhttp.js>
>> (a bit slow currently).
>
> I know that file and I even studied more closely not so long time ago :-)
>
> I see your part of initializing XHR object, but there is also some weird
> parts for me. You define:
>
> x = null;
>
> and later in part between /*@if (@_jscript_version >= 5) and @end @*/ in
> catch(e){} you sets x = null, which I do not know why. It is defined x =
> null at the beginning.
`x = null' in the `catch' branch is probably not necessary now, but maybe
later. I would rather be explicit there.
> Not sure if part for /* IceBrowser */ is still necessary.
I am not sure either. But it is only a small piece of compatibility code
with no noticeable performance impact in case it is not needed, so it is
going to stay there for the time being.
> However, generally speaking code could inspire many coders.
Thank you. As you can read there, it is based on an XHR tutorial by
Jim Ley.
>>> } catch (e) {
>>> }
>>> }
>>>
>>> 3. If "found" is true then this means that required external software is
>>> installed and user will be moved to the next step. If not then I
>>> triggering download process and must wait for end of installation.
>>> External software will do all necessary changes inside ActiveX after
>>> installation is complete.
>>>
>>> Now, I check every n seconds (using setTimeout instead of setInterval)
>>> if required software is already installed. I can not check required
>>> "ProgID" until I restart manually Internet Explorer. That's the problem.
>>>
>>> All I want is to refresh ActiveX list of all Controls and read required
>>> data from ActiveX (check if required "control" is already installed)
>>> without restart Internet Explorer.
>>
>> You should reconsider that approach. There should be an event for the
>> successfully loaded ActiveX control which you can add an event listener
>> for, or the control can execute code itself.
>
> Hm, interesting. If you have any links that can explain more about that
> then I would be glad to get them. In the meantime I will check what
> Google returns about that.
I have not tried, but
<http://msdn.microsoft.com/en-us/library/ms535859(VS.85).aspx#events>
looks promising with regard to the former approach [apparently, `object'
elements do support the `(on)load' event].
As for the latter, it depends on the control. For example, I know that
Flash movies can cause HTML navigation.
PointedEars
--
Sometimes, what you learn is wrong. If those wrong ideas are close to the
root of the knowledge tree you build on a particular subject, pruning the
bad branches can sometimes cause the whole tree to collapse.
-- Mike Duffy in cljs, <news:Xns9FB6521286DB8invalidcom@94.75.214.39>
[toc] | [prev] | [next] | [standalone]
| From | JJ <jaejunks@glegooilma-swapit.com> |
|---|---|
| Date | 2012-11-29 23:37 +0000 |
| Message-ID | <XnsA11B44125E04jaejunksglegooilma@0.0.0.23> |
| In reply to | #17377 |
Cezary Tomczyk <cezary.tomczyk@gmail.com> wrote: > Any idea how to refresh ActiveX controls without restarting IE? (or > probably any browser that support ActiveX). > > I was thinking about something similar to refresh method > (https://developer.mozilla.org/en-US/docs/DOM/PluginArray), but for > ActiveX. I assume you want to refresh the ActiveX installation? If so, then the answer is no. Simply because no client side scripts are able to uninstall any ActiveX, so it's impossible to reinstall it. While ActiveX installation can be done automatically via script, the uninstallation process must be done manually by the user. Same goes for Netscape-based plugins.
[toc] | [prev] | [next] | [standalone]
| From | Cezary Tomczyk <cezary.tomczyk@gmail.com> |
|---|---|
| Date | 2012-11-30 00:53 +0100 |
| Message-ID | <k98shh$ejs$1@speranza.aioe.org> |
| In reply to | #17382 |
W dniu 2012-11-30 00:37, JJ pisze: > Cezary Tomczyk <cezary.tomczyk@gmail.com> wrote: >> Any idea how to refresh ActiveX controls without restarting IE? (or >> probably any browser that support ActiveX). >> >> I was thinking about something similar to refresh method >> (https://developer.mozilla.org/en-US/docs/DOM/PluginArray), but for >> ActiveX. > > I assume you want to refresh the ActiveX installation? If so, then the [...] Not exactly refreshing the ActiveX installation. Just want to know when ActiveX installation is complete. -- Cezary Tomczyk http://www.ctomczyk.pl/
[toc] | [prev] | [next] | [standalone]
| From | JJ <jaejunks@glegooilma-swapit.com> |
|---|---|
| Date | 2012-12-01 06:36 +0000 |
| Message-ID | <XnsA11C8B1866584jaejunksglegooilma@0.0.0.23> |
| In reply to | #17383 |
Cezary Tomczyk <cezary.tomczyk@gmail.com> wrote:
> Not exactly refreshing the ActiveX installation. Just want to know when
> ActiveX installation is complete.
That's same as checking whether the ActiveX control is fully loaded,
running, and ready.
Since OBJECT tag doesn't support ONLOAD attribute, you'll have to poll
one of the control's property. For example, periodically check the
"color" property until it's in the form of a string. With error handlings
of course, in case that property doesn't exist yet. Meaning that the
control isn't running yet.
//setup the monitor
var monitor = setInterval(
function() {
var err, ele = document.getElementById('TheActiveX');
if (ele) {
if (typeof ele.color === 'string') {
try {
//check property value
if (ele.color !== '') {
//stop monitoring
clearInterval(monitor);
monitor = 0;
}
} catch(err) {
}
}
}
}
,500); //check every 500ms
//optionally, add a timeout while waiting for it to load
var waiter = setTimeout(
function() {
if (monitor>0) {
//stop the monitor
clearInterval(monitor);
alert('Timeout while waiting for ActiveX control.');
}
}
,60*1000); //60*1000ms = 60secs
[toc] | [prev] | [next] | [standalone]
| From | Thomas 'PointedEars' Lahn <PointedEars@web.de> |
|---|---|
| Date | 2012-12-01 17:12 +0100 |
| Message-ID | <3672281.3Po27QccK0@PointedEars.de> |
| In reply to | #17390 |
JJ wrote:
^^
Who?
> Cezary Tomczyk <cezary.tomczyk@gmail.com> wrote:
>> Not exactly refreshing the ActiveX installation. Just want to know when
>> ActiveX installation is complete.
>
> That's same as checking whether the ActiveX control is fully loaded,
> running, and ready.
>
> Since OBJECT tag doesn't support ONLOAD attribute,
s/tag/element type/. It may not support the `onload' *attribute* (HTML5 WD
and ED beg to differ [1, 2], and so do even non-HTML5 browsers even though
it would be invalid markup then), but the element objects have supported the
`onload' *property* for a long time (even before the W3C DOM [3]), and as a
result the `load' event applies to it [4].
[1] <http://www.w3.org/TR/2012/WD-html5-20121025/
the-object-element.html#the-object-element>
[2] <http://dev.w3.org/html5/spec/single-page.html#the-object-element>
[3] <http://docs.oracle.com/cd/E19957-01/816-6408-10/handlers.htm#1120545>
[4] <http://www.w3.org/TR/2000/REC-DOM-Level-2-Events-20001113/events.html
#Events-eventgroupings-htmlevents>
> you'll have to poll one of the control's property.
If possible, don't.
> For example, periodically check the "color" property until it's in the
> form of a string. With error handlings of course, in case that property
> doesn't exist yet. Meaning that the control isn't running yet.
The API of plugins triggered by ActiveX controls/COM objects usually is
encapsulated in another object accessible through a single property of the
element object, so what you suggest is not likely. It might be possible to
feature-test deep property access, but it is certainly better to let the
control tell the embedding context when it is ready.
PointedEars
--
Prototype.js was written by people who don't know javascript for people
who don't know javascript. People who don't know javascript are not
the best source of advice on designing systems that use javascript.
-- Richard Cornford, cljs, <f806at$ail$1$8300dec7@news.demon.co.uk>
[toc] | [prev] | [standalone]
Back to top | Article view | comp.lang.javascript
csiph-web