 |
AutoHotkey Community Let's help each other out
|
| View previous topic :: View next topic |
| Author |
Message |
DeWild1
Joined: 30 Apr 2006 Posts: 207 Location: Shigle Springs
|
Posted: Fri Aug 22, 2008 6:11 pm Post subject: regex question |
|
|
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 |
|
 |
DeWild1
Joined: 30 Apr 2006 Posts: 207 Location: Shigle Springs
|
|
| Back to top |
|
 |
Serenity
Joined: 07 Nov 2004 Posts: 1276
|
Posted: Fri Aug 22, 2008 11:21 pm Post subject: |
|
|
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 |
|
 |
DeWild1
Joined: 30 Apr 2006 Posts: 207 Location: Shigle Springs
|
Posted: Sat Aug 23, 2008 12:33 am Post subject: |
|
|
Thank you very much but that will not work
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> </p>
<table cellpadding="2" width="100%">
<tr>
<td><b>232</b> most recent postings<br>
<small>of <b>2000</b> maximum returned [<a href="/login/actstg">change</a>]</small><br>
<small></small><br>
</td>
<td> </td>
<td align="right">
<table>
<tr>
<td>[ </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> ]</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&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&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&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&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 |
|
 |
[VxE]
Joined: 07 Oct 2006 Posts: 1496
|
Posted: Sat Aug 23, 2008 1:09 am Post subject: |
|
|
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 |
|
 |
DeWild1
Joined: 30 Apr 2006 Posts: 207 Location: Shigle Springs
|
|
| Back to top |
|
 |
[VxE]
Joined: 07 Oct 2006 Posts: 1496
|
Posted: Sat Aug 23, 2008 4:21 am Post subject: |
|
|
Whoops, I messed up. It should only be two consecutive double quotes to get one of them in a string. My mistake | 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 |
|
 |
DeWild1
Joined: 30 Apr 2006 Posts: 207 Location: Shigle Springs
|
Posted: Sat Aug 23, 2008 6:59 am Post subject: |
|
|
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 |
|
 |
[VxE]
Joined: 07 Oct 2006 Posts: 1496
|
Posted: Sat Aug 23, 2008 7:09 am Post subject: |
|
|
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 |
|
 |
DeWild1
Joined: 30 Apr 2006 Posts: 207 Location: Shigle Springs
|
Posted: Sat Aug 23, 2008 4:36 pm Post subject: |
|
|
LOL
It did not work but I tried until I was blue in the face, but then realized it was always on line 636
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 |
|
 |
|
|
You can post new topics in this forum You can reply to topics in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|