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 

regex question

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



Joined: 30 Apr 2006
Posts: 207
Location: Shigle Springs

PostPosted: Fri Aug 22, 2008 6:11 pm    Post subject: regex question Reply with quote

Hi, some dork keeps flagging me on craigslist.com
When its flagged
Code:

<tr bgcolor="lightgreen">
<td>808053324</td>

turns into
Code:

<tr bgcolor="pink">
<td>808053324</td>




Somethiing like this...
Code:

filedelete, %a_temp%\cl.txt
InputBox, pid, What is your PostingID?, Please enter your postingID to watch., , 140, 180
loop,
{
sleep, 60000
URLDownloadToFile, https://accounts.craigslist.org/login, %a_temp%\cl.txt

;unknown fileread and regex code I need help with :?

IfEqual, var_from_regex_above, pink
break
}
msgbox, the dork flagged my ad again
reload


Thank you
_________________
CPULOCK.com
virusSWAT.com
GuaranteedPCFIX.com
911PCFIX.com
Back to top
View user's profile Send private message Visit poster's website
DeWild1



Joined: 30 Apr 2006
Posts: 207
Location: Shigle Springs

PostPosted: Fri Aug 22, 2008 9:29 pm    Post subject: Reply with quote

bump
_________________
CPULOCK.com
virusSWAT.com
GuaranteedPCFIX.com
911PCFIX.com
Back to top
View user's profile Send private message Visit poster's website
Serenity



Joined: 07 Nov 2004
Posts: 1276

PostPosted: Fri Aug 22, 2008 11:21 pm    Post subject: Reply with quote

Use FileRead to read the file into a variable, eg:

Code:
filedelete, %a_temp%\cl.txt
InputBox, pid, What is your PostingID?, Please enter your postingID to watch., , 140, 180
loop,
{
   sleep, 60000
   URLDownloadToFile, https://accounts.craigslist.org/login, %a_temp%\cl.txt

   FileRead, cl, %a_temp%\cl.txt
   if RegExMatch(cl,"pink")
      break      
}
msgbox, the dork flagged my ad again
reload


You can also use InStr() or IfInString instead of RegExMatch().
_________________
"Anything worth doing is worth doing slowly." - Mae West
Back to top
View user's profile Send private message Visit poster's website
DeWild1



Joined: 30 Apr 2006
Posts: 207
Location: Shigle Springs

PostPosted: Sat Aug 23, 2008 12:33 am    Post subject: Reply with quote

Thank you very much but that will not work Crying or Very sad
The url is full of "pink" so it would I go off every time.
I am not sure if it is possible, but regex does work with items on the same line but I need it to work on the line after...

<p>&nbsp;</p>

<table cellpadding="2" width="100%">
<tr>
<td><b>232</b> most recent postings<br>
<small>of <b>2000</b> maximum returned &nbsp;&nbsp;[<a href="/login/actstg">change</a>]</small><br>
<small></small><br>
</td>
<td>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</td>
<td align="right">
<table>
<tr>
<td>[&nbsp;</td>
<td bgcolor="lightgreen">active</td>
<td bgcolor="lightgrey">pending</td>
<td bgcolor="lightblue">removed by me</td>
<td bgcolor="#cc99ff">expired</td>
<td bgcolor="pink">flagged/deleted</td>
<td>&nbsp;]</td>
</tr>
</table>
</td>
</tr>
<tr>
<td colspan="3"><font size="2" color="orange">regardless of status (active, expired, deleted), all posts will appear on this list. we are not able to offer a removal option at this time.</font></td>
</tr>
</table>
<p>

<table border="0" cellpadding="3" width="100%">
<tr bgcolor="#cccccc">
<th>ID</th>
<th>Date</th>
<th>Site</th>
<th>Category</th>
<th>Title</th>
<th>Fee</th>
</tr>
<tr bgcolor="pink">
<td>808342989</td>
<td nowrap>Aug 22 08</td>
<td nowrap>sac</td>
<td nowrap>computer services</td>
<td nowrap><a href="/post/shwpst?pii=808342989&amp;db=lv">$48.5 to fit it ALL!</a></td>
<td></td>
</tr>
<tr bgcolor="pink">
<td>806709593</td>
<td nowrap>Aug 21 08</td>
<td nowrap>sac</td>
<td nowrap>computer services</td>
<td nowrap><a href="/post/shwpst?pii=806709593&amp;db=lv">$48.50 flat rate</a></td>
<td></td>
</tr>
<tr bgcolor="pink">
<td>806529788</td>
<td nowrap>Aug 21 08</td>
<td nowrap>sac</td>
<td nowrap>computer services</td>
<td nowrap><a href="/post/shwpst?pii=806529788&amp;db=lv">All for $40</a></td>
<td></td>
</tr>
<tr bgcolor="pink">
<td>773460485</td>
<td nowrap>Jul 28 08</td>
<td nowrap>sac</td>
<td nowrap>computers & tech</td>
<td nowrap><a href="/post/shwpst?pii=773460485&amp;db=lv">*NEW* PC with a one YEAR guarantee for EVERYTHING!! Software+Hardware!</a></td>
<td></td>
</tr>
_________________
CPULOCK.com
virusSWAT.com
GuaranteedPCFIX.com
911PCFIX.com
Back to top
View user's profile Send private message Visit poster's website
[VxE]



