hello!
can you tell me please a script that will close the current tab in Firefox, with RCtrl?
thanks!
close tab with RCtrl
-
- Posts: 58
- Joined: 15 Jan 2014, 19:09
Re: close tab with RCtrl
This closes the active tab on my Firefox (ver 33.0.2) by sending the standard close-tab shorkcut (Control+w).Possibly Mozilla uses MozillaWindowClass windows elsewhere, and that is why I added the ahk_exe condition to the #IfWinActive. A word of caution, though: lots of shortcut keys involve the control key, and my hands want to type the RControl automatically for many of them, so I am putting tabs in peril every time I hit RControl unless I continue and hit some other key while the control key is still held.
Code: Select all
#IfWinActive, ahk_class MozillaWindowClass ahk_exe firefox.exe
RControl::SendInput, ^w
Re: close tab with RCtrl
thanks it works very well, I tested it for few days
by the way, can you add to it please the functionality of keyboard arrows left/right to focus the left/right to the active, tab?
but it shouldn't work when the cursor is inside a text box and I want to navigate through the text there!
by the way, can you add to it please the functionality of keyboard arrows left/right to focus the left/right to the active, tab?
but it shouldn't work when the cursor is inside a text box and I want to navigate through the text there!
Re: close tab with RCtrl
Making the tabs switch using the arrow keys wouldn't be hard, by just sending a ^{tab} or ^+{tab}. But making it conditional by determining if a textbox has focus would be more of a challenge as Firefox doesn't behave as most other applications and its window is basically a black box.
Re: close tab with RCtrl
maybe make it work only when there is a blinking vertical line? or the focus is on text box?
or if nothing can be done, then eventually when the cursor is IBeam maybe?
or if nothing can be done, then eventually when the cursor is IBeam maybe?
-
- Posts: 58
- Joined: 15 Jan 2014, 19:09
Re: close tab with RCtrl
Nextron is correct in that what goes on in the Firefox screen is essentially opaque and unpararsable, except to Firefox. I might suggest (although again I thing RControl by itself is a dangerous thing as I said in the second post) that you use RControl plus a left or right arrow to do the switching of the tabs. After all, RControl is right next to the arrrows on the standard keyboard layout, so it is an easy pair to type. And if you are using RControl by itself to manipulate tabs, your fingers are already there. If you like this, then the following should work (it does on my machine), sending the standard Firefox shortcuts Ctrl+PgUp and Ctrl+PgDn to move the focus tab left and right.
Code: Select all
#IfWinActive, ahk_class MozillaWindowClass ahk_exe firefox.exe
>^Left::SendInput, ^+{PgUp}
>^Right::SendInput, ^+{PgDn}
Re: close tab with RCtrl
thanks, but I don't want to hit RCtrl and arrows
can you tell me a script that would go to next/previous tab with arrows only? and that would work only if the cursor is IBeam (if not possible to make it work only if a blinking vertical line for text exists)
can you tell me a script that would go to next/previous tab with arrows only? and that would work only if the cursor is IBeam (if not possible to make it work only if a blinking vertical line for text exists)
-
- Posts: 58
- Joined: 15 Jan 2014, 19:09
Re: close tab with RCtrl
No. Sorry.
Re: close tab with RCtrl
why? what is the problem?
Re: close tab with RCtrl
You mean, not an Ibeam?usser wrote:can you tell me a script that would go to next/previous tab with arrows only? and that would work only if the cursor is IBeam
Remember that the cursor is the thing that moves with your mouse. The blinky thingy that moves in front of the letters you type is called a caret (and isn't always visible) Because of the obscured way Firefox works, it doesn't tell Windows if it exists or not, so it's difficult to check for. The cursor however is a Windows thing and is easy to check for, but it's only an Ibeam when it hovers over text. So also static selectable text you can't type in, but it's not an Ibeam when you're actually typing but the cursor is hovering someplace else. Regardless of it's usefulness, this is what you'd have to use:
Code: Select all
#If (A_Cursor!="IBeam")
Left::Send ^+{Tab}
Right::Send ^{Tab}
I can't think of a way that not incredibly difficult and possibly unreliable.(if not possible to make it work only if a blinking vertical line for text exists)
Re: close tab with RCtrl
thanks
but how do I combine the two if's?
like that?
but how do I combine the two if's?
Code: Select all
#IfWinActive, ahk_class MozillaWindowClass ahk_exe firefox.exe
#If (A_Cursor!="IBeam")
Left::Send ^+{Tab}
Right::Send ^{Tab}
Re: close tab with RCtrl
#If (A_Cursor!="IBeam") && WinActive("ahk_class MozillaWindowClass ahk_exe firefox.exe")
Who is online
Users browsing this forum: Billykid, Google [Bot] and 209 guests