使用Firefox进行自动编辑
我在Firefox中打开了几个选项卡。我希望AutoIt激活Firefox中的特定选项卡。如何做到这一点?我已经多年没有接触过AutoIt了,但IIRC将会:使用Firefox进行自动编辑,firefox,autoit,Firefox,Autoit,我在Firefox中打开了几个选项卡。我希望AutoIt激活Firefox中的特定选项卡。如何做到这一点?我已经多年没有接触过AutoIt了,但IIRC将会: setMousePos(x, y) // tab position click("left") 为整个浏览器窗口设置焦点,然后使用send命令反复向其发送cntl选项卡,直到窗口标题为所需选项卡的名称(最后是-Mozilla Firefox) 有一个UDF(用户定义函数-包含文件),名为。看起来您想要的函数是\u FFTabSet
setMousePos(x, y) // tab position
click("left")
为整个浏览器窗口设置焦点,然后使用send命令反复向其发送cntl选项卡,直到窗口标题为所需选项卡的名称(最后是-Mozilla Firefox) 有一个UDF(用户定义函数-包含文件),名为。看起来您想要的函数是
\u FFTabSetSelected()
,祝您好运
下面是珍妮·品达方法的一个例子。我会这样做的
#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
#包括
选项(“WinTitleMatchMode”,2)
activateTab(“Gmail”)
Func activateTab($targetWindowKeyPhase)
WinActivate(“-Mozilla Firefox”)
对于$i=0到100
如果StringInStr(WingTTITLE(WinActive(“”),$TargetWindowKeyPhase),则
MsgBox(0,“找到它”,“带有关键字短语“&$targetWindowKeyPhase&”的选项卡现在处于活动状态。”)
返回
恩迪夫
发送(“^{TAB}”)
睡眠(200)
下一个
EndFunc
给你
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,即可完成所有设置 正如Copas所说,使用FF.au3。函数
\u FFTabSetSelected($regex,“label”)
将选择名称与给定名称匹配的第一个选项卡$regex
否。。。脚本有问题^^^'。。。无需计数到100,且之后的“发送”有问题:
如果发送ctrl+number
=>数字不能大于9。。。因为十是一个带有2个字符的数字,Firefox无法使用快捷方式激活tab 10
顺便说一下,当脚本运行时,有一刻他会释放ctrl键。。它不发送10,但ctrl和1结束于零。。。还有飞溅!!!它只是在窗口中发送号码。
所以我们需要学习脚本,当他第二次回到$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
##
我希望它根据其名称而不是位置来激活选项卡。鼠标单击(“Left”,x,y,)将是您在AutoIt v3中左键单击某个位置的方式。我看到有人这样做,而不必使用AutoIt在所有窗口标题中alt tab,但是我不知道他们是怎么做到的,因为我没有看到源代码。FF.au3 include要求安装MozRepl,您可以在这里获得:.+1关于1行代码和+1关于不发送事件。与任何可以使用对象的
发送
或单击
到活动窗口不同。这是设置所选选项卡的正确方法。如果隐藏了包含选项卡的窗口,也可以关闭选项卡而不干扰其他窗口。