Series of Google News searches

Hints, tips and tricks for newbies

Moderators: Dorian (MJT support), JRL

Post Reply
Tim

Series of Google News searches

Post by Tim » Tue Dec 21, 2004 11:31 pm

I'm trying Macro Scheduler and one function alone would make it worth my purchase. I'm stumped, although this must be a fairly easy script. Here's what I want to do:

1. Store a few dozen or few hundred search terms in a standard Notepad-created text file.

2. Navigate to the Google Advanced News Search and set the on-screen date search options.

3. Initiate the macro and have it enter the first item into the Search box.

4. Have the macro pause while I review the results returned.

5. Signal the macro to read in the next entry from the file, replace the search term only, and then press Enter for me to search the next entry.


I wasn't sure if WaitKeyDown was the best way to pause the macro while I manually review each result. Is the Automate Web Forms sample script be what I should be trying, or is this a web form?

Tim

Lumumba

Post by Lumumba » Wed Dec 22, 2004 8:14 am

Label>SearchGoogle
Add>ln,1
ReadLine>MyNotepadDatabase.txt, %ln%, Term
If>Term=##EOF##, Exit
Run Program>iexplore "http://www.google.co.uk/search?as_q=%Term%&num=10&hl=en&btnG=Google+Search&as_epq=&as_oq=&as_eq=&lr=&as_ft=i&as_filetype=&as_qdr=all&as_occt=any&as_dt=i&as_sitesearch=&safe=images"
WaitWindowOpen>Google search: %Term%*
WaitWindowClosed>Google search: %Term%*
Goto>SearchGoogle

Label>Exit
This code hasn't been tested ! :shock:
Check the Google URL once you've set the search options, as in the above case the only change I've done was to enter the word I've searched for (Term).
Is the Automate Web Forms sample script be what I should be trying, or is this a web form
Maybe, I don't know it. If possible I try to prevent any unreliable (web)frontend action.

Guest

Re: Series of Google News searches

Post by Guest » Wed Dec 22, 2004 8:22 am

Tim wrote:I'm trying Macro Scheduler and one function alone would make it worth my purchase. I'm stumped, although this must be a fairly easy script. Here's what I want to do:

Tim
This may help to get you started - tweak it to suit your searchology methods, eg if you specify dates, newspapers, all or exact, etc..
This is written using Firefox as my browser (I am afraid to open up IE) It should work with IE as well...

8) http://www.getfirefox.com 8)

The following is what D:\temp\mynews.txt contains
Note the + signs are needed for multiterm searches to work.
Perhaps, use the replace command to change white spaces to + signs...

partridge+family
martha+stewart+prison
martha+stewart+cake
britney+spears
britney+spears+clothed
fine+dining
mcdonalds
microsoft+sued
white+castle
dan+rather


Dialog>myDialog
Caption=%p2%
Top=0
Width=291
Left=519
Height=82
Button=Next Story,8,8,121,33,1
Button=Cancel,152,8,121,33,2
EndDialog>myDialog

Let>s=1
Label>start
ReadLn>C:\temp\mynews.txt,s,p2
If>p2=##EOF##,finish
Show>myDialog,result
If>result=1,runnews
If>result=2,finish
Let>s=s+1
Goto>start

SRT>runnews
Let>ff=C:\Program Files\Mozilla Firefox\firefox.exe
Let>p1= http://news.google.com/news?as_q=
//Get p2 from the ReadLn method a few lines up
Let>p3=&svnum=10&as_scoring=r&hl=en&edit
Let>p4=ion=usa&btnG=Google+Search&as_epq=
Let>p5=&as_oq=&as_eq=&as_nsrc=&as_nloc=&as_
Let>p6=occt=any&as_drrb=q&as_qdr=&as_mind=
Let>p7=21&as_minm=11&as_maxd=21&as_maxm=12
Run Program>%ff%%p1%%p2%%p3%%p4%%p5%%p6%%7%
End>runnews

Label>finish

User avatar
Monkster
Junior Coder
Posts: 42
Joined: Fri Oct 04, 2002 9:37 pm
Location: On an Island with Wilson

Re: Series of Google News searches

Post by Monkster » Wed Dec 22, 2004 8:29 am

Anonymous wrote:
Tim wrote:I'm trying Macro Scheduler and one function alone would make it worth my purchase. I'm stumped, although this must be a fairly easy script. Here's what I want to do:

Tim
This may help to get you started - tweak it to suit your searchology methods, eg if you specify dates, newspapers, all or exact, etc..
This is written using Firefox as my browser (I am afraid to open up IE) It should work with IE as well...

8) http://www.getfirefox.com 8)

I forgot to mention that if you do use IE it will probably open a new window each time you click view next. In Firefox it simply opens in the current tab.
Best Wishes,
Monkster

Lumumba

Post by Lumumba » Wed Dec 22, 2004 8:39 am

This section contains an unnecessary/illegal Space character after a comma !
ReadLine>MyNotepadDatabase.txt, %ln%, Term
If>Term=##EOF##, Exit
That would be correct ...
ReadLine>MyNotepadDatabase.txt,%ln%,Term
If>Term=##EOF##,Exit

Lumumba

Post by Lumumba » Wed Dec 22, 2004 8:58 am

Eh, have used Google's standard search in my above sample. That line would parse the news section (still uses the variable "Term").

Tim

Post by Tim » Thu Dec 23, 2004 11:22 pm

Thanks for the great advice. I used the script that has the "next" and "cancel" buttons with some minor tweaking to set the search date ranges and it works perfectly. This macro will be a big timesaver!

Tim

Post Reply
cron
Sign up to our newsletter for free automation tips, tricks & discounts