I have several tabs open in Firefox. I want AutoIt to activate a particular tab in Firefox. How can this be done?
I haven't touched AutoIt in years, but IIRC it will be:
setMousePos(x, y) // tab position
click("left")
Give the whole browser window focus, then use the send command to repeatedly send it cntl-tab until the window's title is the name of the tab you want (with - Mozilla Firefox at the end).
Stilgar on the AutoIt forms has made a UDF (what the AutoIt community call an include file for some reason). To do just this sort of thing with AutoIt. They call it FF.au3
Looks like the function you want is _FFTabSetSelected() good luck!
Hopefully I will post an example of FF.au3 working later today below is an example of Jeanne Pindar's method. I had the same idea, if it were not production software (ie. something just for me) this is the way I would do it.
#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
Here you go...
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
Just delete the MsgBox and you're all set!
As Copas said, use FF.au3. Function _FFTabSetSelected($regex,"label")
will select first tab with name matching given $regex
.