AutoHotkey Community

It is currently May 26th, 2012, 8:48 pm

All times are UTC [ DST ]




Post new topic Reply to topic  [ 3 posts ] 
Author Message
PostPosted: August 30th, 2009, 6:25 pm 
Offline

Joined: August 30th, 2009, 8:34 am
Posts: 5
Code:

UrlDownloadToFile,%Url%,%Name%-Status.txt
FileRead,html,%Name%-Status.txt
Loop,Parse,html,`n
{
IfInString,A_LoopField,AccountGadget_Handle
{
RegExMatch(A_LoopField,">[^<]+",CL_Name)
StringTrimLeft,CL_Name,CL_Name,1
}
IfInString,A_LoopField,TicketBalance
{
RegExMatch(A_LoopField,"TicketBalance[^<]+",CTix)
StringTrimLeft,CTix,CTix,15
StringReplace,CTix,CTix,`,
}
}


Key parts I don't understand are :

RegExMatch(A_LoopField,">[^<]+",CL_Name) ; in particular the >[^<]+ part

RegExMatch(A_LoopField,"TicketBalance[^<]+",CTix) ; in particular the ,"TicketBalance[^<]+", part

I'm essentially new to ahk and a friend gave me this code to build off of and "learn" how ahk works. I have programming experience, but I've never seen a parsing method like this. I can supply the txt file that this is originally designed for if needed.


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: August 30th, 2009, 9:49 pm 
Offline

Joined: August 30th, 2009, 5:14 pm
Posts: 10
assuming that's the standard regexp implementation, and >[^<]+ is the regex you're trying to match, what that means is

match a >

follows by at least one or more characters that is NOT <

example: given a string

<a href="foo.html">click</a>

that will match

>click


TicketBalance[^<]+ will match the word TicketBalance followed by at least one or more character that is not <


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: August 31st, 2009, 1:56 am 
Offline

Joined: August 30th, 2009, 8:34 am
Posts: 5
THANKS = )

I was able to adapt it for my use


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

All times are UTC [ DST ]


Who is online

Users browsing this forum: Bing [Bot], BrandonHotkey, coinman, Google [Bot], joetazz, Leef_me, Yahoo [Bot] and 59 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