AutoHotkey Community

It is currently May 26th, 2012, 9:01 am

All times are UTC [ DST ]




Post new topic Reply to topic  [ 8 posts ] 
Author Message
PostPosted: July 10th, 2008, 9:24 pm 
Offline

Joined: May 3rd, 2006, 5:53 pm
Posts: 44
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 July 11th, 2008, 4:41 pm, edited 1 time in total.

Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: July 10th, 2008, 9:28 pm 
Offline

Joined: June 3rd, 2008, 6:44 pm
Posts: 27
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.


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: July 10th, 2008, 9:30 pm 
Offline

Joined: April 18th, 2008, 7:57 am
Posts: 1390
Location: The Interwebs
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?


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: July 11th, 2008, 1:35 am 
Offline
User avatar

Joined: August 30th, 2005, 8:43 pm
Posts: 8666
Location: Salem, MA
it would help if you can tell us the website or a similar one.

_________________
Image
(Common Answers) - New Tutorials Forum - Humongous FAQ


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: July 11th, 2008, 1:53 pm 
Offline

Joined: May 3rd, 2006, 5:53 pm
Posts: 44
ok this its the website .


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


cheers for your intrest


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: July 11th, 2008, 4:14 pm 
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


Report this post
Top
  
Reply with quote  
 Post subject: cheers
PostPosted: July 11th, 2008, 4:39 pm 
Offline

Joined: May 3rd, 2006, 5:53 pm
Posts: 44
hey n-l-i-d well done !


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




cheers

luke .


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: July 11th, 2008, 5:03 pm 
Offline

Joined: May 1st, 2007, 8:36 pm
Posts: 83
Location: The Netherlands
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


Report this post
Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 8 posts ] 

All times are UTC [ DST ]


Who is online

Users browsing this forum: fusion1920, kkkddd1, poserpro, Yahoo [Bot] and 63 guests


You can post new topics in this forum
You can reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Powered by phpBB® Forum Software © phpBB Group