将 WSH (VBS) 与 iMacros 一起使用 - 他们是如何做到的?

发布于 2024-09-03 02:24:01 字数 1717 浏览 7 评论 0原文

(iMacros 适用于 Firefox 6.6.5.0;Firefox 3.6.3;Windows XP Pro SP3,带所有更新)

我制作了一个 iMacro,用于在网页 (CNN.COM) 上选择“加载下 25 条”(评论)。不幸的是,iMacros 似乎没有进行循环(执行上述操作,直到该字符串不再出现在页面上 - 即所有注释都已加载)。我尝试将 {!iloop} 放入 TAG 命令中,但它不起作用 - 然后我读到它不起作用。

所以我尝试了 http://wiki.imacros.net/Loop_after_Query_or_Login 中的示例 我找不到有关如何实际运行上面示例中的脚本的任何信息。我搜索了 Google,发现 VBS 脚本是通过 Windows XP Pro 的 .wsh 文件处理的。 (那里的示例和其他参考资料说 Windows 本身就是 VBS,所以我通过 Google 查找了如何操作。)

所以我制作了以下 .wsh 文件(修改了上面的示例):

Option Explicit
Dim iim1, iret

'initialize iMacros instance
set iim1 = CreateObject ("imacros")
iret = iim1.iimInit()

do while not iret < 0
   iret = iim1.iimPlay("Load All CNN Comments")
loop

' tell user we're done
msgbox "End."

' exit iMacros instance and quit script
iret = iim1.iimExit()
Wscript.Quit()   

这是 iMacro:(加载所有 CNN Comments.iim

VERSION BUILD=6650406 RECORDER=FX
TAG POS=1 TYPE=A ATTR=TXT:Load<SP>next<SP>25
WAIT SECONDS=#DOWNLOADCOMPLETE#   

) iMacro 自行工作 - 我按下“播放”(左侧 iMacro 面板),接下来的 25 条评论将加载到当前选项卡的 CNN.com 页面上。

我将 .wsh 文件放在 ...\iMacros\Macros 目录中 - 使用 iMacro“加载所有 CNN Comments.iim”

当我运行 .wsh 文件时(只需双击它的图标 - 我用记事本创建它, Windows 为它提供了该文件类型的图标 - 它是可执行的)我从“Windows 脚本宿主”收到消息 - “没有指定脚本文件。”我实际上并没有期望它能够工作,因为我不明白 Windows 如何知道调用 iMacros 来运行 iim 宏。

如果有一个简单、完整的示例来说明如何将 VBS 脚本与 iMacros 一起使用,并且不会陷入不必要的复杂性(例如填写表单、加载多个页面等),那就太好了。我找不到任何示例例子。

那么我需要做什么才能让它发挥作用呢?我昨天刚刚安装了 iMacros,因为我经常遇到这样的问题:CNN.com 的文章后有数百条评论,并且一次加载 25 条以上,直到它们全部出现在页面上,这使得阅读对我的评论的任何回复都是不切实际的。

如果我可以从 Firefox 运行该宏,而不是通过双击某处的某个文件,那就太好了。

感谢您的任何帮助。

(iMacros For Firefox 6.6.5.0; Firefox 3.6.3; Windows XP Pro SP3 w/all updates)

I made an iMacro to select "load next 25" (comments) on a web page (CNN.COM). Unfortunately, iMacros doesn't appear to do looping (do the above until that string doesn't appear on the page anymore - i.e. all the comments are loaded). I tried putting {!iloop} in the TAG command, and it didn't work - then I read it wouldn't.

So I tried the example at http://wiki.imacros.net/Loop_after_Query_or_Login
I can't find any information on how to actually run the script in the above example. I searched Google and found VBS scripting is handled with .wsh files with Windows XP Pro. (The examples and other references there say Windows does VBS natively, so I looked up how with Google.)

So I made the following .wsh file (modified the above example):

Option Explicit
Dim iim1, iret

'initialize iMacros instance
set iim1 = CreateObject ("imacros")
iret = iim1.iimInit()

do while not iret < 0
   iret = iim1.iimPlay("Load All CNN Comments")
loop

' tell user we're done
msgbox "End."

' exit iMacros instance and quit script
iret = iim1.iimExit()
Wscript.Quit()   

Here's the iMacro: (Load All CNN Comments.iim)

VERSION BUILD=6650406 RECORDER=FX
TAG POS=1 TYPE=A ATTR=TXT:Load<SP>next<SP>25
WAIT SECONDS=#DOWNLOADCOMPLETE#   

The iMacro works by itself - I press Play (left iMacro panel) and the next 25 comments load on the CNN.com page in the current tab.

I put the .wsh file in the ...\iMacros\Macros directory - with the iMacro "Load All CNN Comments.iim"

When I run the .wsh file (by just double clicking on it's icon - I created it with Notepad, and Windows gave it an icon for that file type - it's executable) I get the message from "Windows Script Host" - "There is no script file specified." I wasn't actually expecting it to work, as I don't see how Windows would know to call iMacros to run the iim macro.

It would be nice if there was a simple, COMPLETE, example of how to use a VBS script with iMacros, that isn't bogged down with unnecessary complication like filling in a form, loading multiple pages, etc. I can't find ANY example.

So what do I need to do to get this to work? I just installed iMacros yesterday, because I am constantly having the problem that there are hundred of comments after a CNN.com article, and loading 25 more at a time until they are all on the page makes it impractical to read any replies to my comments.

It would also be nice if I could run the Macro from Firefox, rather than by double clicking on some file somewhere.

Thanks for any help.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

尝试将脚本的扩展名从 .WSH 更改为 .VBS

Try changing the extension of your script from .WSH to .VBS.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文