窗体控件问题
我想做个点击按钮改某个注册健值并执行另一个程序同时关闭自身。。请问这个能实现不。。怎么实现,,[ 本帖最后由 tzg_lxjk 于 2008-7-31 23:24 编辑 ] 可以的。
顺序是:
1.点按钮
2,注册键值
3,无等待运行其他程序 注册键值我会。。。我想要的是手动点击按钮注册键值,,然后退出程序运行其他等程序,
通过autoit做的一个窗体。。四个按钮。每个按钮注册不同的键值,点击完后关闭程序并运行同一个其他程序。。怎么实现。
[ 本帖最后由 tzg_lxjk 于 2008-7-31 18:27 编辑 ] 谁帮我解答一下呀。。急用
下面是我做的脚本源代码
#include <ButtonConstants.au3>
#include <GUIConstantsEx.au3>
#include <ProgressConstants.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
#Region ### START Koda GUI section ### Form=
$Form1 = GUICreate("软件安装分区先择工具", 498, 321, 236, 235)
$Button1 = GUICtrlCreateButton("更改软件安装路径为 C 盘", 208, 16, 267, 41, 0)
GUICtrlSetFont(-1, 14, 800, 0, "楷体_GB2312")
GUICtrlSetCursor (-1, 0)
$Button2 = GUICtrlCreateButton("更改软件安装路径为 D 盘", 208, 75, 267, 41, 0)
GUICtrlSetFont(-1, 14, 800, 0, "楷体_GB2312")
GUICtrlSetCursor (-1, 0)
$Button3 = GUICtrlCreateButton("更改软件安装路径为 E 盘", 208, 133, 267, 41, 0)
GUICtrlSetFont(-1, 14, 800, 0, "楷体_GB2312")
GUICtrlSetCursor (-1, 0)
$Button4 = GUICtrlCreateButton("更改软件安装路径为 F 盘", 208, 192, 267, 41, 0)
GUICtrlSetFont(-1, 14, 800, 0, "楷体_GB2312")
GUICtrlSetCursor (-1, 0)
$Pic1 = GUICtrlCreatePic("logo4.BMP", 0, 0, 185, 320, BitOR($SS_NOTIFY,$WS_GROUP,$WS_CLIPSIBLINGS))
$Progress1 = GUICtrlCreateProgress(224, 272, 238, 1)
GUISetState(@SW_SHOW)
GUICtrlSetData("Button1",RegWrite("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion","ProgramFilesDir","REG_SZ","C:\\Program Files"))
GUICtrlSetData("Button2",RegWrite("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion","ProgramFilesDir","REG_SZ","D:\\Program Files"))
GUICtrlSetData("Button2",RegWrite("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion","ProgramFilesDir","REG_SZ","E:\\Program Files"))
GUICtrlSetData("Button2",RegWrite("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion","ProgramFilesDir","REG_SZ","F:\\Program Files"))
#EndRegion ### END Koda GUI section ###
While 1
$nMsg = GUIGetMsg()
Switch $nMsg
Case $GUI_EVENT_CLOSE
Exit
Case $Form1
Case $Form1
Case $Form1
Case $Form1
Case $Button1
Case $Button2
Case $Button3
Case $Button4
Case $Pic1
EndSwitch
WEnd
[ 本帖最后由 tzg_lxjk 于 2008-7-31 18:28 编辑 ] #include <ButtonConstants.au3>
#include <GUIConstantsEx.au3>
#include <ProgressConstants.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
#Region ### START Koda GUI section ### Form=
$Form1 = GUICreate("软件安装分区先择工具", 498, 321, 236, 235)
$Button1 = GUICtrlCreateButton("更改软件安装路径为 C 盘", 208, 16, 267, 41, 0)
GUICtrlSetFont(-1, 14, 800, 0, "楷体_GB2312")
GUICtrlSetCursor(-1, 0)
$Button2 = GUICtrlCreateButton("更改软件安装路径为 D 盘", 208, 75, 267, 41, 0)
GUICtrlSetFont(-1, 14, 800, 0, "楷体_GB2312")
GUICtrlSetCursor(-1, 0)
$Button3 = GUICtrlCreateButton("更改软件安装路径为 E 盘", 208, 133, 267, 41, 0)
GUICtrlSetFont(-1, 14, 800, 0, "楷体_GB2312")
GUICtrlSetCursor(-1, 0)
$Button4 = GUICtrlCreateButton("更改软件安装路径为 F 盘", 208, 192, 267, 41, 0)
GUICtrlSetFont(-1, 14, 800, 0, "楷体_GB2312")
GUICtrlSetCursor(-1, 0)
$Pic1 = GUICtrlCreatePic("logo4.BMP", 0, 0, 185, 320, BitOR($SS_NOTIFY, $WS_GROUP, $WS_CLIPSIBLINGS))
$Progress1 = GUICtrlCreateProgress(224, 272, 238, 1)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###
While 1
$nMsg = GUIGetMsg()
Switch $nMsg
Case $GUI_EVENT_CLOSE
Exit
Case $Button1
RegWrite("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion", "ProgramFilesDir", "REG_SZ", "C:\Program Files")
ABC()
Case $Button2
RegWrite("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion", "ProgramFilesDir", "REG_SZ", "D:\Program Files")
ABC()
Case $Button3
RegWrite("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion", "ProgramFilesDir", "REG_SZ", "E:\Program Files")
ABC()
Case $Button4
RegWrite("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion", "ProgramFilesDir", "REG_SZ", "F:\Program Files")
ABC()
Case $Pic1
EndSwitch
WEnd
Func ABC()
run("notepad.exe")
Exit
EndFunc 论坛上逛了一圈后知道CASE后面可以写事件,嘿嘿。。我做出来了。。
下面是我的。。效果是点击按钮改变系统默认安装路径(以改变后面软件自动安装的路径)然后打开软件自动安装管理器再退出程序。
#Region ;**** 参数创建于 ACNWrapper_GUI ****
#AutoIt3Wrapper_Res_Comment=软件自动安装分区选择工具
#AutoIt3Wrapper_Res_Fileversion=V1.0
#AutoIt3Wrapper_Res_LegalCopyright=浪心剑客
#EndRegion ;**** 参数创建于 ACNWrapper_GUI ****
#include <ButtonConstants.au3>
#include <GUIConstantsEx.au3>
#include <ProgressConstants.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
#Region ### START Koda GUI section ### Form=
$Form1 = GUICreate("软件安装分区选择工具", 498, 321, 236, 235)
$Button1 = GUICtrlCreateButton("更改软件安装路径为 C 盘", 208, 16, 267, 41, 0)
GUICtrlSetFont(-1, 14, 800, 0, "楷体_GB2312")
GUICtrlSetCursor (-1, 0)
$Button2 = GUICtrlCreateButton("更改软件安装路径为 D 盘", 208, 75, 267, 41, 0)
GUICtrlSetFont(-1, 14, 800, 0, "楷体_GB2312")
GUICtrlSetCursor (-1, 0)
$Button3 = GUICtrlCreateButton("更改软件安装路径为 E 盘", 208, 133, 267, 41, 0)
GUICtrlSetFont(-1, 14, 800, 0, "楷体_GB2312")
GUICtrlSetCursor (-1, 0)
$Button4 = GUICtrlCreateButton("更改软件安装路径为 F 盘", 208, 192, 267, 41, 0)
GUICtrlSetFont(-1, 14, 800, 0, "楷体_GB2312")
GUICtrlSetCursor (-1, 0)
$Pic1 = GUICtrlCreatePic("logo4.BMP", 0, 0, 185, 320, BitOR($SS_NOTIFY,$WS_GROUP,$WS_CLIPSIBLINGS))
$Progress1 = GUICtrlCreateProgress(224, 272, 238, 1)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###
While 1
$nMsg = GUIGetMsg()
Switch $nMsg
Case $GUI_EVENT_CLOSE
Exit
Case $Form1
Case $Form1
Case $Form1
Case $Form1
Case $Button1
RegWrite("HKEY_LOCAL_MACHINESOFTWAREMicrosoftWindowsCurrentVersion","ProgramFilesDir","REG_SZ","C:\Program Files")
run("SoftManager.exe")
Exit
Case $Button2
RegWrite("HKEY_LOCAL_MACHINESOFTWAREMicrosoftWindowsCurrentVersion","ProgramFilesDir","REG_SZ","D:\Program Files")
run("SoftManager.exe")
Exit
Case $Button3
RegWrite("HKEY_LOCAL_MACHINESOFTWAREMicrosoftWindowsCurrentVersion","ProgramFilesDir","REG_SZ","E:\Program Files")
run("SoftManager.exe")
Exit
Case $Button4
RegWrite("HKEY_LOCAL_MACHINESOFTWAREMicrosoftWindowsCurrentVersion","ProgramFilesDir","REG_SZ","F:\Program Files")
run("SoftManager.exe")
Exit
Case $Pic1
EndSwitch
WEnd
页:
[1]