Problems w/IE_Create

Technical support and scripting issues

Moderators: Dorian (MJT support), JRL

Post Reply
kh_kevin
Junior Coder
Posts: 34
Joined: Mon Nov 12, 2012 8:30 am

Problems w/IE_Create

Post by kh_kevin » Mon Dec 10, 2012 1:48 am

Hello,

I'm doing the following a few times in a loop:
IE_Create>0,%ie%
IE_Navigate>%ie%,%url%,ie_res
IE_WaitDocumentComplete>%ie%,ie_res

// Stuff here

IE_Quit>%ie%,ie_res
url provided is encased in {"..."}. Every so often IE_Create will fail with this following error message:
Error Calling DLL: Possible wrong number or type of parameters? Message: A system shutdown has already been scheduled, ProgID: "InternetExplorer.Application"
Is there any known reason for why this would keep happening? If I just run it again usually it will be fine the second time. Is it because I should reuse the same variable to hold the IE instance? Also wondering if IE_Quit isn't destroying the IE instance each time.

User avatar
CyberCitizen
Automation Wizard
Posts: 721
Joined: Sun Jun 20, 2004 7:06 am
Location: Adelaide, South Australia

Post by CyberCitizen » Mon Dec 10, 2012 3:36 am

Is the computer shutting down? If not I would suspect the IE instance is still shutting down. Maybe still a wait in there somewhere.
FIREFIGHTER

kh_kevin
Junior Coder
Posts: 34
Joined: Mon Nov 12, 2012 8:30 am

Post by kh_kevin » Mon Dec 10, 2012 3:46 am

Thanks for the reply -- nope the computer is not shutting down. All that happens is that an error is thrown and the script shuts down. It's been happening intermittently.

User avatar
Marcus Tettmar
Site Admin
Posts: 7395
Joined: Thu Sep 19, 2002 3:00 pm
Location: Dorset, UK
Contact:

Post by Marcus Tettmar » Mon Dec 10, 2012 7:33 am

This occurs because IE hasn't fully shut down and IEs COM object isn't yet ready for use again. I see this every now and then. After a short wait it is ready again.

Either use a delay, or ... do you really need to close and reopen IE? Why not just navigate the page again or refresh. i.e. loop to the navigate not the create. Why close IE if you are going to use it again?
Marcus Tettmar
http://mjtnet.com/blog/ | http://twitter.com/marcustettmar

Did you know we are now offering affordable monthly subscriptions for Macro Scheduler Standard?

kh_kevin
Junior Coder
Posts: 34
Joined: Mon Nov 12, 2012 8:30 am

Post by kh_kevin » Mon Dec 10, 2012 8:34 am

Thanks...I have the IE_Create code in a different function (new url each time) and my main loop calls that function. I will see if I can change it around so that it doesn't keep opening a new IE instance.

User avatar
Marcus Tettmar
Site Admin
Posts: 7395
Joined: Thu Sep 19, 2002 3:00 pm
Location: Dorset, UK
Contact:

Post by Marcus Tettmar » Mon Dec 10, 2012 9:28 am

Remove IE_Create from the function, call IE_Create once at the start, move IE_Quit to end of script, outside of the function. Done.
Marcus Tettmar
http://mjtnet.com/blog/ | http://twitter.com/marcustettmar

Did you know we are now offering affordable monthly subscriptions for Macro Scheduler Standard?

kh_kevin
Junior Coder
Posts: 34
Joined: Mon Nov 12, 2012 8:30 am

Post by kh_kevin » Tue Dec 11, 2012 1:19 am

Well...the problem is that I'm automating some print settings (different for each url), and I send my instructions on the assumption that the settings have returned to the default ones after each create/quit.

I was lazy and just put in a delay for now...I guess I will revisit if the error pops again!

Methuselah
Junior Coder
Posts: 49
Joined: Fri Oct 15, 2004 8:42 am
Location: Johannesburg, South Africa

How to respond/ prevent the message ?

Post by Methuselah » Tue Oct 08, 2013 12:18 pm

Sorry to reawaken this ancient post ...
Marcus Tettmar wrote:This occurs because IE hasn't fully shut down and IEs COM object isn't yet ready for use again. I see this every now and then. After a short wait it is ready again.

Either use a delay, or ... do you really need to close and reopen IE?
I have changed code logic and removed IE plugins (esp java) which helped to some degree, but .... every now and then it still happens.
It may depend on the vaguaries of tasks completing and then other tasks starting again - hard to prevent consistently.

