我希望 AutoIt 激活 Firefox 中的特定选项卡。这怎么能做到呢?
我在 Firefox 中打开了几个选项卡。我希望 AutoIt 激活 Firefox 中的特定选项卡。这怎么能做到呢?
I have several tabs open in Firefox. I want AutoIt to activate a particular tab in Firefox. How can this be done?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(6)
让整个浏览器窗口获得焦点,然后使用 send 命令重复发送 cntl-tab ,直到窗口的标题是您想要的选项卡的名称(末尾带有 - Mozilla Firefox)。
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).
有一个名为 FF.au3 的 UDF(用户定义函数 - 包含文件) 。看起来您想要的函数是
_FFTabSetSelected()
,祝您好运!下面是珍妮品达方法的一个例子。我就是这样做的。
There's a UDF (User Defined Functions -include file) called FF.au3. Looks like the function you want is
_FFTabSetSelected()
, good luck!Below is an example of Jeanne Pindar's method. This is the way I would do it.
给你...
只需删除 MsgBox 就可以了!
Here you go...
Just delete the MsgBox and you're all set!
正如Copas所说,使用FF.au3。函数
_FFTabSetSelected($regex,"label")
将选择名称与给定$regex
匹配的第一个选项卡。As Copas said, use FF.au3. Function
_FFTabSetSelected($regex,"label")
will select first tab with name matching given$regex
.Nop...脚本有 bug ^^'...不需要数到 100,并且后面的“发送”有问题:
如果发送 ctrl + number
=>数字不能大于9...因为10是一个有2个字符的数字,Firefox无法使用快捷方式激活选项卡10。
顺便说一下,当脚本运行时,有一刻他松开了 ctrl 键。它不会发送 10,但 ctrl 和 1 会结束零......然后溅起!它只是发送窗口中的号码。
所以我们需要让脚本知道,当他第二次回到 $i = 0 或 1 时,所有选项卡都被看到,无需继续,即使您正在搜索的文本没有找到。
所以我根据旧脚本制作了自己的脚本:
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:
我已经很多年没有碰过 AutoIt 了,但 IIRC 将会是:
I haven't touched AutoIt in years, but IIRC it will be: