脚本:自定义页面点击按钮打开指定网站

优质
小牛编辑
131浏览
2023-12-01

引用 web.nsi 的内容:

!include "WinMessages.nsh"
!include "LogicLib.nsh"

name "网站打开"
Caption  "好网推荐  http://www.dreams8.com"
outfile "files_cd.exe"

page custom show leave
reservefile "file_cd.ini"

function .oninit
initpluginsdir
setoutpath $pluginsdir
file "file_cd.ini"
functionend

function show
installoptions::initdialog /nounload $pluginsdir\file_cd.ini
installoptions::show
functionend



function leave

ReadINIStr $0 "$pluginsdir\file_cd.ini" Settings State
${Switch} $0
	${Default}
	Abort
  ${Case} 1
      ExecShell "open" "http://www.163.com"
      Abort
  ${Case} 2
      ExecShell "open" "http://www.sina.com.cn"
      Abort
  ${Case} 3
      ExecShell "open" "http://www.google.com"
      Abort
  ${Case} 4
      ExecShell "open" "http://www.baidu.com"
      Abort
  ${Case} 5
      ExecShell "open" "http://www.dreams8.com"
      Abort
  ${Case} 6
      ExecShell "open" "http://www.dreams8.com"
      Abort
  ${Case} 0
${EndSwitch}

functionend

section

sectionend

引用 file_cd.ini 的内容:

; Ini file generated by the HM NIS Edit IO designer.
[Settings]
NumFields=5

[Field 1]
Type=Button
Text=打开网易
Left=23
Right=73
Top=30
Bottom=46
Flags=NOTIFY

[Field 2]
Type=Button
Text=打开新浪
Left=189
Right=239
Top=28
Bottom=44
Flags=NOTIFY

[Field 3]
Type=Button
Text=打开谷歌
Left=23
Right=73
Top=86
Bottom=102
Flags=NOTIFY

[Field 4]
Type=Button
Text=打开百度
Left=190
Right=240
Top=86
Bottom=102
Flags=NOTIFY

[Field 5]
Type=Button
Text=梦想吧
Flags=NOTIFY
Left=86
Right=175
Top=41
Bottom=89