Read the kungfu novel
Ro-Tcl
Aici Gasesti Tot Felul De Tcl`uri
Acum este: 11/10/2026 13:54

loadall.tcl

 
Raspunde la subiect    Pagina de start a forumului Ro-Tcl -> TCL Scripts
Subiectul anterior :: Subiectul urmator  

Autor Mesaj
MeBoy
Junior
Junior


Data inscrierii: 30/Iun/2008
Mesaje: 5

MesajTrimis: 01/07/2008 14:28    Titlul subiectului: loadall.tcl Raspunde cu citat (quote)

Cod:
# loadall.tcl v1.01 [1 August 2000]
# Copyright (C) 2000 Teemu Hjelt <temex@iki.fi>
#
# Latest version can be found from http://www.iki.fi/temex/eggdrop/
#
# If you have any suggestions, questions or you want to report
# bugs, please feel free to send me email to temex@iki.fi
#
# This script loads all scripts from the directory
# you have specified.
#
# Note: This script doesn't probably work with
# TCL 7.6 because of the bug in glob function.
#
# Tested on eggdrop1.4.4 with TCL 8.0
#
# Version history:
# v1.00 - The very first version!
# v1.01 - Now this script doesn't load itself. (Found by Pimeys)

### Settings ###

## From what directory do you want to load the scripts?
set la_directory "scripturi/"

## What pattern should be used?
set la_pattern "*.tcl"

## [0/1] Do you want this script to inform what script it is currently loading?
set la_inform 0

###### You don't need to edit below this ######

### Misc Things ###

set la_ver "1.01"
set la_num 0

if {[string range $la_directory [expr [string length $la_directory] -1] end] != "/"} {
   set la_directory "$la_directory/"
}

### Procs ###

if {(![file exists $la_directory]) || (![file isdirectory $la_directory]) || (![file readable $la_directory])} {
   putlog "loadall: $la_directory isn't a valid directory."
} elseif {[catch {glob "${la_directory}${la_pattern}"} la_allscripts]} {
   putlog "loadall: No scripts matching pattern $la_pattern found."
} else {
   if {[string match "*[info script]*" $la_allscripts]} {
      set la_amount [expr [llength $la_allscripts] -1]
   } else {
      set la_amount [llength $la_allscripts]
   }
   putlog "loadall: Trying to load $la_amount scripts."
   foreach la_script $la_allscripts {
      if {([file exists $la_script]) && ([file isfile $la_script]) && ([file readable $la_script]) && ($la_script != [info script])} {
         if {$la_inform} { putlog "loadall: Loading $la_script ([file size $la_script] bytes)... \[[expr $la_num +1]/$la_amount\]" }
         if {[catch {source $la_script} la_error]} {
            putlog "loadall: Unable to load $la_script (error: $la_error)"
         } else {
            incr la_num
         }
      }
   }
   putlog "loadall: Successfully loaded $la_num/$la_amount scripts."   
}

### End ###

putlog "TCL loaded: loadall.tcl v$la_ver by Sup <temex@iki.fi>"


M'am gandit sa pun si acest tcl Smile Sper sa va fie de folos
_________________
#U&U Reprezentative
Sus
Vezi profilul utilizatorului Trimite mesaj privat

Afiseaza mesajele pentru a le previzualiza:   
Raspunde la subiect    Pagina de start a forumului Ro-Tcl -> TCL Scripts Ora este GMT + 2 ore
Pagina 1 din 1

 
Mergi direct la:  
Nu puteti crea un subiect nou in acest forum
Nu puteti raspunde in subiectele acestui forum
Nu puteti modifica mesajele proprii din acest forum
Nu puteti sterge mesajele proprii din acest forum
Nu puteti vota in chestionarele din acest forum

Powered by phpBB © 2001, 2002 phpBB Group.
Theme Designed By Arthur Forum
Fa-ti si tu propriul forum GRATUIT, pe www.myforum.ro