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 

What does this script (loop) do completely?

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



Joined: 30 Aug 2009
Posts: 5

PostPosted: Sun Aug 30, 2009 5:25 pm    Post subject: What does this script (loop) do completely? Reply with quote

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.
Back to top
View user's profile Send private message AIM Address
barty



Joined: 30 Aug 2009
Posts: 10

PostPosted: Sun Aug 30, 2009 8:49 pm    Post subject: Reply with quote

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 <
Back to top
View user's profile Send private message
mattandmatt2000



Joined: 30 Aug 2009
Posts: 5

PostPosted: Mon Aug 31, 2009 12:56 am    Post subject: Reply with quote

THANKS = )

I was able to adapt it for my use
Back to top
View user's profile Send private message AIM Address
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