最新消息:

紫光拼音迷你智能版实例

nsis 永恒心锁 2245浏览 0评论
#############################
# Engine @ Hesungstduio #
# 紫光拼音迷你智能版 #
#############################
;;你可以借鉴它打包自己的输入法或是自己喜爱的输入法和朋友们内部分享。
;;时间仓促,注释不好,请见凉...
## 调用编译器现编译Hsunistools.nsh用来更新Hsunis.dll
!execute '"${NSISDIR}makensis.exe" "Hsunistools.nsh"'
## 设置NSIS压缩器 ##
SetCompressor /SOLID lzma ;;请使用NSIS2.08以上版本
## 包含头文件 ##
!include "MUI2.nsh"
!include "PublicFuncS.nsh"
## 预定义 ##
!define ICON_NAME Hsunis_main
!define MUI_ICON "Icons${ICON_NAME}.ico"
!define /date DATEFULL "%Y.%m.%d.%H"
!define /date DATE "%Y.%m.%d"
!define VER "Build ${DATE}"
## 基本属性设置 ##
Name "紫光拼音"
Caption "紫光拼音"
SilentInstall silent
CRCCheck off
XPStyle on
## 安装程序文件输出 ##
OutFile "Hsunispim.exe"
## 插入语言宏和其他 ##
#!insertmacro MUI_LANGUAGE "simpchinese"
VIProductVersion "${DATEFULL}"
VIAddVersionKey /LANG=2052 "FileVersion" "版本:${VER}$r$n创建:Engine黑闪工作室"
VIAddVersionKey /LANG=2052 "ProductName" "紫光拼音 3.0 迷你版"
VIAddVersionKey /LANG=2052 "Comments" "紫光拼音输入法迷你版 $r$n基于紫光拼音3.0创建, $r$n具有除因特网搜索之外 $r$n紫光拼音原版全部功能,清华紫光软件版权所有。黑闪工作室成员Engine 编写迷你版策略和脚本。"
VIAddVersionKey /LANG=2052 "CompanyName" "Hesung Studio"
VIAddVersionKey /LANG=2052 "LegalCopyright" "北京清华紫光软件股份有限公司"
VIAddVersionKey /LANG=2052 "FileDescription" "Hesung Tools"
VIAddVersionKey /LANG=2052 "ProductVersion" "清华紫光拼音输入法$r$n引擎版本3.0.0.3045"
VIAddVersionKey /LANG=2052 "OriginalFilename" "Hsunispim.exe"
## 函数 .OnInit //主功能初始化函数 ##
Function .OnInit
;;窗体互斥处理
FindWindow $1 '#32770' '紫光拼音管理工具' 0 $1
IntCmp $1 0 FindNextWindow
SYSTEM::Call "user32::SetForegroundWindow(i r1) i."
ShowWindow $1 1
Abort
FindNextWindow:
FindWindow $1 'TApplication' '紫光拼音输入法-属性设置和管理中心' 0 $1
IntCmp $1 0 NormalShow
SYSTEM::Call "user32::SetForegroundWindow(i r1) i."
ShowWindow $1 1
Abort
NormalShow:
Call GetParameters ;;获取命令行参数给$R0
Pop $R0
StrCmp $R0 "" Normal
StrCmp $R0 "/h" Help
StrCmp $R0 "-h" Help
;;检测是否存在紫光拼音5的核心特征文件。
IfFileExists "$SYSDIRunispim5.ime" 0 +2
IfFileExists "$SYSDIRIMEUnispimupimcfg5.exe" Unispim5_installed
StrCmp $R0 "/c" Config
StrCmp $R0 "-c" Config
StrCmp $R0 "/u" Uninst
StrCmp $R0 "-u" Uninst
StrCmp $R0 "/n" OnlyFiles
StrCmp $R0 "-n" OnlyFiles
StrCmp $R0 "/f" ShowGUI
StrCmp $R0 "-f" ShowGUI
StrCmp $R0 "/r" Restore
StrCmp $R0 "-r" Restore Normal
Uninst:
IfFileExists "$SYSDIRunispim.ime" 0 SpecialDir
IfFileExists "$SYSDIRupengine.dll" 0 SpecialDir
IfFileExists "$SYSDIRIMEUnispimHsunis.dll" +3
SetOutPath "$SYSDIRIMEUnispim"
#File "ToolsHsunis.dll"
Exec `"$SYSDIRIMEUnispimHsunis.dll" -u`
Quit
SpecialDir:
IfFileExists "$TEMPHsunis.tmp" +2
#File "/oname=$TEMPHsunis.tmp" "ToolsHsunis.dll"
Exec `"$TEMPHsunis.tmp" -u`
Abort
ShowGUI:
IfFileExists "$SYSDIRunispim.ime" 0 NotInstalled
IfFileExists "$SYSDIRupengine.dll" 0 NotInstalled
IfFileExists "$SYSDIRIMEUnispimHsunis.dll" +3
SetOutPath "$SYSDIRIMEUnispim"
#File "ToolsHsunis.dll"
Exec "$SYSDIRIMEUnispimHsunis.dll"
Quit
NotInstalled:
;;窗体互斥
SYSTEM::Call "kernel32::CreateMutexA(i 0, i 0, t '$(^Name)') i .r0 ?e"
Pop $0
StrCmp $0 0 ShowAsk
StrLen $0 "$(^Name)"
IntOp $0 $0 + 1
loop1:
FindWindow $1 '#32770' '' 0 $1
IntCmp $1 0 +4
SYSTEM::Call "user32::GetWindowText(i r1, t .r2, i r0) i."
StrCmp $2 "$(^Name)" 0 loop1
SYSTEM::Call "user32::SetForegroundWindow(i r1) i."
ShowWindow $1 1
Abort
ShowAsk:
MessageBox MB_YESNO|MB_ICONQUESTION "当前系统中没有安装紫光拼音输入法 3.0,是否现在进行安装? " IDYES Restore
Quit
Help:
;;窗体互斥
SYSTEM::Call "kernel32::CreateMutexA(i 0, i 0, t '$(^Name)') i .r0 ?e"
Pop $0
StrCmp $0 0 ShowHelp
StrLen $0 "$(^Name)"
IntOp $0 $0 + 1
loop:
FindWindow $1 '#32770' '' 0 $1
IntCmp $1 0 +4
SYSTEM::Call "user32::GetWindowText(i r1, t .r2, i r0) i."
StrCmp $2 "$(^Name)" 0 loop
SYSTEM::Call "user32::SetForegroundWindow(i r1) i."
ShowWindow $1 1
Abort
ShowHelp:
MessageBox MB_OK "$n
H (帮助):弹出紫光拼音迷你版的参数说明。$r$n
F (界面):显示紫光拼音智能操作管理界面。$r$n
N (特别):安装时不添加控制面板卸载信息。$r$n
C (配置):载入紫光拼音输入法的优化配置。$r$n
R (修复):对紫光拼音输入法进行覆盖安装。$r$n
U (卸载):卸载已经安装的紫光拼音输入法。"
Quit
Config:
IfFileExists "$SYSDIRunispim.ime" 0 Restore
IfFileExists "$SYSDIRupengine.dll" 0 Restore
IfFileExists "$SYSDIRIMEUnispimupimcfg.exe" RegCfg Restore
OnlyFiles:
StrCpy $R9 "NoUninstRegKey"
Normal:
;;检测是否存在紫光5的特征文件
IfFileExists "$SYSDIRunispim5.ime" 0 +2
IfFileExists "$SYSDIRIMEUnispimupimcfg5.exe" Unispim5_installed
;;检测核心文件
IfFileExists "$SYSDIRunispim.ime" 0 Restore
IfFileExists "$SYSDIRupengine.dll" 0 Restore
;;检测文件Dat类型
IfFileExists "$SYSDIRIMEUnispimsyswl.dat" 0 Restore
IfFileExists "$SYSDIRIMEUnispimbcoc.dat" 0 Restore
IfFileExists "$SYSDIRIMEUnispimhzfreq.dat" 0 Restore
;;检测文件Exe类型
IfFileExists "$SYSDIRIMEUnispimupcfgwiz.exe" 0 Restore
IfFileExists "$SYSDIRIMEUnispimupimcfg.exe" 0 Restore
IfFileExists "$SYSDIRIMEUnispimwlmerge.exe" 0 Restore
IfFileExists "$SYSDIRIMEUnispimwlbackup.exe" 0 Restore
;;检测重要manifest类型
IfFileExists "$SYSDIRIMEUnispimupimcfg.exe.manifest" 0 Restore
;;检测Chm & dll类型
IfFileExists "$SYSDIRIMEUnispimunispim.chm" 0 Restore
IfFileExists "$SYSDIRIMEUnispimupimset.dll" 0 Restore
;;检测概要INI类型
IfFileExists "$SYSDIRIMEUnispimspewords.ini" 0 Restore
IfFileExists "$SYSDIRIMEUnispimchnsym.ini" 0 Restore
IfFileExists "$SYSDIRIMEUnispimunispimsp.ini" 0 Restore
;;检测当前用户是否存在配置
ClearErrors
ReadRegDWORD $R0 HKCU "SoftwareThunisoftUnispim3.0" "输入栏字体大小"
IfErrors 0 ExeC
#Services::IsProcessUserAdministrator
Pop $0
StrCmp $0 "NO" ExeC ImmInst
Restore:
#Services::IsProcessUserAdministrator
Pop $0
StrCmp $0 "NO" 0 Pass
Call GetWindowsVer
Pop $R0
StrCmp $R0 "XP" Notify
StrCmp $R0 "2003" Notify
StrCmp $R0 "Other" Notify
MessageBox MB_OK|MB_ICONINFORMATION "当前用户组没有权限安装输入法,请以管理员身份登录。 "
Quit
Notify:
NotifyIcon::Icon /NOUNLOAD "iy" 103
NotifyIcon::Icon /NOUNLOAD "b" "紫光输入法安装提示" "当前用户组没有权限安装输入法,请以管理员身份登录。"
Sleep 8000
NotifyIcon::Icon "r"
Sleep 1000
Quit
Pass:
RMDir /r "$APPDATAUnispim"
DeleteRegKey HKLM "SOFTWAREMicrosoftWindowsCurrentVersionUninstall{C21C537D-6438-4574-825C-FBB1CB7BB54C}"
DeleteRegKey HKCU "SoftwareMicrosoftInstallerProductsD735C12C8346475428C5BF1BBCB75BC4"
DeleteRegKey HKCU "S-1-5-21-2052111302-1958367476-839522115-1003SoftwareMicrosoftInstallerProductsD735C12C8346475428C5BF1BBCB75BC4"
StrCmp $R9 "NoUninstRegKey" DoneRegUninstall
#MoreInfo::GetOSUserinterfaceLanguage ;;MoreInfo插件这里获取操作系统shell语言
Pop $LANGUAGE
StrCmp $LANGUAGE "2052" SimpChineseString
WriteRegStr HKLM "SOFTWAREMicrosoftWindowsCurrentVersionUninstall{C21C537D-6438-4574-825C-FBB1CB7BB54C}" "DisplayName" "Thunisoft Unispim IME 3.0"
WriteRegStr HKLM "SOFTWAREMicrosoftWindowsCurrentVersionUninstall{C21C537D-6438-4574-825C-FBB1CB7BB54C}" "DisplayIcon" "$SYSDIRIMEUnispimupimcfg.exe"
WriteRegStr HKLM "SOFTWAREMicrosoftWindowsCurrentVersionUninstall{C21C537D-6438-4574-825C-FBB1CB7BB54C}" "Publisher" "Beijing Thunisoft Corporation"
WriteRegStr HKLM "SOFTWAREMicrosoftWindowsCurrentVersionUninstall{C21C537D-6438-4574-825C-FBB1CB7BB54C}" "UninstallString" `"$SYSDIRIMEUnispimHsunis.dll" -Uninstall`
WriteRegStr HKLM "SOFTWAREMicrosoftWindowsCurrentVersionUninstall{C21C537D-6438-4574-825C-FBB1CB7BB54C}" "ModifyPath" `"$SYSDIRIMEUnispimHsunis.dll" -Restore`
WriteRegStr HKLM "SOFTWAREMicrosoftWindowsCurrentVersionUninstall{C21C537D-6438-4574-825C-FBB1CB7BB54C}" "Specical Description" "This Smart Installer is Created by SupEngine at Hesung Studio."
Goto DoneRegUninstall
SimpChineseString:
WriteRegStr HKLM "SOFTWAREMicrosoftWindowsCurrentVersionUninstall{C21C537D-6438-4574-825C-FBB1CB7BB54C}" "DisplayName" "紫光拼音输入法 3.0"
WriteRegStr HKLM "SOFTWAREMicrosoftWindowsCurrentVersionUninstall{C21C537D-6438-4574-825C-FBB1CB7BB54C}" "DisplayIcon" "$SYSDIRIMEUnispimupimcfg.exe"
WriteRegStr HKLM "SOFTWAREMicrosoftWindowsCurrentVersionUninstall{C21C537D-6438-4574-825C-FBB1CB7BB54C}" "Publisher" "北京清华紫光软件股份有限公司"
WriteRegStr HKLM "SOFTWAREMicrosoftWindowsCurrentVersionUninstall{C21C537D-6438-4574-825C-FBB1CB7BB54C}" "UninstallString" `"$SYSDIRIMEUnispimHsunis.dll" -Uninstall`
WriteRegStr HKLM "SOFTWAREMicrosoftWindowsCurrentVersionUninstall{C21C537D-6438-4574-825C-FBB1CB7BB54C}" "ModifyPath" `"$SYSDIRIMEUnispimHsunis.dll" -Restore`
WriteRegStr HKLM "SOFTWAREMicrosoftWindowsCurrentVersionUninstall{C21C537D-6438-4574-825C-FBB1CB7BB54C}" "Specical Description" "黑闪工作室迷你智能安装策略版本"
DoneRegUninstall:
ClearErrors
SetOutPath "$SYSDIR"
#File "Imekernelunispim.ime"
#File "Imekernelupengine.dll"
SetOutPath "$SYSDIRIME"
#File /r "Unispim"
SetOutPath "$SYSDIRIMEUnispim"
#File "ToolsHsunis.dll"
ImmInst:
System::Call 'imm32::ImmInstallIME(t "$SYSDIRunispim.ime" ,t "紫光拼音输入法 3.0")'
RegCfg:
WriteRegDWORD HKCU "SoftwareThunisoftUnispim3.0" "输入风格" 0x00000001
WriteRegDWORD HKCU "SoftwareThunisoftUnispim3.0" "用字母键选择候选字词" 0x00000000
WriteRegDWORD HKCU "SoftwareThunisoftUnispim3.0" "使用双拼输入" 0x00000000
WriteRegDWORD HKCU "SoftwareThunisoftUnispim3.0" "双拼输入时显示提示信息" 0x00000001
WriteRegDWORD HKCU "SoftwareThunisoftUnispim3.0" "光标跟随" 0x00000001
WriteRegDWORD HKCU "SoftwareThunisoftUnispim3.0" "动态调整词频" 0x00000001
WriteRegDWORD HKCU "SoftwareThunisoftUnispim3.0" "自动隐藏低频词" 0x00000000
WriteRegDWORD HKCU "SoftwareThunisoftUnispim3.0" "动态调整字频" 0x00000001
WriteRegDWORD HKCU "SoftwareThunisoftUnispim3.0" "最近输入字优先" 0x00000001
WriteRegDWORD HKCU "SoftwareThunisoftUnispim3.0" "每页最多候选个数" 0x00000005
WriteRegDWORD HKCU "SoftwareThunisoftUnispim3.0" "中英文输入切换键" 0x00000000
WriteRegDWORD HKCU "SoftwareThunisoftUnispim3.0" "回车键定义" 0x00000001
WriteRegDWORD HKCU "SoftwareThunisoftUnispim3.0" "多个候选翻页键" 0x00000001
WriteRegDWORD HKCU "SoftwareThunisoftUnispim3.0" "输入第二第三候选字词键" 0x00000001
WriteRegDWORD HKCU "SoftwareThunisoftUnispim3.0" "以词定字选字键" 0x00000002
WriteRegDWORD HKCU "SoftwareThunisoftUnispim3.0" "软键盘开关键" 0x00000011
WriteRegDWORD HKCU "SoftwareThunisoftUnispim3.0" "输入栏字体大小" 0x0000000e
WriteRegDWORD HKCU "SoftwareThunisoftUnispim3.0" "输入栏显示样式" 0x00000000
WriteRegDWORD HKCU "SoftwareThunisoftUnispim3.0" "状态条显示" 0x00000001
WriteRegDWORD HKCU "SoftwareThunisoftUnispim3.0" "状态条位置" 10000
WriteRegDWORD HKCU "SoftwareThunisoftUnispim3.0" "支持GBK大字符集" 0x00000001
WriteRegDWORD HKCU "SoftwareThunisoftUnispim3.0" "输入简体汉字" 0x00000001
WriteRegDWORD HKCU "SoftwareThunisoftUnispim3.0" "智能组词" 0x00000001
WriteRegDWORD HKCU "SoftwareThunisoftUnispim3.0" "智能组词自动记忆" 0x00000000
WriteRegDWORD HKCU "SoftwareThunisoftUnispim3.0" "按前次输入动态调整字序" 0x00000000
WriteRegDWORD HKCU "SoftwareThunisoftUnispim3.0" "数字后跟随英文符号" 0x00000000
WriteRegDWORD HKCU "SoftwareThunisoftUnispim3.0" "打开时默认为英文输入状态" 0x00000000
WriteRegDWORD HKCU "SoftwareThunisoftUnispim3.0" "v状态可输入空格" 0x00000000
WriteRegDWORD HKCU "SoftwareThunisoftUnispim3.0" "声母模糊音设置" 0x00ffffff
WriteRegDWORD HKCU "SoftwareThunisoftUnispim3.0" "属性设置保存提示" 0x00000000
WriteRegDWORD HKCU "SoftwareThunisoftUnispim3.0" "一次输入汉字最多个数" 0x0000000c
WriteRegDWORD HKCU "SoftwareThunisoftUnispim3.0" "中文符号" 0x00000400
WriteRegDWORD HKCU "SoftwareThunisoftUnispim3.0" "软键盘索引" 0x00000008
WriteRegDWORD HKCU "SoftwareThunisoftUnispim3.0" "记忆并可输入最近输入过的字词" 1
WriteRegBin HKCU "SoftwareThunisoftUnispim3.0" "韵母模糊音设置" ffffffff0f000000
WriteRegStr HKCU "SoftwareThunisoftUnispim3.0" "输入栏中文字体" "宋体"
WriteRegStr HKCU "SoftwareThunisoftUnispim3.0" "输入栏英文字体" "Tahoma"
DeleteRegKey HKCR "紫光拼音输入法词库备份文件"
WriteRegStr HKCR ".uwl" "" "UnispimWlbackup.file"
WriteRegStr HKCR "UnispimWlbackup.file" "" "紫光拼音词库备份文件"
WriteRegStr HKCR "UnispimWlbackup.fileDefaultIcon" "" "$SYSDIRIMEunispimwlbackup.exe,0"
WriteRegStr HKCR "UnispimWlbackup.fileshell" "" "open"
WriteRegStr HKCR "UnispimWlbackup.fileshellopencommand" "" `"$SYSDIRIMEunispimwlbackup.exe$" $"%1$"`
WriteRegStr HKCR "UnispimWlbackup.fileshellopen" "" "导入词库(&A)"
;;运行紫光拼音3配置中心程序 并自动退出
ExeC:
Exec "$SYSDIRIMEUnispimupimcfg.exe"
ClearErrors
Quit
## 给出已安装紫光拼音5的提示,并清理可能的残留项目
Unispim5_installed:
;;窗体互斥
SYSTEM::Call "kernel32::CreateMutexA(i 0, i 0, t '$(^Name)') i .r0 ?e"
Pop $0
StrCmp $0 0 ShowVer5
StrLen $0 "$(^Name)"
IntOp $0 $0 + 1
loop3:
FindWindow $1 '#32770' '' 0 $1
IntCmp $1 0 +4
SYSTEM::Call "user32::GetWindowText(i r1, t .r2, i r0) i."
StrCmp $2 "$(^Name)" 0 loop3
SYSTEM::Call "user32::SetForegroundWindow(i r1) i."
ShowWindow $1 1
Abort
ShowVer5:
MessageBox MB_OK|MB_ICONINFORMATION "当前系统中已存在紫光拼音 5.0,请将其卸载后再执行该程序。 "
DeleteRegKey HKLM "SOFTWAREMicrosoftWindowsCurrentVersionUninstall{C21C537D-6438-4574-825C-FBB1CB7BB54C}"
DeleteRegKey HKCR "UnispimWlbackup.file"
DeleteRegKey HKCU "SoftwareClassesUnispimWlbackup.file"
DeleteRegKey HKCU "SoftwareMicrosoftInstallerProductsD735C12C8346475428C5BF1BBCB75BC4"
DeleteRegKey HKCU "SoftwareThunisoftUnispim3.0"
DeleteRegKey HKCU "SoftwareThunisoft紫光拼音输入法3.0"
SetOutPath "$SYSDIR"
#File "ToolsDeleteIME.Dll"
ExecWait '"$SYSDIRDeleteIME.Dll" /c unispim.ime'
Delete /REBOOTOK "$SYSDIRDeleteIME.Dll"
ClearErrors
Delete /REBOOTOK "$TEMPHsunis.tmp"
Quit
FunctionEnd ;;.onInit
Section "NoFuntion" ;;形式
SectionEnd
永恒心锁,版权所有丨如未注明,均为转载丨本网站采用BY-NC-SA协议进行授权

转载请注明:永恒心锁-分享互联网 » 紫光拼音迷你智能版实例

您必须 登录 才能发表评论!