AutoHotkey Homepage AutoHotkey Community
Let's help each other out
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

A challenge , solved weekly speed camera info from website

 
Reply to topic    AutoHotkey Community Forum Index -> Ask for Help
View previous topic :: View next topic  
Author Message
ls78



Joined: 03 May 2006
Posts: 44

PostPosted: Thu Jul 10, 2008 8:24 pm    Post subject: A challenge , solved weekly speed camera info from website Reply with quote

i want to make a script that will return a few lines of text from a website on where the mobile speed camera are located every week . as there is no rss feed for this . i just want a gui on my desktop showing the information without having to load the whole page.



ok any ideas , am i asking too much from autohotkey ?


ok , what i want to do is make a gui that loads some text from a website

any ideas would be great .

thanks for reading.
luke


Last edited by ls78 on Fri Jul 11, 2008 3:41 pm; edited 1 time in total
Back to top
View user's profile Send private message
ArchCarrier



Joined: 03 Jun 2008
Posts: 27

PostPosted: Thu Jul 10, 2008 8:28 pm    Post subject: Reply with quote

I have no idea how to do this with AHK, but this site lets you create RSS feeds for websites that don't offer feeds.
Back to top
View user's profile Send private message
Krogdor



Joined: 18 Apr 2008
Posts: 1390
Location: The Interwebs

PostPosted: Thu Jul 10, 2008 8:30 pm    Post subject: Reply with quote

You could UrlDownloadToFile the web page, then, assuming there is some sort of identifier around the info you are looking for, pull the text from the file with a RegExMatch or something?
Back to top
View user's profile Send private message AIM Address
engunneer



Joined: 30 Aug 2005
Posts: 8255
Location: Maywood, IL

PostPosted: Fri Jul 11, 2008 12:35 am    Post subject: Reply with quote

it would help if you can tell us the website or a similar one.
_________________

(Common Answers)
Back to top
View user's profile Send private message Visit poster's website
ls78



Joined: 03 May 2006
Posts: 44

PostPosted: Fri Jul 11, 2008 12:53 pm    Post subject: Reply with quote

ok this its the website .


http://www.safetycameraswiltshire.co.uk/mobile.asp


cheers for your intrest
Back to top
View user's profile Send private message
n-l-i-d
Guest





PostPosted: Fri Jul 11, 2008 3:14 pm    Post subject: Reply with quote

1. Do a View Source of the webpage
2. Search your target text in the source

Code:
<p class="MsoNormal" style="MARGIN: 0pt"><a name="OLE_LINK4"></a><a name="OLE_LINK3"></a><a name="OLE_LINK1"><span style="mso-bookmark: OLE_LINK3"><span style="mso-bookmark: OLE_LINK4"><font face="Arial" size="3"><span style="FONT-SIZE: 12pt; FONT-FAMILY: Arial">A303; A36, M4, A419, A338, A346, A30, A354, A342, A360, A350, B390, A429, B4040, Swindon and Trowbridge areas.</span></font></span></span></a></p>
<span style="mso-bookmark: OLE_LINK4"></span><span style="mso-bookmark: OLE_LINK3"></span><span style="mso-bookmark: OLE_LINK1"></span>
<p class="MsoNormal" style="MARGIN: 0pt; TEXT-ALIGN: center" align="center"><font face="Arial" size="3"><span style="FONT-SIZE: 12pt; FONT-FAMILY: Arial">&nbsp;</span></font></p>


3. Find the smallest unique html before and after your target, then use something like this:

Code:
; BEWARE! Both RegEx and AHK need certain escape sequences!
;
; http://www.autohotkey.com/docs/commands/_EscapeChar.htm
; http://www.autohotkey.com/docs/misc/RegEx-QuickRef.htm
;
before := "4""><font face=""Arial"" size=""3""><span style=""FONT-SIZE: 12pt; FONT-FAMILY: Arial"">"
after := "<"

; "(.*)" is regex for: return anything in match variable as array
pattern := before . "(.*)" . after

URLDownloadToFile, http://www.safetycameraswiltshire.co.uk/mobile.asp, %A_ScriptDir%\html.tmp
FileRead, aFile, %A_ScriptDir%\html.tmp
RegExMatch(aFile, pattern, match)
MsgBox % match1


disclaimer: not tested, but should work

HTH
Back to top
ls78



Joined: 03 May 2006
Posts: 44

PostPosted: Fri Jul 11, 2008 3:39 pm    Post subject: cheers Reply with quote

hey n-l-i-d well done !


works a treat . than you very much , very nice and easy instructions ,




cheers

luke .
Back to top
View user's profile Send private message
Wouther



Joined: 01 May 2007
Posts: 83
Location: The Netherlands

PostPosted: Fri Jul 11, 2008 4:03 pm    Post subject: Reply with quote

n-l-i-d wrote:
Code:
; BEWARE! Both RegEx and AHK need certain escape sequences!
To prevent having to escape and thus easier changable in the future, you can use this: (not tested)
Code:
pattern := "\Q" . before . "\E(.*)\Q" . after . "\E"

_________________
Printing css/html-formatted text
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    AutoHotkey Community Forum Index -> Ask for Help All times are GMT
Page 1 of 1

 
Jump to:  
You can post new topics in this forum
You can reply to topics in this forum


Powered by phpBB © 2001, 2005 phpBB Group