Joined: 07 Oct 2006
Posts: 1496

PostPosted: Sat Aug 23, 2008 1:09 am    Post subject: Reply with quote

How about a parsing loop?
Code:
Fileread, blah, c:\yourfile.htm
Loop, Parse, blah, `n, `r
   If InStr(A_LoopReadLine, "<td>808342989</td>")
      && InStr(PreviousLine, "<tr bgcolor=""""pink"""">"
; use 4 double quotes inside a literal string to represent a literal double quote.
      MsgBox Neener neener! U R FlAgGeD!!!
   else
      PreviousLine := A_LoopReadLine

_________________
My Home Thread
More Common Answers: [1]. It's in the FAQ [2]. Ternary ( a ? b : c ) guide [3]. Post code inside [code][/code] tags !
Back to top
View user's profile Send private message
DeWild1



Joined: 30 Apr 2006
Posts: 207
Location: Shigle Springs

PostPosted: Sat Aug 23, 2008 4:03 am    Post subject: Reply with quote

LOL, I will try it, thank you. I love learning!
_________________
CPULOCK.com
virusSWAT.com
GuaranteedPCFIX.com
911PCFIX.com
Back to top
View user's profile Send private message Visit poster's website
[VxE]



Joined: 07 Oct 2006
Posts: 1496

PostPosted: Sat Aug 23, 2008 4:21 am    Post subject: Reply with quote

Whoops, I messed up. It should only be two consecutive double quotes to get one of them in a string. My mistake Razz
Code:
msgbox % "I said ""oops"""

_________________
My Home Thread
More Common Answers: [1]. It's in the FAQ [2]. Ternary ( a ? b : c ) guide [3]. Post code inside [code][/code] tags !
Back to top
View user's profile Send private message
DeWild1



Joined: 30 Apr 2006
Posts: 207
Location: Shigle Springs

PostPosted: Sat Aug 23, 2008 6:59 am    Post subject: Reply with quote

Its OK, I am drunk....
This don't work...
Code:

filedelete, %a_temp%\cl.txt
InputBox, pid, What is your PostingID?, Please enter your postingID to watch., , 140, 180
loop,
{
   sleep, 60000
   URLDownloadToFile, https://accounts.craigslist.org/login, %a_temp%\cl.txt


Fileread, blah, %a_temp%\cl.txt
Loop, Parse, blah, `n, `r
   If InStr(A_LoopReadLine, "%pid%")
      && InStr(PreviousLine, "pink" )
; use 4 double quotes inside a literal string to represent a literal double quote.
      break
   else
      PreviousLine := A_LoopReadLine
}
msgbox, the dork flagged my ad again
reload





_________________
CPULOCK.com
virusSWAT.com
GuaranteedPCFIX.com
911PCFIX.com
Back to top
View user's profile Send private message Visit poster's website
[VxE]



Joined: 07 Oct 2006
Posts: 1496

PostPosted: Sat Aug 23, 2008 7:09 am    Post subject: Reply with quote

Well... try not to code while drunk... it makes for worse hangovers.

Code:
filedelete, %a_temp%\cl.txt
InputBox, pid, What is your PostingID?, Please enter your postingID to watch., , 140, 180
loop,
{
   sleep, 60000
   URLDownloadToFile, https://accounts.craigslist.org/login, %a_temp%\cl.txt


Fileread, blah, %a_temp%\cl.txt
Loop, Parse, blah, `n, `r
   If InStr(A_LoopReadLine, pid)
      && InStr(PreviousLine, "pink" )
; use 2 double quotes inside a literal string to represent a literal double quote.
      break
   else
      PreviousLine := A_LoopReadLine
}
msgbox, the dork flagged my ad again
reload

_________________
My Home Thread
More Common Answers: [1]. It's in the FAQ [2]. Ternary ( a ? b : c ) guide [3]. Post code inside [code][/code] tags !
Back to top
View user's profile Send private message
DeWild1



Joined: 30 Apr 2006
Posts: 207
Location: Shigle Springs

PostPosted: Sat Aug 23, 2008 4:36 pm    Post subject: Reply with quote

LOL
It did not work but I tried until I was blue in the face, Rolling Eyes but then realized it was always on line 636 Laughing Shocked Very Happy
This works.
Thank you for your help.

Code:



start:
Loop,
{
filedelete, %a_temp%\cl.txt

sleep, 30000
URLDownloadToFile, https://accounts.craigslist.org/login, %a_temp%\cl.txt
FileReadLine, blah, %a_temp%\cl.txt, 636


   If InStr "pink"
      goto, end
   else
      goto, start
}

end:
msgbox, the dork flagged my ad again
sleep, 480000 ;give you some time to repost.. You may need to increase
goto, start

_________________
CPULOCK.com
virusSWAT.com
GuaranteedPCFIX.com
911PCFIX.com
Back to top
View user's profile Send private message Visit poster's website
Display posts from previous:   
Post new topic   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