This is the new home of the egghelp.org community forum.
All data has been migrated (including user logins/passwords) to a new phpBB version.


For more information, see this announcement post. Click the X in the top right-corner of this box to dismiss this message.

posting from txt file

Requests for complete scripts or modifications/fixes for scripts you didn't write. Response not guaranteed, and no thread bumping!
Post Reply
V
Votex
Voice
Posts: 23
Joined: Sat Jun 21, 2014 6:52 pm

posting from txt file

Post by Votex »

Hello there, could someone please help me making a tcl script that can post txt , urls from txt file that another app (corn job) will do on the same server

also i need the post be timed
like between each post and another will be like 3 mins or so.

also i want the this tcl to mark each txt or url the bot post to be like posted
and never posted it again .

if someone could help me with that, it would be great .
thank you . :D
User avatar
SpiKe^^
Owner
Posts: 831
Joined: Fri May 12, 2006 10:20 pm
Location: Tennessee, USA
Contact:

Post by SpiKe^^ »

See if you can get the file read to your channel with this script -> http://forum.egghelp.org/viewtopic.php?t=19179
Use one of the last 2 examples in that string, depending on your tcl version.
SpiKe^^

Get BogusTrivia 2.06.4.7 at www.mytclscripts.com
or visit the New Tcl Acrhive at www.tclarchive.org
.
V
Votex
Voice
Posts: 23
Joined: Sat Jun 21, 2014 6:52 pm

Post by Votex »

SpiKe^^ wrote:See if you can get the file read to your channel with this script -> http://forum.egghelp.org/viewtopic.php?t=19179
Use one of the last 2 examples in that string, depending on your tcl version.
hello the script works like a charm , but i want it to read - without me typing !readfile more like auto read file with timer between each sentence and another , coloring maybe
like coloring the title - and the url each one with a different color
User avatar
SpiKe^^
Owner
Posts: 831
Joined: Fri May 12, 2006 10:20 pm
Location: Tennessee, USA
Contact:

Post by SpiKe^^ »

but i want it to read - without me typing !readfile more like auto read file with timer between each sentence
The script at or near the end of that forum string does that.
You must read the entire string as the script finished off with all the options discussed throughout the forum string..

Code: Select all

# EditTextFile+TimedReadLine Version 1.0 # 

 # author:  SpiKe^^ # 
 # e-mail:  spike<at>mytclscripts<dot>com # 
 # webpage: http://mytclscripts.com/ #

...and from the settings in that script.......
 
