How do I detect if user closed the browser?

Discussions and Tech Support related to automating the iMacros Browser or Internet Explorer from any scripting and programming language, such as VBS (WSH), VBA, VB, Perl, Delphi, C# or C++.

Moderators: Marcia, iOpus, Hannes, iOpus, Tech Support, Tom, iOpus

How do I detect if user closed the browser?

Postby MAtkins on Wed Jul 28, 2010 4:48 am

I'm testing for -102 but it doesn't seem to be triggering if the user clicks the little x in the upper right corner of the browser to close it.

The code I'm using is below. If _bStop is true then the proc stops. It's not stopping.
Does the code below look like it should accurately return the -102 if the user closed the browser?
It does return the STOP code -101 with no problem.

Code: Select all
if(!handleRtnCode(oIMacros, oIMacros.iimPlay(sCode, iWBTimeout))) return false;

public bool handleRtnCode(iMacros.App oIMacros, iMacros.Status stRtn)
      {         
         string sErr = "";
         int nRtn = (int) stRtn;
         if(nRtn != 1)
         {
            sErr =  oIMacros.iimGetLastError();
            setWBStatus("BacklinkID: " + sBacklinkID + " - " + sErr); //delegate using INVOKE on the main thread
         }
         if(nRtn == -101 || nRtn == -102 ||oIMacros == null)
         {            
            _bStop = true;            
            return false;
         }
         return true;
      }
MAtkins
 
Posts: 25
Joined: Thu Jun 03, 2010 12:28 pm

Re: How do I detect if user closed the browser?

Postby Tom, iOpus on Fri Jul 30, 2010 8:24 am

Hello MAtkins,

Remind me again which version of iMacros you are using, thanks. I have tested with iMacros 7 and confirmed that -102 is not getting returned to the script when you close the iMacros Browser.
Regards,

Tom, iOpus Support
Tom, iOpus
 
Posts: 445
Joined: Mon May 31, 2010 9:59 am

Re: How do I detect if user closed the browser?

Postby Tom, iOpus on Wed Aug 25, 2010 2:34 am

Quick update: this issue has been resolved. The fix will be available in the next release which should be some time this week.

You can also select Check for Updates... from the Help menu in the iMacros Browser to see if the new version has been released.
Regards,

Tom, iOpus Support
Tom, iOpus
 
Posts: 445
Joined: Mon May 31, 2010 9:59 am


Return to Scripting and Command Line Interface

Who is online

Users browsing this forum: MSN [Bot] and 1 guest