<?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/19407" />

	<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>2013-04-23T06:56:23-04:00</updated>

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

		<entry>
		<author><name><![CDATA[delinquent]]></name></author>
		<updated>2013-04-23T06:56:23-04:00</updated>

		<published>2013-04-23T06:56:23-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=101442#p101442</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=101442#p101442"/>
		<title type="html"><![CDATA[fileorganizer.tcl]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=101442#p101442"><![CDATA[
<div class="codebox"><p>Code: </p><pre><code># EditTextFile Version 0.3 ## author:  SpiKe^^ ## e-mail:  spike&lt;at&gt;mytclscripts&lt;dot&gt;com ## webpage: http://mytclscripts.com/ ## This file is Copyrighted under the GNU Public License. ## http://www.gnu.org/copyleft/gpl.html ############  Begin Settings ############ set the full route &amp; file name of the file to edit #set eTxFile(file) {/usr/home/spike/eggdrop/scripts/filename.txt}# set the channel for this script to run in #set eTxFile(chan) {#yourchannel}# set the public trigger for the add line command #set eTxFile(add) {!addline}# set the public trigger for the read line command #set eTxFile(read) {!readline}# set the public trigger for the edit line command #set eTxFile(edit) {!editline}# set the access flags to use the above public commands #set eTxFile(flags) {o|o}############  End Settings ############bind pub $eTxFile(flags) $eTxFile(add) etfProcAddbind pub $eTxFile(flags) $eTxFile(read) etfProcReadbind pub $eTxFile(flags) $eTxFile(edit) etfProcEditproc etfProcAdd {nk uh hn ch tx} {  if {[string tolower $ch] ne [string tolower $::eTxFile(chan)]} { return }  set tf $::eTxFile(file)  if {![file exists $tf]} {    puthelp "PRIVMSG $ch :Text file does not exist: $tf"    return  }  set tx [string trim $tx]  if {$tx eq ""} {    puthelp "PRIVMSG $ch :Correct syntax is: $::eTxFile(add) text to add to the end of the file."    return  }  puthelp "PRIVMSG $ch :Adding: $tx :to file: [file tail $tf]"  set id [open $tf a]  puts $id $tx  close $id  return}proc etfProcRead {nk uh hn ch tx} {  if {[string tolower $ch] ne [string tolower $::eTxFile(chan)]} { return }  set tf $::eTxFile(file)  if {![file exists $tf]} {    puthelp "PRIVMSG $ch :Text file does not exist: $tf"    return  }  set tx [string trim $tx]  if {![string is digit -strict $tx]} {    puthelp "PRIVMSG $ch :Correct syntax is: $::eTxFile(read) line#"    return  }  set tid [open $tf]  set lnum 0  while {![eof $tid]} {    set line [gets $tid]    if {$line ne ""} {  incr lnum      if {$lnum==$tx} {        puthelp "PRIVMSG $ch :Existing line $lnum text: $line"        break      }    }  }  close $tid  if {$tx&gt;$lnum} {    puthelp "PRIVMSG $ch :File line $tx doesn't exist ($lnum lines in the file)"  }  return}proc etfProcEdit {nk uh hn ch tx} {  if {[string tolower $ch] ne [string tolower $::eTxFile(chan)]} { return }  set tf $::eTxFile(file)  if {![file exists $tf]} {    puthelp "PRIVMSG $ch :Text file does not exist: $tf"    return  }  set tx [split [string trim $tx]]  if {[llength $tx]&lt;"2" || ![string is digit -strict [lindex $tx 0]]} {    puthelp "PRIVMSG $ch :Correct syntax is: $::eTxFile(edit) line# text to replace original line."    return  }  set find [lindex $tx 0]  set tx [string trim [join [lrange $tx 1 end]]]  set new [file dirname $tf]/newfile.tmp  set nid [open $new w]  set tid [open $tf]  set lnum 0  while {![eof $tid]} {    set line [gets $tid]    if {$line ne ""} {  incr lnum      if {$lnum==$find} {        puthelp "PRIVMSG $ch :Replacing existing line $lnum text: $line"        puthelp "PRIVMSG $ch :with the new text line: $tx"        puts $nid $tx      } else {  puts $nid $line  }    }  }  close $nid  ;  close $tid  if {$find&gt;$lnum} {    puthelp "PRIVMSG $ch :File line $find doesn't exist ($lnum lines in the file)"    file delete $new  } else {  file rename -force $new $tf  }  return} </code></pre></div>This one is good ... only some small changes .. like ..<br>instead of !addline !readline !editline there must be <br><div class="codebox"><p>Code: </p><pre><code>&lt;+delinquent&gt; !readfile&lt;@Eggdrop&gt; Reading file filename :&lt;@Eggdrop&gt; 1. AliciaKeys | 2. Nas 2 | 3. Drake 3 | 4. Rihanna&lt;@Eggdrop&gt; 5. TwilightSucks | 6. MeganFox | 7. BreakingBad | 8. Supernatural&lt;@Eggdrop&gt; 9. Barney | 10. Fabolous | 11. Eleven | 12. Kanyw &lt;+delinquent&gt; !delline 5&lt;@Eggdrop&gt; Deleted line number 5 in file filename [ TwilightSucks ]&lt;+delinquent&gt; !addline Justin Bieber sucks&lt;@Eggdrop&gt; Added line number 12 in file dilename [ Justin Bieber sucks ] </code></pre></div>1. 2. 3. 4. 5. being the lines in the file .... the lines being small i figured that the eggdrop could put 3 or 4 lines in one sentence ... so if i type !readfile ... and there are 60 lines in the file ... the eggdrop would`t ping timeout ...<br><br>i suck at scripting .. that why i ask for so much help ... <br><br>Thanks !<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=12188">delinquent</a> — Tue Apr 23, 2013 6:56 am</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[SpiKe^^]]></name></author>
		<updated>2013-04-22T18:21:44-04:00</updated>

		<published>2013-04-22T18:21:44-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=101439#p101439</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=101439#p101439"/>
		<title type="html"><![CDATA[fileorganizer.tcl]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=101439#p101439"><![CDATA[
Try this forum string for a couple of scripts for working with text files...<br><a href="http://forum.egghelp.org/viewtopic.php?p=101119#101119" class="postlink">http://forum.egghelp.org/viewtopic.php?p=101119#101119</a><br><br>If one of them is close, maybe it could be edited to your liking.<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=7749">SpiKe^^</a> — Mon Apr 22, 2013 6:21 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[delinquent]]></name></author>
		<updated>2013-04-22T09:32:44-04:00</updated>

		<published>2013-04-22T09:32:44-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=101434#p101434</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=101434#p101434"/>
		<title type="html"><![CDATA[fileorganizer.tcl]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=101434#p101434"><![CDATA[
Hello <img class="smilies" src="https://forum.eggheads.org/images/smilies/icon_smile.gif" width="15" height="15" alt=":)" title="Smile"><br><br>I am looking for a tcl that dows this<div class="codebox"><p>Code: </p><pre><code>&lt;+delinquent&gt; !filelist -list&lt;@Eggdrop&gt; Listing file database :&lt;@Eggdrop&gt; 1. AliciaKeys | 2. Nas 2 | 3. Drake 3 | 4. Rihanna&lt;@Eggdrop&gt; 5. TwilightSucks | 6. MeganFox | 7. BreakingBad | 8. Supernatural&lt;@Eggdrop&gt; 9. Barney | 10. Fabolous | 11. Eleven | 12. Kanyw</code></pre></div>line 1 , line 2 , line 3 ... etc .. these are the lines in the file from /folder/database<div class="codebox"><p>Code: </p><pre><code>&lt;+delinquent&gt; !filelist -delete 5&lt;@Eggdrop&gt; Deleted line number 5 in file database [ TwilightSucks ]&lt;+delinquent&gt; !filelist -add Justin Bieber sucks&lt;@Eggdrop&gt; Added line number 12 in file database [ Justin Bieber sucks ]</code></pre></div>The tricky part will probably be when i erase lets say line nr 5 .. then the list changes becouse 6 becomes 5 , 7 becomes 6 and so on ..<br><br>I hope its doable ....<br><br>Thanks a lot in advance !<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=12188">delinquent</a> — Mon Apr 22, 2013 9:32 am</p><hr />
]]></content>
	</entry>
	</feed>
