AutoHotkey Community

It is currently May 24th, 2012, 9:26 pm

All times are UTC [ DST ]




Post new topic Reply to topic  [ 4 posts ] 
Author Message
PostPosted: April 2nd, 2007, 7:47 am 
Offline

Joined: May 28th, 2006, 1:00 pm
Posts: 31
Links to tutorials....please. I have blown up the search feature on this forum trying to learn RegExMatch. Many of the post are in my non native language and therefore were not to helpful for someone that doesn't understand this function even after reading the help manual and every linked word associated within the manual.

What I am trying to accomplish is taking the below quote from a URLDownloadToFile of a php file and parse out the o/s htm file names (which changes on updates) and create a variable which I can plug into a URLDownloadToFile as in example: http://www.testsite.com/project/testarea/wc003900.htm in order to obtain that file.

Quote:
<li><a href="project/testarea/wc0003900.htm">Remote Client v3.900 for Windows</a> Filename: wc003900.htm<br>
<li><a href="project/testarea/lc003900.htm">Remote Client v3.900 for Linux</a> Filename: lc003900.htm<br>


Prior too this I was using a totally unpreferred method of listing out the increments one by one and deleting them based on file size using ifgreater which left my script very redundant.
Code:
URLDownloadToFile, http://www.testsite.com/project/testarea/wc003898.htm, C:\Program Files\AutoHotkey\temp\wc003898.htm
URLDownloadToFile, http://www.testsite.com/project/testarea/wc003899.htm, C:\Program Files\AutoHotkey\temp\wc003899.htm
URLDownloadToFile, http://www.testsite.com/project/testarea/wc003900.htm, C:\Program Files\AutoHotkey\temp\wc003900.htm
Loop C:\Program Files\AutoHotkey\temp\*.htm,0,1
{
IfGreater,A_LoopFileSize,600000, Continue
FileDelete, %A_LoopFileLongPath%
}
I know it's a dumb method but when you don't understand the help file you have to do what you have to do. Now, I'm looking to try to understand the proper way to accomplish the task via an extented tutorial or someone who will actually take the time to explain each section of the code that they post. I have a few more things I would like to try to do, but until I get the basic concept I'm dead in the water.


Report this post
Top
 Profile  
Reply with quote  
PostPosted: April 2nd, 2007, 8:35 am 
Offline

Joined: August 13th, 2006, 6:45 am
Posts: 354
Location: Germany
Hi, why do not try another way:

Code:
data =
(
<li><a href="project/testarea/wc0003900.htm">Remote Client v3.900 for Windows</a>
<li><a href="project/testarea/lc003900.htm">Remote Client v3.900 for Linux</a>
)

search_start = /testarea/
search_end = "
stringlen, search_len, search_start

loop
{
   stringgetpos, pos, data, %search_start%, , pos
   pos++
   if (pos = 0)
      break
   stringgetpos, pos2, data, %search_end%, , pos
   pos2++
   stringmid, filename, data, pos + search_len, pos2 - pos - search_len
   msgbox, % filename
   pos := pos2
}


Hubert


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: April 2nd, 2007, 10:19 am 
Offline

Joined: May 28th, 2006, 1:00 pm
Posts: 31
hd0202

Thank you sir for the reply. I was able to take your example and idea and work it into my project with success with very few changes to the msgbox code and to use URLDownloadToFile for that filename output.

I thank you for assisting me, and showing me a new approach. It's very clear I'm not very good with this but I still strive to learn. Thank you again. This community is very kind and helpful. I will bookmark this post as a tutorial for later use in another area for my reference. Hopefully a moderator will not delete due to such a quick reply and workaround.


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: April 2nd, 2007, 1:45 pm 
Offline

Joined: November 13th, 2004, 4:08 am
Posts: 2951
Location: Minnesota
AbsolutePressure wrote:
Hopefully a moderator will not delete due to such a quick reply and workaround.


You don't need to worry about that. :wink:

As for a RegEx tutorial, we currently believe that the brief one we have now is within the scope of what AutoHotkey's documentation should provide. We'd love your input, though, so if you think there are ways it could be improved or broadened while keeping it relatively short, feel free to post in Wish List.

Also, the RegEx used in AutoHotkey is based on PCRE, so any PCRE or Perl tutorial would be applicable to our expressions as well.


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

All times are UTC [ DST ]


Who is online

Users browsing this forum: Cerberus, crazyace, engunneer, janopn, Pulover, TheDewd, Xx7 and 64 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