Jump to content

Sky Slate Blueberry Blackcurrant Watermelon Strawberry Orange Banana Apple Emerald Chocolate
Photo

How to close an invisible ie.application object?


  • Please log in to reply
10 replies to this topic
Newl
  • Members
  • 5 posts
  • Last active: Mar 23 2012 03:19 PM
  • Joined: 03 Mar 2012
Hi, I need some help...

I am using an IE object to automate tasks on a website. When I am done I'd like to close/quit it completely... but the process id still there running in the background and I have to use the Windows Task Manager to manually kill the process.
I am running IE in invisible mode so there is no window I could close with WinClose.

IE := ComObjCreate("InternetExplorer.Application")
IE.Visible := false

;~ here I am navigating to a website and finishing all the automated tasks

IE.quit

So as you see I am trying to quit the IE object but it is still there. What other methods should I call? Or what else to do?

Thanks for the help in advance!

CodeKiller
  • Members
  • 2067 posts
  • Last active: Feb 26 2016 09:30 AM
  • Joined: 10 Jul 2008
IE.Quit exits the application, what do you want more ? "cleaning" the variable IE ?
An extreme way could be :
Cap := VarSetCapacity(IE, "0")
IE := ""


Newl
  • Members
  • 5 posts
  • Last active: Mar 23 2012 03:19 PM
  • Joined: 03 Mar 2012

IE.Quit exits the application, what do you want more ? "cleaning" the variable IE ?
An extreme way could be :

Cap := VarSetCapacity(IE, "0")
IE := ""


All I want is quit... I mean a real quit.
I am not sure the quit method really exits it since it is still there when I check it with Windows Task Manager.
When I am doing this multiple times (creating an IE object, quitting it than creating a new one, quitting... etc.) I am having a lot of running IE processes in TM. After a while I am not even able to start a new one cuz I reached the maximum amount of allowed IE instances.

When I am doing the same with visible IE windows and using WinClose to quit them then I am not having the problem.

HotKeyIt
  • Moderators
  • 7439 posts
  • Last active: Jun 22 2016 09:14 PM
  • Joined: 18 Jun 2008
1. Close all iexplore instances in Task Manager
2. Launch above script
3. Check Task Manager, no iexplore exists

Works at least for me, so yours is an old one from a crashed script or similar :)

DataLife
  • Members
  • 1022 posts
  • Last active: Nov 27 2015 01:09 AM
  • Joined: 27 Apr 2008

Hi, I need some help...

I am using an IE object to automate tasks on a website. When I am done I'd like to close/quit it completely... but the process id still there running in the background and I have to use the Windows Task Manager to manually kill the process.
I am running IE in invisible mode so there is no window I could close with WinClose.

IE := ComObjCreate("InternetExplorer.Application")
IE.Visible := false

;~ here I am navigating to a website and finishing all the automated tasks

IE.quit

So as you see I am trying to quit the IE object but it is still there. What other methods should I call? Or what else to do?

Thanks for the help in advance!

From your example it looks like you are already quiting IE. But since this is only a sample part of your script you may not actually be quiting IE in your real script. Try putting IE.quit on an "OnExit" label.
Check out my scripts.  (MyIpChanger) (XPSnap) (SavePictureAs) All my scripts are tested on Windows 7, AutoHotkey 32 bit Ansi unless otherwise stated.

CodeKiller
  • Members
  • 2067 posts
  • Last active: Feb 26 2016 09:30 AM
  • Joined: 10 Jul 2008
OnExit CleanIE
; blah blah blah
CleanIE:
IfWinExist %TitleOrSomethingElse%
IE.Quit
ExitApp

Newl
  • Members
  • 5 posts
  • Last active: Mar 23 2012 03:19 PM
  • Joined: 03 Mar 2012
Ok, but I am not exiting the app. I just want to close that IE instance and coninue running my sript and open a new instance next time I need it. All these things must happen in the background in invisible mode. This app is a task scheduler - running for days or weeks long in the background. It is logging in to different accounts of a webgame in different times.

I am going to try CleanIE.

DataLife
  • Members
  • 1022 posts
  • Last active: Nov 27 2015 01:09 AM
  • Joined: 27 Apr 2008

Ok, but I am not exiting the app. I just want to close that IE instance and coninue running my sript and open a new instance next time I need it. All these things must happen in the background in invisible mode. This app is a task scheduler - running for days or weeks long in the background. It is logging in to different accounts of a webgame in different times.

I am going to try CleanIE.

Just use IE.Quit anytime you are done with the IE window and want it destroyed. Then create it again when you need to. If you are still having trouble and need help, you probably should post more/all of your code.
Check out my scripts.  (MyIpChanger) (XPSnap) (SavePictureAs) All my scripts are tested on Windows 7, AutoHotkey 32 bit Ansi unless otherwise stated.

Newl
  • Members
  • 5 posts
  • Last active: Mar 23 2012 03:19 PM
  • Joined: 03 Mar 2012
After a lot of debugging I found the problem and you were right it was somewhere else in the code.
I am using several functions to login, handle and logut the website. The logout function was responsible for quiting IE after it logged out from the website. And in this particular function I forgot to declare the IE object as global.
Now it works. Thanks for the help everyone!

razvan
  • Members
  • 1 posts
  • Last active: Jan 14 2015 10:53 PM
  • Joined: 14 Jan 2015

Hi,

 

Please tell me how you solved this issue.

I have the same thing.

 

Thanks.



DataLife
  • Members
  • 1022 posts
  • Last active: Nov 27 2015 01:09 AM
  • Joined: 27 Apr 2008

Post your code and maybe someone can help.


Check out my scripts.  (MyIpChanger) (XPSnap) (SavePictureAs) All my scripts are tested on Windows 7, AutoHotkey 32 bit Ansi unless otherwise stated.