AutoIt with Firefox

I have several tabs open in Firefox. I want AutoIt to activate a specific tab in Firefox. How can I do that?

+5
source share
6 answers

Give focus to the entire browser window, then use the send command to resend its cntl-tab until the window title is the name of the desired tab (with Mozilla Firefox at the end).

+5
source

There is UDF (User Defined Functions -include file) called FF.au3 . Sounds like you need a feature _FFTabSetSelected(), good luck!

The following is an example of the Jeanne Pindar method. So I would do that.

#include <array.au3>

Opt("WinTitleMatchMode", 2)

activateTab("Gmail")
Func activateTab($targetWindowKeyphrase)
    WinActivate("- Mozilla Firefox")
    For $i = 0 To 100
        If StringInStr(WinGetTitle(WinActive("")),$targetWindowKeyphrase) Then
            MsgBox(0,"Found It", "The tab with the key phrase " & $targetWindowKeyphrase & " is now active.")
            Return
        EndIf
        Send("^{TAB}")
        Sleep(200)
    Next
EndFunc
+5
source

...

AutoItSetOption("WinTitleMatchMode", 2)

$searchString = "amazon"

WinActivate("Mozilla Firefox")
For $i = 0 To 100
    Send("^" & $i)
    Sleep(250)
    If Not(StringInStr(WinGetTitle("[ACTIVE]"), $searchString) = 0) Then
        MsgBox(0, "Done", "Found it!")
        ExitLoop
    EndIf
Next

MsgBox, !

+3

, FF.au3. _FFTabSetSelected($regex,"label") , $regex.

+2

Nop... script ^^ '... 100, "":

ctrl + number = > 9... - 2 , Firefox 10 .

And by the way, when the script is running, there is a moment when it releases the ctrl key. It does not send ten, but ctrl and 1 end zero ... and a splash !!! It just sends the number in the window. Therefore, we need to learn the script that the second time it returned to $ i = 0 or one, all the tabs were visible, no need to continue, even if the text you are looking for was not found. Therefore, I created my own script based on the old:

##
AutoItSetOption("WinTitleMatchMode", 2)

$searchString = "The string you're looking for"
Local $o = 0
WinActivate("The Name of the process where you're searching")
For $i = 0 To 9
   Send("^" & $i)
   Sleep(250)
      if ($i = 9) Then
         $o += 1
      EndIf
      If not (StringInStr(WinGetTitle("[ACTIVE]"), $searchString) = 0) Then
            MsgBox("","","Found it !") ;your action,  the text was found.
            ExitLoop
      ElseIf ($o = 1) Then
            MsgBox("","","All tab seen, not found...") ;your action, the text was not found, even after looking all title.
            ExitLoop
      EndIf
   Next
##
0
source

I have not touched AutoIt for many years, but IIRC it will be:

setMousePos(x, y)    // tab position
click("left")
-4
source

All Articles