📄 instw32.tcl
字号:
return 0;
}
} else {
return [info exists env(MWHOME)]
}
}
#############################################################################
#
# limitColors - determine whether environment variable SETUP_LIMITCOLORS is set
#
# This procedure will determine whether environment variable
# SETUP_LIMITCOLORS is set
#
# SYNOPSIS
# .tS
# limitColors
# .tE
#
# PARAMETERS: N/A
#
# RETURNS: 0 if enviroment variable SETUP_LIMITCOLORS is not set
# 1 if enviroment variable SETUP_LIMITCOLORS is set
#
# ERRORS: N/A
#
proc limitColors {} {
global env
if {[info exists env(SETUP_LIMITCOLORS)]} {
if {$env(SETUP_LIMITCOLORS)==1} {
return 1
}
}
return 0
}
#############################################################################
#
# removeBackground - determine whether environment variable
# SETUP_REMOVEBACKGROUND is set
#
# This procedure will determine whether environment variable
# SETUP_REMOVEBACKGROUND is set
#
# SYNOPSIS
# .tS
# removeBackground
# .tE
#
# PARAMETERS: N/A
#
# RETURNS: 0 if enviroment variable SETUP_REMOVEBACKGROUND is not set
# 1 if enviroment variable SETUP_REMOVEBACKGROUND is set
#
# ERRORS: N/A
#
proc removeBackground {} {
global env
if {[info exists env(SETUP_REMOVEBACKGROUND)]} {
if {$env(SETUP_REMOVEBACKGROUND)==1} {
return 1
}
}
return 0
}
#############################################################################
#
# noColorMgr - determine whether environment variable SETUP_NOCOLORMGR is set
#
# This procedure will determine whether environment variable
# SETUP_NOCOLORMGR is set
#
# SYNOPSIS
# .tS
# noColorMgr
# .tE
#
# PARAMETERS: N/A
#
# RETURNS: 0 if enviroment variable SETUP_NOCOLORMGR is not set
# 1 if enviroment variable SETUP_NOCOLORMGR is set
#
# ERRORS: N/A
#
proc noColorMgr {} {
global env
if {[info exists env(SETUP_NOCOLORMGR)]} {
if {$env(SETUP_NOCOLORMGR)==1} {
return 1
}
}
return 0
}
#############################################################################
#
# parseCmdLine - parse command line arguments
#
# This procedure will parse command line argument
#
# SYNOPSIS
# .tS
# parseCmdLine <switches>
# .tE
#
# PARAMETERS:
# .IP switches
# /ICON - install icons only
# /HELP - print help messages
#
# RETURNS: 1 if there are more than 1 switches
# 0 if there are one or no switches
#
# ERRORS: N/A
#
proc parseCmdLine {switches} {
global tornadoInstalled
set usageError [expr [llength $switches] > 1]
if {!$usageError && ([llength $switches] == 1)} {
set switches [string toupper $switches]
switch -regexp ($switches) {
\-I -
/I -
/ICON {
instTypeSet icon
set tornadoInstalled 1
}
/? -
/H -
/HELP -
default {
set usageError 1
}
}
}
if {$usageError} {
messageBox -ok -informationicon [strTableGet 1550_USAGE]
}
return $usageError
}
#############################################################################
#
# setupFolderCreate - create Tornado folder
#
# This procedure will create Tornado folder
#
# SYNOPSIS
# .tS
# setupFolderCreate <folder> <mode>
# .tE
#
# PARAMETERS:
# .IP folder
# folder name to be created
# .IP mode
# 0 -- install Tornado in the user program group
# 1 -- install Tornado in the common program group
#
# RETURNS: N/A
#
# ERRORS: N/A
#
proc setupFolderCreate {folder mode} {
set path [programPathGet $mode]
if [catch {file mkdir "$path\\$folder"} err] {
dbgputs "cannot create folder, $folder, $mode: $err"
}
}
#############################################################################
#
# setupLinkDelete - create Tornado program links
#
# This procedure will create Tornado program links
#
# SYNOPSIS
# .tS
# setupLinkDelete <folder> <linkName> <mode>
# .tE
#
# PARAMETERS:
# .IP folder
# folder name containing the program links
# .IP linkName
# string name of program links
# .IP mode
# 0 -- install Tornado in the user program group
# 1 -- install Tornado in the common program group
#
# RETURNS: N/A
#
# ERRORS: N/A
#
proc setupLinkDelete {folder linkName mode} {
set programPath [programPathGet $mode]
if { "$folder" == "" } {
puts "Error: folder name is null"
return
}
if {"$linkName" == "" } {
puts "Error: link name is null"
return
}
if [catch {file delete "$programPath\\$folder\\$linkName"} err] {
dbgputs "cannot delete icon, $linkName: $err"
} else {
dbgputs "deleted icon: $linkName"
}
}
#############################################################################
#
# folderCreateLog - create Tornado folders and log the actions
#
# This procedure will create Tornado folders and log the actions for uninstall
# use later
#
# SYNOPSIS
# .tS
# folderCreateLog <folder> <mode> [log]
# .tE
#
# PARAMETERS:
# .IP folder
# folder name to be created
# .IP mode
# 0 -- install Tornado in the user program group
# 1 -- install Tornado in the common program group
# .IP log
# true -- log the actions (default)
# false -- do not log the actions
#
# RETURNS: N/A
#
# ERRORS: N/A
#
proc folderCreateLog {folder mode {log true}} {
global ctrlVals
setupFolderCreate $folder $mode
if {[lsearch $ctrlVals(folders) $folder] == "-1" && $log == "true"} {
lappend ctrlVals(folders) $folder
uninstLog resource "folder\t$folder\t$mode"
}
}
#############################################################################
#
# linkCreateLog - create Tornado program links and log the actions
#
# This procedure will create Tornado program links and log the actions for
# uninstall use later
#
# SYNOPSIS
# .tS
# linkCreateLog <folder> <item> <exe> [args] [dir] [mode] [fMin] [iconIndex]
# [iconPath]
# .tE
#
# PARAMETERS:
# .IP folder
# folder name containing the program links
# .IP item
# icon name; eg "Tornado Registry", "VxWorks COM1"
# .IP exe
# path to the executable file; eg "host\x86-win32\bin\wtxregd.exe"
# .IP args
# arguments passed to the executable; eg "-V"
# .IP dir
# directory that the executable resides
# .IP mode
# 0 -- install Tornado in the user program group
# 1 -- install Tornado in the common program group
# .IP fMin
# run in minimized state
# .IP iconIndex
# icon index
# .IP iconPath
# path to the icon file; eg host\resource\bitmaps\WindView\evtRecv.ico
#
# RETURNS: N/A
#
# ERRORS: N/A
#
proc linkCreateLog {folder item exe args dir mode {fMin 0} {iconIndex 0}\
{iconPath ""}} {
set added 0
set new 0
if [catch {setupLinkDelete $folder $item $mode} error] {
set new 1
}
if {$iconPath == "" && ![catch {setupLinkCreate $folder \
$item \
$exe \
$args \
$dir \
$mode \
$fMin} error]} {
set added 1
} elseif {![catch {setupLinkCreate $folder \
$item \
$exe \
$args \
$dir \
$mode \
$fMin \
$iconIndex \
$iconPath} error]} {
set added 1
} else {
dbgputs "error when creating item $item in $folder: $error"
set hasError 1
}
if {$new && $added} {
uninstLog resource "icon\t$folder\t$item\t$mode"
}
if [info exists hasError] {
messageBox "Cannot create icons(s): $error\nPlease run \"SETUP \/I\"\
to install icons at a later time."
}
}
#############################################################################
#
# regKeyCreateLog - create registry key and log the actions
#
# This procedure will create registry key and log the actions
#
# SYNOPSIS
# .tS
# regKeyCreateLog <rootKey> <subKey> <key> [log]
# .tE
#
# PARAMETERS:
# .IP rootKey
# root of registry key hierarchy; eg HKEY_LOCAL_MACHINE
# .IP subKey
# path to the registry key; eg SOFTWARE\\Microsoft\\Windows\\CurrentVersion
# .IP key
# key name; eg "Uninstall", "TornadoV2.0"
# .IP log
# true -- log the actions (default)
# false -- do not log the actions
#
# RETURNS: N/A
#
# ERRORS: N/A
#
proc regKeyCreateLog {rootKey subKey key {log true}} {
global setupVals
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -