How to close the iMacros Browser?

Support for iMacros. The iMacros software is the unique solution for automating every activity inside a web browser, for data extraction and web testing.

Moderators: Community Moderators, iMacros Moderators

Forum rules
Before asking a question or reporting an issue:
1. Please review the list of FAQ's.
2. Use the Google search box (at the top of each forum page) to see if a similar problem or question has already been addressed. This will search the entire contents of the forums as well as the iMacros Wiki.
3. We can respond much faster to your posts if you include the following information:

CLICK HERE FOR IMPORTANT INFORMATION TO INCLUDE IN YOUR POST

Answering your own posts (e.g. attempting to "bump" your topic) drops your topic from the list of unanswered threads, so it may actually receive less views.

How to close the iMacros Browser?

by Roy Holzem on Tue May 27, 2014 3:55 am

Hello,

I need to close the iMacro Browser (the .exe) and TAB CLOSE only closes a TAB,
what options do I have within the macro function (not iimExit())?


If there is no propper function ( I tried to google for it ) i'd go with something like send: ALT F4



Thank you in advance for support
Roy Holzem
 
Posts: 3
Joined: Sun May 25, 2014 11:18 pm

Re: How to close the iMacros Browser?

by chivracq on Tue May 27, 2014 7:00 am

Roy Holzem wrote:Hello,

I need to close the iMacro Browser (the .exe) and TAB CLOSE only closes a TAB,
what options do I have within the macro function (not iimExit())?

If there is no propper function ( I tried to google for it ) i'd go with something like send: ALT F4

Thank you in advance for support

FCIM...! :mrgreen:

-1- First thought I had is to launch your (Browser and) Script from a Batch File and to issue a 'taskkill' once your Script has finished running. (This should work...)

-2- Second thought was indeed to simulate a Keypress with ALT^F4.
In iMacros for Firefox, you should be able to use the EVENT Mode with one of these Statements:
Code: Select all
EVENT TYPE=KEYPRESS SELECTOR="HTML>BODY" KEY=115 MODIFIERS="alt"

Code: Select all
EVENT TYPE=KEYPRESS SELECTOR=* KEY=115 MODIFIERS="alt"

Code: Select all
EVENT TYPE=KEYPRESS KEY=115 MODIFIERS="alt"

... But they don't work!! :mrgreen:
Even after I checked/modified 'dom.allow_scripts_to_close_windows' to "TRUE" in 'about:config'...

I don't know why, because the following Statements do work fine:
Code: Select all
'Toggle Full Screen (F11):
EVENT TYPE=KEYPRESS KEY=122

Code: Select all
'Browse Open Archives (Alt^m):
EVENT TYPE=KEYPRESS CHAR="m" MODIFIERS="alt"


The EVENT Mode is only available for iMacros for Firefox, maybe it was an option for you to run your Script in FF, or use some Keypress Emulation like explained in the following Thread, though the "ALT" part might have been tricky (I tried a whole list of combinations with "18 AND 115"), but I didn't get it to work anyway...
=> How to simulate a keypress using Javascript

-3- The third thought was to use some JavaScript, and Google took me to this Page:
=> How can I close a browser window without receiving the “Do you want to close this window” prompt?
Several Methods explained, but "window.close()" will only close a Window that was opened by JavaScript...
The Function I retained is:
Code: Select all
this.focus();
self.opener=this;
self.close();

... which I transformed into:
Code: Select all
javascript:this.focus();self.opener=this;self.close()

... which you cannot run in the Address-bar in Firefox anymore since a few Versions, but in the Web Console, and yes!, it worked! One Browser Instance with 1 Tab gets closed or only the current Tab gets closed if you have several Tabs open. Good!

But how can I invoke the Web Console from iMacros? It luckily has a Shortcut (Ctrl^Shift^j) and indeed, using the EVENT Mode again, I manage to launch it and a Paste of that Statement in the Clipboard should do the trick. But I didn't manage to get the Paste to work. I give my Script for Reference, but it didn't work:
Code: Select all
SET !CLIPBOARD "javascript:this.focus(); self.opener=this; self.close()"
PROMPT {{!CLIPBOARD}}
'Launch Firefox Web Console:
EVENT TYPE=KEYPRESS CHAR="k" MODIFIERS="ctrl,shift"
WAIT SECONDS=3
'Paste Clipboard Content:
EVENT TYPE=KEYPRESS CHAR="v" MODIFIERS="ctrl"
'Hit ENTER:
EVENT TYPE=KEYPRESS KEY=13

I didn't try with Tab-Tab-Tab-Tab-Tab... (EDIT: It works, but the number of Tab-Tab-Tab depends on the Page...) or with the Mouse Coordinates to find a way to manage to select (again because it already had the Focus) the correct Field...

-4- Now the fourth thought, which proved to be successful, is simply to use!:
Code: Select all
URL GOTO=javascript:this.focus();self.opener=this;self.close()

If several Tabs are open, only the current Tab is closed, you may need to loop/repeat that Statement a few times if you want to make sure to close the Last Tab (and the Window with it) if you have several Tabs open...
Tested on iMacros v8.8.2 for FF on Pale Moon v24.5.0 (=FF29) on WinXP SP3.
- (F)CIM = (Full) Config Info Missing: iMacros + Browser + OS with all 3 Versions...
- I usually don't even read the Question if that (required) Info is not mentioned...
- Script & URL usually help a lot for a more "educated" Help...
chivracq
 
Posts: 6477
Joined: Sat Apr 13, 2013 6:07 am
Location: Amsterdam (NL)

Re: How to close the iMacros Browser?

by Roy Holzem on Tue May 27, 2014 11:25 pm

Hello chivracq,

Thank you very much for your propositions, I got it to work with a timed ALT F4.


Impressive response though :idea:


Best regards :)
Roy Holzem
 
Posts: 3
Joined: Sun May 25, 2014 11:18 pm

Re: How to close the iMacros Browser?

by chivracq on Wed May 28, 2014 12:25 am

Roy Holzem wrote:Hello chivracq,

Thank you very much for your propositions, I got it to work with a timed ALT F4.

Impressive response though :idea:

Best regards :)


Okay, but I don't understand what you mean by "a timed ALT F4"... Can you explain? (And post your Script if some Code is required...?)

The 'URL GOTO' Solution is quite powerful btw, I think..., but I've tested it only on Pale Moon (= Firefox), I would be interested to know if it works as well for other Browsers, among them for the iMacros Browser... Could you test that...?
- (F)CIM = (Full) Config Info Missing: iMacros + Browser + OS with all 3 Versions...
- I usually don't even read the Question if that (required) Info is not mentioned...
- Script & URL usually help a lot for a more "educated" Help...
chivracq
 
Posts: 6477
Joined: Sat Apr 13, 2013 6:07 am
Location: Amsterdam (NL)

Re: How to close the iMacros Browser?

by chivracq on Sun Jun 15, 2014 7:50 pm

Pity you never replied anymore to my last Post... :roll:
- (F)CIM = (Full) Config Info Missing: iMacros + Browser + OS with all 3 Versions...
- I usually don't even read the Question if that (required) Info is not mentioned...
- Script & URL usually help a lot for a more "educated" Help...
chivracq
 
Posts: 6477
Joined: Sat Apr 13, 2013 6:07 am
Location: Amsterdam (NL)

Re: How to close the iMacros Browser?

by chivracq on Sun Dec 07, 2014 2:05 pm

Other relevant Threads:
- Batch File: Load Firefox, Run Macro(s), Close
- Any way of writing a macro that closes the entire browser?
- Unable to close Firefox (Aug.2016 - Feb.2017) + 'Ctrl^Shift^w' + VM + FF/PM.

(Last Update: 2017-02-04.)
- (F)CIM = (Full) Config Info Missing: iMacros + Browser + OS with all 3 Versions...
- I usually don't even read the Question if that (required) Info is not mentioned...
- Script & URL usually help a lot for a more "educated" Help...
chivracq
 
Posts: 6477
Joined: Sat Apr 13, 2013 6:07 am
Location: Amsterdam (NL)


Return to General Support & Discussions

Who is online

Users browsing this forum: Yahoo [Bot] and 9 guests

-->