I have failed miserably to auto-respond to this message.
( my window-event-open triggered macro does not fire when this message is being displayed) It appears that this message is of such a nature that the whole of MSched hangs until it is responded to.
In addition, even after responding, the script never completes.

This is somewhat of an epic fail for my automation so I welcome any and all clues or ideas ?

Methuselah
Junior Coder
Posts: 49
Joined: Fri Oct 15, 2004 8:42 am
Location: Johannesburg, South Africa

Re: How to respond/ prevent the message ?

Post by Methuselah » Wed Oct 23, 2013 10:30 am

BUMP

I really need to find a professional way to respond to this condition.

If you are unlucky enough to encounter this, you are stuffed.
There is no recovery procedure other than manually stopping the macro and then recovering from that mess.

May I please request an MSched enhancement to at least allow me to detect and recover from the condition and to do a retry or something.
The message indicates that you know there is a problem.
What is missing is the standard response to that condition.

MSched should not hang up, but should give me an error code I can interpret and react to.






Methuselah wrote:Sorry to reawaken this ancient post ...
Marcus Tettmar wrote:This occurs because IE hasn't fully shut down and IEs COM object isn't yet ready for use again. I see this every now and then. After a short wait it is ready again.

Either use a delay, or ... do you really need to close and reopen IE?
I have changed code logic and removed IE plugins (esp java) which helped to some degree, but .... every now and then it still happens.
It may depend on the vaguaries of tasks completing and then other tasks starting again - hard to prevent consistently.

I have failed miserably to auto-respond to this message.
( my window-event-open triggered macro does not fire when this message is being displayed) It appears that this message is of such a nature that the whole of MSched hangs until it is responded to.
In addition, even after responding, the script never completes.

This is somewhat of an epic fail for my automation so I welcome any and all clues or ideas ?

kh_kevin
Junior Coder
Posts: 34
Joined: Mon Nov 12, 2012 8:30 am

Post by kh_kevin » Wed Oct 23, 2013 10:41 am

well this doesn't fix the underlying problem, but have you tried putting in a delay like marcus suggested?

all i did was add a

Code: Select all

Wait>5
after IE_Quit, and before opening another instance of IE. what are you trying to do immediately after closing the browser instance? With the 5 second delay I haven't had it hang once since then due to this problem.

Methuselah
Junior Coder
Posts: 49
Joined: Fri Oct 15, 2004 8:42 am
Location: Johannesburg, South Africa

Post by Methuselah » Wed Oct 23, 2013 11:16 am

Hey Kev.

I have also WaitWindowClosed and other attempts at stuff before the first IECreate call.
I am now up to 35 seconds of waits currently :(
I have disabled IE addons, such as Java etc, etc.

When it does go, sometimes MSched gets into a terrible knot and I have to nuke it via task-manager as it thinks it is running macros still.

It is driving me nuts :))

Methuselah
Junior Coder
Posts: 49
Joined: Fri Oct 15, 2004 8:42 am
Location: Johannesburg, South Africa

Post by Methuselah » Wed Oct 23, 2013 11:19 am

I may have other issues as well.

Sometimes MessageModal doesn't stop for the response .... but the macro script keeps going without waiting as it always has.

Something really odd with the environment.

[UPDATE] I found out what this problem is: Multiple triggers.
I was triggering another macro from a primary polling macro.
The polling macro had a MDL in it for debugging when it completed, but it had already triggered a subsidiary macro via file-creation event ... so the subsidiary MDL windows were being ignored.

User avatar
Marcus Tettmar
Site Admin
Posts: 7395
Joined: Thu Sep 19, 2002 3:00 pm
Location: Dorset, UK
Contact:

Post by Marcus Tettmar » Wed Oct 23, 2013 1:27 pm

This thread appears somewhat meandering with seemingly unrelated issues.

However, to address the original error message: "A system shutdown has already been scheduled" ..

I've not seen that before but a Google search reveals these:

http://stackoverflow.com/questions/5542 ... ed-working

http://serverfault.com/questions/179156 ... r-800704a6

The accepted solutions are that something had been installed which required a reboot.
Marcus Tettmar
http://mjtnet.com/blog/ | http://twitter.com/marcustettmar

Did you know we are now offering affordable monthly subscriptions for Macro Scheduler Standard?

Post Reply
Sign up to our newsletter for free automation tips, tricks & discounts