脚本:UltraEdit 绿色便携版DIY

优质
小牛编辑
142浏览
2023-12-01
操作说明:

请将你自己的UE目录内容移动到C:\Program Files\CatTools\UltraEdit下,然后在"C:\Program Files\CatTools\UltraEdit\GNU"添加一个自己喜欢的位图文件,并命名为splash.bmp。在C:\Program Files\CatTools\UltraEdit下面放一个自己喜欢的图标文件NSISUE.ico。

将下面的脚本内容保存成nsi文件,然后自己新建一个DirSetting.nsh文件,内容按照上面脚本中注释提示的写。将两个脚本都放到C:\Program Files\CatTools下面。

最后打开你的UE,将wordfile.txt文件目录设置为C:\Program Files\CatTools\UltraEdit\wordfile.txt,将模板目录设置成C:\Program Files\CatTools\UltraEdit\

最后可以运行NSIS对你保存的nsi脚本进行编译了。 (只要各个资源的位置和你脚本中指定的一致就可以)

这样以来以后到哪里都可以使用自己的UE,并且随时可以将自己的设置重新打包随身携带。

引用脚本内容:

##########################
; UltraEdit 绿色便携版DIY
##########################


SetCompressor /SOLID lzma ;;请使用最新的NSIS2.09进行编译……

!include "DirSetting.nsh" 
/***
DirSetting.nsh这个文件首次使用请自己创建。
内容为:
!define "APPDATA" "你当前系统用户的程序数据目录"
***/
!include "MUI.nsh"
!define MUI_ICON "NSISUE.ico"

OutFile "..\UltraEdit.exe"
XPStyle on
Caption "UltraEdit"
CRCCheck off
SilentInstall silent
!insertmacro MUI_LANGUAGE "simpchinese"

VIProductVersion "11.1.2.2"

VIAddVersionKey /LANG=2052 "ProductName" "UltraEdit 绿色便携版"
VIAddVersionKey /LANG=2052 "Comments" "让你通过一个可执行程序方便操作实现所有功能。"
VIAddVersionKey /LANG=2052 "CompanyName" "Hesung Studio"
VIAddVersionKey /LANG=2052 "LegalTrademarks" "IDM Computer Solutions Inc"
VIAddVersionKey /LANG=2052 "LegalCopyright" "Copyright 1994-2005"
VIAddVersionKey /LANG=2052 "FileDescription" "Green Soft"
VIAddVersionKey /LANG=2052 "FileVersion" "11.1.2.2"
VIAddVersionKey /LANG=2052 "ProductVersion" "UltraEdit"
VIAddVersionKey /LANG=2052 "InternalName" "Hsultraedit.exe"


Function .OnInit

IfFileExists "$EXEDIR\MoreSet.ini" 0 Setup

ReadINIStr $0 $EXEDIR\MoreSet.ini Install Command 
Rename $EXEDIR\MoreSet.ini $EXEDIR\已经使用_MoreSet.ini
StrCmp $0 "shortcut" Shortcut
StrCmp $0 "Restore" Pass
StrCmp $0 "Clear" DelDir

Shortcut:
CreateShortCut "$DESKTOP\UeditEdit.lnk" \
"C:\Program Files\CatTools\UltraEdit\Uedit32.exe" "" "" ""SW_SHOWMAXIMIZED "" \
"UltraEdit 十六进制专业文本编辑器。"


Setup:
IfFileExists "C:\Program Files\CatTools\UltraEdit\Uedit32.exe" 0 Pass
IfFileExists "C:\Program Files\CatTools\UltraEdit\uedit32.reg" 0 Pass
IfFileExists "C:\Program Files\CatTools\UltraEdit\ue32ctmn.dll" 0 Pass
IfFileExists "C:\Program Files\CatTools\UltraEdit\ueres.dll" 0 Pass
IfFileExists "C:\Program Files\CatTools\UltraEdit\SftpDLL.dll" 0 Pass
IfFileExists "C:\Program Files\CatTools\UltraEdit\ArmAccess.dll" 0 Pass
IfFileExists "C:\Program Files\CatTools\UltraEdit\dbghelp.dll" 0 Pass
IfFileExists "C:\Program Files\CatTools\UltraEdit\tidylib.dll" 0 Pass
IfFileExists "$APPDATA\IDMComp\UltraEdit\Uedit32.*" Exec Cfg 


DelDir:
ClearErrors
FileOpen $0 "C:\Program Files\CatTools\UltraEdit\ueres.dll" w
IfErrors 0 +6
FileClose $0
MessageBox MB_ICONINFORMATION|MB_OK "请求删除的 UltraEdit 还处于活动进程状态,请先完全中止其进程。 "
ClearErrors
Rename $EXEDIR\已经使用_MoreSet.ini $EXEDIR\MoreSet.ini
Quit

FileClose $0
Sleep 100
Delete "$DESKTOP\UeditEdit.lnk"
RMDIR /r "C:\Program Files\CatTools\UltraEdit"
Delete /REBOOTOK "C:\Program Files\CatTools\UltraEdit\*.*"
RMDIR /r "${APPDATA}\IDMComp\UltraEdit"
Delete "$EXEDIR\已经使用_MoreSet.ini"
Quit


Pass:
SetOutPath "C:\Program Files\CatTools"
File /r "..\UltraEdit" 
advsplash::show 1000 600 400 -1 "C:\Program Files\CatTools\UltraEdit\GNU\Splash"

Cfg:
FileOpen $0 "C:\Program Files\CatTools\UltraEdit\DirSetting.nsh" w
FileWrite $0 "!define $\"APPDATA$\" $\"$APPDATA$\""
FileClose $0


SetOutPath "$APPDATA\IDMComp"
File /r "${APPDATA}\IDMComp\UltraEdit"

Exec:
Exec "C:\Program Files\CatTools\UltraEdit\Uedit32.exe"

ClearErrors
Quit

FunctionEnd

Section "-post"
SectionEnd