|
soundcheck Newbie
Joined: 21 Nov 2009 Posts: 5
|
Posted: Sun Jan 24, 2010 9:45 am
Extracting data off an online text document. |
Hey there.
I was wondering if it was possible for zmud to read a webpage and extract information out of it. I've tried playing around with the DDE commands but so far have been unsuccessful at coming up with anything remotely useful. Anyone have any idea how I could do this in anyway not necessarily involving DDE?
Thanks! |
|
|
|
Taz GURU
Joined: 28 Sep 2000 Posts: 1395 Location: United Kingdom
|
|
_________________ Taz :) |
|
|
|
soundcheck Newbie
Joined: 21 Nov 2009 Posts: 5
|
Posted: Tue Jan 26, 2010 12:33 am |
Thanks for the help!
Unfortunately, I'm not familiar with VBScript at all. Is there any tutorial you could point me to so that I could get myself acquainted with the language? I tried looking online but couldn't find anything useful for a beginner like myself. |
|
|
|
chris-74269 Magician
Joined: 23 Nov 2004 Posts: 364
|
Posted: Tue Jan 26, 2010 4:47 am |
I removed the website this is from to avoid undue spam there. Basically gets the armour values and reports them
#lua {if not http then http = require("socket.http") end
local page = http.request("http://website/pSearch=" .. zs.params(1))
local nextpage = string.match(page,"http://website/pID=(%d+).*" .. zs.func.proper(zs.params(1)))
if nextpage then
nexturl = "http://website/pID=" .. nextpage
local page = http.request(nexturl)
page = string.sub(page, string.find(page,"#CCCCCC"), string.find(page,"span style"))
page = string.sub(page, string.find(page,"<tr>"), string.find(page,"</table>"))
zs.var.results = page
else
echo("Doesn't exist")
zs.var.results = ""
end
}
#if (@results) {results = %subregex(@results, "</td>","|")
edged = %subregex(%item(@results,2),".*>")
blunt = %subregex(%item(@results,3),".*>")
fire = %subregex(%item(@results,4),".*>")
cold = %subregex(%item(@results,5),".*>")
acid = %subregex(%item(@results,6),".*>")
elec = %subregex(%item(@results,7),".*>")
mind = %subregex(%item(@results,8),".*>")
energy = %subregex(%item(@results,9),".*>")
poison = %subregex(%item(@results,10),".*>")
radiation = %subregex(%item(@results,11),".*>")
overall = %subregex(%item(@results,12),".*>")
#print {%-1}
#show %ansi(high,cyan)"Edged Blunt Fire Ice Acid Elec Mind Energy Poison Radiation Overall"
#print { @edged @blunt @fire @cold @acid @elec @mind @energy @poison @radiation @overall}} {} |
|
|
|
soundcheck Newbie
Joined: 21 Nov 2009 Posts: 5
|
Posted: Tue Jan 26, 2010 6:02 am |
Thanks chris! Sadly, if I'm not wrong, I can't use LUA in zMUD, so that probably won't work for me.
|
|
|
|
chris-74269 Magician
Joined: 23 Nov 2004 Posts: 364
|
Posted: Tue Jan 26, 2010 6:36 am |
right you are. Sorry, I didn't check what forum this was for
|
|
|
|
Taz GURU
Joined: 28 Sep 2000 Posts: 1395 Location: United Kingdom
|
|
_________________ Taz :) |
|
|
|
soundcheck Newbie
Joined: 21 Nov 2009 Posts: 5
|
Posted: Wed Jan 27, 2010 12:36 am |
Thanks a lot Taz!
|
|
|
|
Taz GURU
Joined: 28 Sep 2000 Posts: 1395 Location: United Kingdom
|
Posted: Wed Jan 27, 2010 1:18 am |
See how you get on. If you get stuck post what is causing an issue and I'll see if I can help.
|
|
_________________ Taz :) |
|
|
|
shalimar GURU
Joined: 04 Aug 2002 Posts: 4691 Location: Pensacola, FL, USA
|
Posted: Thu Jan 28, 2010 12:19 pm |
you could set a variable to %clip and then do an expression trigger for whenever its value changes and have it parse the variable for the info you want
then all you would need to do is select all and copy on each webpage you wanted to check |
|
_________________ Discord: Shalimarwildcat |
|
|
|
|
|