AutoIt with Firefox

前端 未结 6 1782
臣服心动
臣服心动 2021-02-04 19:58

I have several tabs open in Firefox. I want AutoIt to activate a particular tab in Firefox. How can this be done?

6条回答
  •  一生所求
    2021-02-04 20:45

    Nop... The script is buggy ^^'... no need to count to 100, and there is a problem with the "send" after it:

    If you send ctrl + number =>the number can't be bigger than 9... Because ten is a number with 2 caracters, Firefox can't activate tab 10 with shortcut.

    And by the way when the script is working there is a moment he release the ctrl key.. It don't send ten, but ctrl and 1 end zero ... and splash !!! It just send the number in the window. So we need to learn to the script that the second time he's back to $i = 0 or one, all the tabs was seen, no need to continue, even if the text you're searching for was not found. So I made my own script based on the old one:

    ##
    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
    ##
    

提交回复
热议问题