internet explorer - Script only works on some computers - The object invoked has disconnected from its clients -
i have following, simple jscript
, checks time , whether or not current user in in specific skype response group.
if earlier 9:30
, want user added response group (this done checking checkbox). after 9:30
, don't want them in group anymore.
togglesupport(); function togglesupport() { var ie = wsh.createobject('internetexplorer.application'), url = "https://lyncserver/rgsclients/tab.aspx", id = 'ctl05_ctl00_ctl04_ctl00_ctl00_ctl01'; date = new date(), hours = date.gethours(), minutes = date.getminutes(), time = (hours * 60) + minutes, ninethirty = 569; // 9:29 - because task runs @ 9:30 ie.visible = false; ie.navigate(url); while (ie.readystate != 4) wsh.sleep(25); var element = ie.document.getelementbyid(id); var insupport = element.checked; if (time >= ninethirty) { if (insupport) { element.click(); var message = "removed support group (later thn 9:30)" } else {message = "out of support after 9:30 - nothing change"} } else if (time < ninethirty) { if (!insupport) { element.click(); var message = "added support group (earlier 9:30)" } else {message = "in support before 9:30 - nothing change"} } wscript.echo(message); wsh.sleep(1000); ie.quit(); }
this works on machine without issues whatsoever, when try executing on colleague's machine, error occurs:
line: 31
char: 2
error: object invoked has disconnected clients.
code: 80010108
source: (null)
i able narrow down location of error line:
while (ie.readystate != 4) wsh.sleep(25);
so tried running script on affected computer try/catch
in place:
try{ while (ie.readystate != 4) wsh.sleep(25); } catch (err){ wscript.echo("error when waiting page: " + err.name + " " + err.message); return; }
but see in wscript.echo
is:
error when waiting page: error
where error
returned err.name
. unhelpful , doesn't tell me issue @ all.
i checked answers here, none of them seemed @ all, , don't explain why getting error.
we both using internet expliorer 11.0.9600.18524
, , have same security settings.
is able shed light on why may happening?
Comments
Post a Comment