Hello, its been a while since I ve made any scripts so just need a few tips in the right direction. Was wondering if I can do the following.
1. Search a website for specific text present
2 if the text if present on the page. >> Return a variable ( if needed) that will allow further steps to be taken with that text.
3. if not present just time loop.
Its the text search and return if that I m stuck on.
Search for text on a website
Moderators: JRL, Dorian (MJT support)
- Marcus Tettmar
- Site Admin
- Posts: 7395
- Joined: Thu Sep 19, 2002 3:00 pm
- Location: Dorset, UK
- Contact:
With WebRecorder you can use the ContainsText function to do this.
Marcus Tettmar
http://mjtnet.com/blog/ | http://twitter.com/marcustettmar
Did you know we are now offering affordable monthly subscriptions for Macro Scheduler Standard?
http://mjtnet.com/blog/ | http://twitter.com/marcustettmar
Did you know we are now offering affordable monthly subscriptions for Macro Scheduler Standard?
Here is a simple example to get you started which uses the HTTPRequest> command and simple parsing techniques.
Code: Select all
// Show the results of a parsed webpage inside a Dialog
Dialog>Dialog1
Caption=Dialog1
Width=403
Height=301
Top=150
Left=31
Edit=msEdit1,80,40,81,
Label=ZipCode,24,40,true
Button=Go,232,40,75,25,3
Memo=msMemo1,40,96,273,113,
Label=Get Weather Info,64,8,true
EndDialog>Dialog1
Show>Dialog1
Label>MainLoop
GetDialogAction>Dialog1,result
If>result=2,End
If>result=3,GetWeather
Wait>0.01
Goto>MainLoop
SRT>GetWeather
Let>zip_code=Dialog1.msEdit1
Let>URL=http://www.briansutton.com/wx/weather.html?id=%zip_code%&length=10&unit=s&#current
HTTPRequest>URL,,GET,,HTMLResponse
Let>String1=<td width="41%" height="24" align="center" valign="top">
Let>String2=</td>
Length>String1,String1_length
Position>String1,HTMLResponse,1,StartAt
Add>StartAt,String1_length
Position>String2,HTMLResponse,StartAt,EndAt,FALSE
Let>myLen=EndAt-StartAt
MidSTr>HTMLResponse,StartAt,myLen,myWeather
Let>Dialog1.msMemo1=The current weather for zipcode %zip_code% is %CRLF%%CRLF%%myWeather%
ResetDialogAction>Dialog1
END>GetWeather
Label>End