########### Timed Public Read Setting ########### 

 # Set the channel(s) for the timed public read line # 
 set eTxFile(tchan) {#yourchannel #anotherchannel #someotherchan} 

 # Set number of minutes between each timed public read line # 
 # Set this to "0" to disable all timed public read lines 
 # Note: file errors will be sent to the first channel in eTxFile(tchan) 
 set eTxFile(timed) "5"
, coloring maybe
like coloring the title - and the url each one with a different color
You really need a functioning script before you worry about its darn colors
SpiKe^^

Get BogusTrivia 2.06.4.7 at www.mytclscripts.com
or visit the New Tcl Acrhive at www.tclarchive.org
.
V
Votex
Voice
Posts: 23
Joined: Sat Jun 21, 2014 6:52 pm

Post by Votex »

it works for me
User avatar
SpiKe^^
Owner
Posts: 831
Joined: Fri May 12, 2006 10:20 pm
Location: Tennessee, USA
Contact:

Post by SpiKe^^ »

What about...
Votex wrote:also i want the this tcl to mark each txt or url the bot post to be like posted
and never posted it again .
...and...
Votex wrote:coloring maybe
like coloring the title - and the url each one with a different color
We can still modify the script to be more like what you were looking for.
Explain further what else this script may need.
Show an example of what the read file may look like and how the displayed lines should look.
SpiKe^^

Get BogusTrivia 2.06.4.7 at www.mytclscripts.com
or visit the New Tcl Acrhive at www.tclarchive.org
.
V
Votex
Voice
Posts: 23
Joined: Sat Jun 21, 2014 6:52 pm

Post by Votex »

i want to create a txt file that content the following
title - url
i want the bot be auto post them
one line at a time , not mention never post a line never again as it will be mark as posted if it possible with the bot

also if its possible i want the script to be able to make a timer
between each sentence and another like 300 sec or so.

the out put in the channel should be like this
title - url
example : Ore Monogatari!! Mosaic - http://i.imgur.com/nDgEynW.jpg

Explain: Title -> Ore Monogatari!! Mosaic - Then url -> http://i.imgur.com/nDgEynW.jpg
User avatar
SpiKe^^
Owner
Posts: 831
Joined: Fri May 12, 2006 10:20 pm
Location: Tennessee, USA
Contact:

TimedReadLinkFile Version 1.0 (11May2015)

Post by SpiKe^^ »

Code: Select all

# TimedReadLinkFile Version 1.0 (11May2015) #

# author:  SpiKe^^ #
# e-mail:  spike<at>mytclscripts<dot>com #
# webpage: http://mytclscripts.com/ #

# This file is Copyrighted under the GNU Public License. #
# http://www.gnu.org/copyleft/gpl.html #


########### Begin Script Settings ###########

# Set the full route & file name of the file to read from #
set trlf(file) {/usr/home/spike/eggdrop/scripts/filename.txt}

# Set the channel(s) for the timed public read link #
set trlf(chan) {#yourchannel #anotherchannel #someotherchan}

# Set number of minutes between each timed public read link #
set trlf(time) "5"


############ End Script Settings ############

set trlf(chan) [split [string tolower $trlf(chan)]]

if {![info exists trlf(runnin)]} {
  if {$trlf(time)>"3"} {  timer 3 [list trlfReadFile]
  } else {  timer $trlf(time) [list trlfReadFile]  }
  set trlf(runnin) 1
}

proc trlfReadFile {} {  global trlf
  timer $trlf(time) [list trlfReadFile]

  set fl $trlf(file)
  if {![file exists $fl]} {  return  }

  set ofl [open $fl "r"]
  set lines [read -nonewline $ofl]
  close $ofl
  set lines [split $lines "\n"]

  if {![llength $lines]} {  file delete -- $fl  ;  return  }

  set lines [lassign $lines next]

  if {[set idx [string last " - " $next]] < 1} {
    set next "\00305$next"
  } else {
    set title "\00305[string range $next 0 [incr idx -1]]\003 - "
    incr idx 4
    if {[string length $next] > $idx} {
      set url "\00313[string range $next $idx end]\003"
    } else {  set url ""  }
    set next ${title}${url}
  }

  foreach ch $trlf(chan) {  puthelp "PRIVMSG $ch :$next"  }

  if {![llength $lines]} {  file delete -- $fl  ;  return  }

  set ofl [open $fl "w"]
  puts $ofl [join $lines "\n"] 
  close $ofl
  return
}

putlog "TimedReadLinkFile Ver. 1.0 by SpiKe^^ loaded."

SpiKe^^

Get BogusTrivia 2.06.4.7 at www.mytclscripts.com
or visit the New Tcl Acrhive at www.tclarchive.org
.
V
Votex
Voice
Posts: 23
Joined: Sat Jun 21, 2014 6:52 pm

Post by Votex »

sorry for my late late reply

the script is working just fine

but it reads the txt file all over again once i update it (the TXT file ) with new links.

so I‘m asking if its possible to do the following

- make the tcl script read each lines and never read it again ( Even if i update the txt file with new links )
- add !s command for searching in the txt file
example:
!s Ore Monogatari!! Mosaic
or
!s Ore
or even
!s any part of the title

then the bot will repost any results matching the key word or the acutal title i searched for using notice command

and give me the results like this

in Notice !s ( Ore Monogatari!! Mosaic - http://i.imgur.com/nDgEynW.jpg )
Post Reply