Using WSH (VBS) with iMacros - how do they do it?
- by Carl
(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.