<?xml version="1.0" encoding="UTF-8"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en-gb">
	<link rel="self" type="application/atom+xml" href="https://forum.eggheads.org/app.php/feed/topic/16744" />

	<title>egghelp/eggheads community</title>
	<subtitle>Discussion of eggdrop bots, shell accounts and tcl scripts.</subtitle>
	<link href="https://forum.eggheads.org/index.php" />
	<updated>2009-03-26T19:11:47-04:00</updated>

	<author><name><![CDATA[egghelp/eggheads community]]></name></author>
	<id>https://forum.eggheads.org/app.php/feed/topic/16744</id>

		<entry>
		<author><name><![CDATA[zerodtk]]></name></author>
		<updated>2009-03-26T19:11:47-04:00</updated>

		<published>2009-03-26T19:11:47-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=88130#p88130</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=88130#p88130"/>
		<title type="html"><![CDATA[[SOLVED] Need help with file handling - thanks nml375!]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=88130#p88130"><![CDATA[
hahahaha the solution was in front of my eyes!<br>:DDD thanks for your help <img class="smilies" src="https://forum.eggheads.org/images/smilies/icon_smile.gif" width="15" height="15" alt=":)" title="Smile">)<br><br><div class="codebox"><p>Code: </p><pre><code>proc isdupe {url} {  set r 0  if {![catch {open "scripts/ignored.txt" r} rf]} {    while {![eof $rf]} {      if {[string match -nocase *${url}* [gets $rf]]} {        set r 1        break      }    }    close $rf  }  return $r}</code></pre></div>and the ignored urls goes to the ignored.txt lol<br>thanks much for helping me out:)<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=10567">zerodtk</a> — Thu Mar 26, 2009 7:11 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[zerodtk]]></name></author>
		<updated>2009-03-26T18:00:13-04:00</updated>

		<published>2009-03-26T18:00:13-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=88129#p88129</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=88129#p88129"/>
		<title type="html"><![CDATA[[SOLVED] Need help with file handling - thanks nml375!]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=88129#p88129"><![CDATA[
thanks, the error is now gone...<br>so i just need to change ${url} to what i want to be ignored?<br><br>something like<br><div class="codebox"><p>Code: </p><pre><code>proc isdupe {url} {  set r 0  if {![catch {open "/home/zerodtk/public_html/log/index.php" r} rf]} {    while {![eof $rf]} {      if {[string match -nocase *szabadka* [gets $rf]]} {        set r 1        break      }    }    close $rf  }  return $r}</code></pre></div><p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=10567">zerodtk</a> — Thu Mar 26, 2009 6:00 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[nml375]]></name></author>
		<updated>2009-03-26T14:16:27-04:00</updated>

		<published>2009-03-26T14:16:27-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=88125#p88125</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=88125#p88125"/>
		<title type="html"><![CDATA[[SOLVED] Need help with file handling - thanks nml375!]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=88125#p88125"><![CDATA[
the isdupe proc is missing a line stating "return $r" at the end. Also, the catch:path variable is not linked to globalspace, and is not defined, so this will cause an error (caught though).<br>I'd suggest something like this:<div class="codebox"><p>Code: </p><pre><code>proc isdupe {url} {  set r 0  if {![catch {open "scripts/urllogger.txt" r} rf]} {    while {![eof $rf]} {      if {[string match -nocase *${url}* [gets $rf]]} {        set r 1        break      }    }    close $rf  }  return $r}</code></pre></div><p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=8052">nml375</a> — Thu Mar 26, 2009 2:16 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[zerodtk]]></name></author>
		<updated>2009-03-26T13:31:04-04:00</updated>

		<published>2009-03-26T13:31:04-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=88124#p88124</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=88124#p88124"/>
		<title type="html"><![CDATA[[SOLVED] Need help with file handling - thanks nml375!]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=88124#p88124"><![CDATA[
what about this one<br>came from Ofloo<br><div class="codebox"><p>Code: </p><pre><code>proc isdupe {url} {if {![catch {open $catch:path r} rf]} {set r 0while {![eof $rf]} {if {[string match -nocase *${url}* [gets $rf]]} {set r 1break} } close $rf } }</code></pre></div>and adding it where it catches the urls<br><div class="codebox"><p>Code: </p><pre><code>proc catch_url_pubm {nick host hand chan arg} {  if {[regexp -nocase {(http://[^\s]+)} $arg -&gt; url]} {if {[isdupe $url]} {return}</code></pre></div>and the error i get is <div class="codebox"><p>Code: </p><pre><code>[18:14:41] [(Angela]: [18:12] Tcl error [catch_url_pubm]: expected boolean value but got ""[18:14:44] [(Angela]: Currently: expected boolean value but got ""[18:14:44] [(Angela]: Currently: while executing[18:14:44] [(Angela]: Currently: "if {[isdupe $url]} {return}"[18:14:44] [(Angela]: Currently: (procedure "catch_url_pubm" line 3)</code></pre></div><p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=10567">zerodtk</a> — Thu Mar 26, 2009 1:31 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[zerodtk]]></name></author>
		<updated>2009-03-26T10:46:47-04:00</updated>

		<published>2009-03-26T10:46:47-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=88123#p88123</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=88123#p88123"/>
		<title type="html"><![CDATA[[SOLVED] Need help with file handling - thanks nml375!]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=88123#p88123"><![CDATA[
heya, hope you don't mind one more question...<br>how can i make it ignore its own url?<br>something like<br>*szabadka.org*<br><br>thanks in advance<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=10567">zerodtk</a> — Thu Mar 26, 2009 10:46 am</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[zerodtk]]></name></author>
		<updated>2009-03-26T08:52:12-04:00</updated>

		<published>2009-03-26T08:52:12-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=88122#p88122</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=88122#p88122"/>
		<title type="html"><![CDATA[[SOLVED] Need help with file handling - thanks nml375!]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=88122#p88122"><![CDATA[
hey! all working! everything's just fine <img class="smilies" src="https://forum.eggheads.org/images/smilies/icon_smile.gif" width="15" height="15" alt=":)" title="Smile"><br><br>thanks again<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=10567">zerodtk</a> — Thu Mar 26, 2009 8:52 am</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[zerodtk]]></name></author>
		<updated>2009-03-25T22:15:00-04:00</updated>

		<published>2009-03-25T22:15:00-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=88121#p88121</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=88121#p88121"/>
		<title type="html"><![CDATA[[SOLVED] Need help with file handling - thanks nml375!]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=88121#p88121"><![CDATA[
it works!!! thank you very much!!!<br>i can't believe it all works now <img class="smilies" src="https://forum.eggheads.org/images/smilies/icon_smile.gif" width="15" height="15" alt=":)" title="Smile"><br><br>i will put it in the full script tomorrow morning and will let you know <img class="smilies" src="https://forum.eggheads.org/images/smilies/icon_smile.gif" width="15" height="15" alt=":)" title="Smile"><br><br>thanks again!!<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=10567">zerodtk</a> — Wed Mar 25, 2009 10:15 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[nml375]]></name></author>
		<updated>2009-03-25T22:10:27-04:00</updated>

		<published>2009-03-25T22:10:27-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=88120#p88120</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=88120#p88120"/>
		<title type="html"><![CDATA[[SOLVED] Need help with file handling - thanks nml375!]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=88120#p88120"><![CDATA[
'k.. ohh, forgot, seek uses bytes, not characters.<br>Guess we'll have to do it the other way *sigh*<br><div class="codebox"><p>Code: </p><pre><code>proc catch_url_pubm {nick host hand chan arg} {  if {[regexp -nocase {(http://[^\s]+)} $arg -&gt; url]} {    if {![catch {open scripts/urllogger.txt "RDWR CREAT"} af]} {      set string [read $af]      set key "&lt;!-- post here ---&gt;"      set j [expr [string first $key $string] + [string length $key]]      set i [expr $j - 1]      set first [string range $string 0 $i]      set last [string range $string $j end]      seek $af 0 start      puts -nonewline $af "${first}\n${url}\n${last}"      close $af    }  }}bind pubm -|- *http* catch_url_pubm</code></pre></div><p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=8052">nml375</a> — Wed Mar 25, 2009 10:10 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[zerodtk]]></name></author>
		<updated>2009-03-25T21:58:54-04:00</updated>

		<published>2009-03-25T21:58:54-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=88119#p88119</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=88119#p88119"/>
		<title type="html"><![CDATA[[SOLVED] Need help with file handling - thanks nml375!]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=88119#p88119"><![CDATA[
i think we are in the finish..<br>but there's one more thing<br><div class="codebox"><p>Code: </p><pre><code>header goes here&lt;!-- post here ---http://www.google.com/footer goes here</code></pre></div>the last &gt; from &lt;!-- post here ---&gt; is missing...<br>everything else is just fine <img class="smilies" src="https://forum.eggheads.org/images/smilies/icon_smile.gif" width="15" height="15" alt=":)" title="Smile"><p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=10567">zerodtk</a> — Wed Mar 25, 2009 9:58 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[nml375]]></name></author>
		<updated>2009-03-25T21:54:22-04:00</updated>

		<published>2009-03-25T21:54:22-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=88118#p88118</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=88118#p88118"/>
		<title type="html"><![CDATA[[SOLVED] Need help with file handling - thanks nml375!]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=88118#p88118"><![CDATA[
Actually, I do spot a flaw in my code. But it should produce an entirely different behaviour to what you are describing.<br><br>'k.. after a few minutes of thinking.. the problem at hand, is that you're opening the file in append-mode. That basically means that the file pointer is set to the end of the file... reading the file thus returns nothing. Opening the file in normal read/write mode solves that issue. I also removed some double-work I did in my first post.<br><br>The code below should behave properly.<div class="codebox"><p>Code: </p><pre><code>proc catch_url_pubm {nick host hand chan arg} {  if {[regexp -nocase {(http://[^\s]+)} $arg -&gt; url]} {    if {![catch {open scripts/urllogger.txt "RDWR CREAT"} af]} {      set string [read $af]      set key "&lt;!-- post here ---&gt;"      set j [expr [string first $key $string] + [string length $key]]      set last [string range $string $j end]      seek $af $j start      puts -nonewline $af "\n${url}${last}"      close $af    }  }}bind pubm -|- *http* catch_url_pubm</code></pre></div><p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=8052">nml375</a> — Wed Mar 25, 2009 9:54 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[zerodtk]]></name></author>
		<updated>2009-03-25T21:36:40-04:00</updated>

		<published>2009-03-25T21:36:40-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=88117#p88117</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=88117#p88117"/>
		<title type="html"><![CDATA[[SOLVED] Need help with file handling - thanks nml375!]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=88117#p88117"><![CDATA[
it was set to w+ not a+<br>actually its not deleting the header now<br>but deletes the &lt;!-- post here ---&gt; and the first few characters of the footer..<br><div class="codebox"><p>Code: </p><pre><code>proc catch_url_pubm {nick host hand chan arg} {  if {[regexp -nocase {(http://[^\s]+)} $arg -&gt; url]} {    if {![catch {open scripts/urllogger.txt "a+"} af]} {set string [read $af]set key "&lt;!-- post here ---&gt;"set j [expr [string first $key $string] + [string length $key]]set i [expr $j - 1]set first [string range $string 0 $i]set last [string range $string $j end]seek $af $jputs -nonewline $af "$first $url $last"#puts $af "$url" close $af} } }bind pubm -|- *http* catch_url_pubm</code></pre></div><br>it was<div class="codebox"><p>Code: </p><pre><code>header goes here&lt;!-- post here ---&gt;footer goes here</code></pre></div>and now<div class="codebox"><p>Code: </p><pre><code>header goes here http://www.google.com/ ter</code></pre></div><p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=10567">zerodtk</a> — Wed Mar 25, 2009 9:36 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[nml375]]></name></author>
		<updated>2009-03-25T21:22:16-04:00</updated>

		<published>2009-03-25T21:22:16-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=88116#p88116</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=88116#p88116"/>
		<title type="html"><![CDATA[[SOLVED] Need help with file handling - thanks nml375!]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=88116#p88116"><![CDATA[
That's odd..<br>I missed including the file pointer in the puts-line, but that shouldn't wipe your file.. (updated post to fix that though)<br><br>Do you think you could post your implementation of my code?<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=8052">nml375</a> — Wed Mar 25, 2009 9:22 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[zerodtk]]></name></author>
		<updated>2009-03-25T21:11:59-04:00</updated>

		<published>2009-03-25T21:11:59-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=88115#p88115</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=88115#p88115"/>
		<title type="html"><![CDATA[[SOLVED] Need help with file handling - thanks nml375!]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=88115#p88115"><![CDATA[
the error is now gone<br>this what happens<br><br>the file looks like<div class="codebox"><p>Code: </p><pre><code>header goes here&lt;!-- post here ---&gt;footer goes here</code></pre></div>instead of putting the post between &lt;!-- post here ---&gt; and footer<br>it looks like<div class="codebox"><p>Code: </p><pre><code>                  &lt;!-- post here ---&gt; http://www.google.com/2</code></pre></div>it deletes the footer and the header too <img class="smilies" src="https://forum.eggheads.org/images/smilies/icon_sad.gif" width="15" height="15" alt=":(" title="Sad"><br><br>and just changes the current link to another after adding a new one...<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=10567">zerodtk</a> — Wed Mar 25, 2009 9:11 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[nml375]]></name></author>
		<updated>2009-03-25T20:57:23-04:00</updated>

		<published>2009-03-25T20:57:23-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=88114#p88114</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=88114#p88114"/>
		<title type="html"><![CDATA[[SOLVED] Need help with file handling - thanks nml375!]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=88114#p88114"><![CDATA[
Ahh...<br>Guess I edited my code once too many, I'll update my previous post in a sec<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=8052">nml375</a> — Wed Mar 25, 2009 8:57 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[zerodtk]]></name></author>
		<updated>2009-03-25T20:38:33-04:00</updated>

		<published>2009-03-25T20:38:33-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=88112#p88112</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=88112#p88112"/>
		<title type="html"><![CDATA[[SOLVED] Need help with file handling - thanks nml375!]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=88112#p88112"><![CDATA[
it was my mistake...<br>.set errorInfo worked<br><div class="codebox"><p>Code: </p><pre><code>[01:37:46] [(Angela]: [01:35] #z3r0# set errorInfo[01:37:46] [(Angela]: Currently: wrong # args: should be "set varName ?newValue?"[01:37:46] [(Angela]: Currently: while executing[01:37:46] [(Angela]: Currently: "set j [string first $key $string] + [string length $key]]"[01:37:46] [(Angela]: Currently: (procedure "catch_url_pubm" line 6)[01:37:46] [(Angela]: Currently: invoked from within[01:37:46] [(Angela]: Currently: "catch_url_pubm $_pubm1 $_pubm2 $_pubm3 $_pubm4 $_pubm5"</code></pre></div><p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=10567">zerodtk</a> — Wed Mar 25, 2009 8:38 pm</p><hr />
]]></content>
	</entry>
	</feed>
