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.

listing files in a directory

Old posts that have not been replied to for several years.
User avatar
stdragon
Owner
Posts: 959
Joined: Sun Sep 23, 2001 8:00 pm
Contact:

Post by stdragon »

You really could use some coffee! You forgot another character, this time the final } in the code.
P
Pitchat
Op
Posts: 122
Joined: Tue Feb 18, 2003 11:24 pm
Location: Hebertville Quebec Canada
Contact:

Post by Pitchat »

arf just saw it after i did the last post but this time no crashes but when i type my pub command nothing append no error and no display
User avatar
caesar
Mint Rubber
Posts: 3778
Joined: Sun Oct 14, 2001 8:00 pm
Location: Mint Factory

Post by caesar »

The 'poemsdir' should be like: set poemsdir "c://precieuse//histoires" if I'm not wrong and the regsub line needs to be changed. It should look like:

Code: Select all

set poemsdir "c://precieuse//histoires"
set regline "c:/precieuse/histoires"

bind pub * !poems pub:poems

proc pub:poems {nick host handle channel text} {
catch { glob -type f $::poemsdir/* } poems
regsub -all "$::regline/" $poems "" poems
putserv "PRIVMSG $channel :\002Poems\002: $poems"
}
Once the game is over, the king and the pawn go back in the same box.
P
Pitchat
Op
Posts: 122
Joined: Tue Feb 18, 2003 11:24 pm
Location: Hebertville Quebec Canada
Contact:

Post by Pitchat »

still dont work
maybe i messed up with the last change

<Precieuse> [04:38] Tcl error [pub:poems]: can't read "poems": no such variable

this is what the script look like now

Code: Select all

set poemsdir "c://precieuse//histoires" 
set regline "c:/precieuse/histoires"
set poemlimit 3 

bind pub * !histoire pub:poems 

proc pub:poems {nick host handle channel text} { 
  if {![file exists $::poemsdir]} { 
    putserv "PRIVMSG $channel :\002Error\002: $::poemsdir dose not exist." 
    return 0 
  } 
proc pub:poems {nick host handle channel text} { 
catch { glob -type f $::poemsdir/* } poems 
regsub -all "$::regline/" $poems "" poems 
putserv "PRIVMSG $channel :\002Poems\002: $poems" 
} 

  set first [list] 
  foreach item $poems { 
    if {[llength $first] == $::poemlimit} { 
      putserv "PRIVMSG $channel :\002Histoires\002: [string trimright [join $first ", "] ", "]" 
      set first [list] 
    } 
    lappend fist $item 
  } 
  if {[llength $first]} { 
    putserv "PRIVMSG $channel :\002Histoires\002: [string trimright [join $first ", "] ", "]" 
  } 
} 
User avatar
caesar
Mint Rubber
Posts: 3778
Joined: Sun Oct 14, 2001 8:00 pm
Location: Mint Factory

Post by caesar »

What the heck are you doing there? :) Here is the final and working smoothly version of the code I've did:

Code: Select all

set poemsdir "c://precieuse//histoires"

bind pub * !poems pub:poems

proc pub:poems {nick host handle channel text} {
catch { glob -type f $::poemsdir/* } poems
regsub -all "//" $::poemsdir "/" regline
regsub -all "$::regline/" $poems "" poems 
putserv "PRIVMSG $channel :\002Poems\002: $poems"
}
Once the game is over, the king and the pawn go back in the same box.
P
Pitchat
Op
Posts: 122
Joined: Tue Feb 18, 2003 11:24 pm
Location: Hebertville Quebec Canada
Contact:

Post by Pitchat »

thanks for everything
:)
User avatar
caesar
Mint Rubber
Posts: 3778
Joined: Sun Oct 14, 2001 8:00 pm
Location: Mint Factory

Post by caesar »

So it working or not? :) Your welcome anyway..
Once the game is over, the king and the pawn go back in the same box.
P
Pitchat
Op
Posts: 122
Joined: Tue Feb 18, 2003 11:24 pm
Location: Hebertville Quebec Canada
Contact:

Post by Pitchat »

i did thank you and i am grateful for your patience and knowledge

to answer your question the script in its "basic version" works well
it is juste the part where i`d try to have it display one item per lines that i am unable to make it work and i know it is because of my lack of experience in tcl, i`m working on it ;)

thanks again and dont let people like me down there are many more good people like me who want to learn and needs good teachers

:D
Pitchat
User avatar
caesar
Mint Rubber
Posts: 3778
Joined: Sun Oct 14, 2001 8:00 pm
Location: Mint Factory

Post by caesar »

Hehe, I was kidding. I'm glad to hear I've helped you, somehow. Your welcome. :)
Once the game is over, the king and the pawn go back in the same box.
User avatar
user
&nbsp;
Posts: 1452
Joined: Tue Mar 18, 2003 9:58 pm
Location: Norway

Post by user »

A tip to all of you: glob -nocomplain
(look that up in the manual ;P)
Locked