5

Firefoxでいくつかのタブを開いています。AutoItでFirefoxの特定のタブをアクティブにしたい。これはどのように行うことができますか?

4

6 に答える 6

5

ブラウザ ウィンドウ全体にフォーカスを与えてから、send コマンドを使用して、ウィンドウのタイトルが必要なタブの名前になるまで cntl-tab を繰り返し送信します (最後に - Mozilla Firefox を付けます)。

于 2010-06-02T01:44:26.380 に答える
5

FF.au3という UDF (User Defined Functions -include ファイル) があります。ご希望の機能は のようです_FFTabSetSelected()。がんばってください!

以下は、Jeanne Pindar の方法の例です。これが私のやり方です。

#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
于 2010-06-02T04:56:27.760 に答える
4

どうぞ...

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 を削除するだけで準備完了です。

于 2010-08-14T00:26:29.563 に答える
2

Copasが言ったように、FF.au3を使用してください。関数は、指定された_FFTabSetSelected($regex,"label")名前に一致する最初のタブを選択します$regex

于 2010-10-04T10:25:40.200 に答える
0

いいえ...スクリプトにはバグがあります^^'... 100まで数える必要はありません。その後の「送信」に問題があります。

ctrl + number を送信した場合 =>9 を超える数字は使用できません... 10 は 2 文字の数字であるため、Firefox はショートカットでタブ 10 をアクティブにできません。

ところで、スクリプトが動作しているとき、彼が ctrl キーを放す瞬間があります.. 10 は送信しませんが、ctrl と 1 は 0 で終わります...そしてスプラッシュ !!! ウィンドウに番号を送信するだけです。そのため、2 回目に $i = 0 または 1 に戻ったときに、すべてのタブが表示されたので、検索しているテキストが見つからなくても続行する必要がないことをスクリプトに学習させる必要があります。そこで、古いスクリプトに基づいて独自のスクリプトを作成しました。

##
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
##
于 2014-08-17T00:35:45.197 に答える
-4

私は何年もAutoItに触れていませんが、IIRCは次のようになります。

setMousePos(x, y)    // tab position
click("left")
于 2010-06-02T00:41:50.270 に答える