TCL 驱动器快报

proc _driveLetters {} {
  # Return a list of mapped drive (volume) letters (in upper case).
  foreach drive [list a b c d e f g h i j k l m n o p q r s t u v x y z] {
    if {[catch {file stat ${drive}: dummy}] == 0} {
      lappend drives [string toupper $drive]
    }
  }
  return $drives
}

TCL 文件行列表

proc _fileLinesList {fn} {
  # Returns the lines of a given file as a list.
  set f [open $fn r]
  set t [read $f [file size $fn]]
  close $f
  return [split $t \n]
}

TCL 递归文件夹

proc _recurseFolders {folder} {
  # This script will build a list of files in the pwd including files in subfolders.

  # Append all the files to a list of files.
  foreach i [glob -nocomplain -types f -directory $folder -- *] {
    lappend list_of_files $i
  }

  # Foreach directory recurse this procedure.
  foreach j [glob -nocomplain -types d -directory $folder -- *] {
    set list_of_files [concat $list_of_files [_recurse_folders $j]]
  }

  # Return the list of all the files.
  return $list_of_files
}

TCL 默认应用

proc _defaultApp {extension} {
  # Find the name of the default application for a given file extension.
  # This procedure searches the "HKEY_CLASSES_ROOT" key in the Windows registry.

	package require registry

	if {[catch {set fileType [registry get "HKEY_CLASSES_ROOT\\$extension" ""]} ]} {
		puts "There is no default application assigned to '${extension}' files."
		return 0
	} else {
	  if {[catch {set defaultExe [registry get "HKEY_CLASSES_ROOT\\${fileType}\\shell\\open\\command" ""]} ]} {
	    puts "The default executable name for '${extension}' is not defined in the registry."
	    return 0
	  } else {
	    return $defaultExe
	  }
	}
}

TCL Nuke闪烁节点

Multiply {
 value {{maxVal-(random(frame*freqVal)*(maxVal-minVal)) i}}
 name Multiply4
 label "FLICKER NODE"
 selected true
 xpos -590
 ypos -736
 addUserKnob {20 User}
 addUserKnob {7 minVal l "Minimum Value"}
 minVal 0.4
 addUserKnob {7 maxVal l "Maximum Value"}
 maxVal 1
 addUserKnob {7 freqVal l Frequency}
 freqVal 0.6
}