找回密码
 加入
搜索
查看: 1775|回复: 3

如果和解决单击按钮运行EXE程序

[复制链接]
发表于 2008-12-4 23:11:37 | 显示全部楼层 |阅读模式
我刚刚在学习autoit还是个初学者!

我自己做好了一个界面,想做一个自己想要的运行程序菜单!

不知道如何实现单击上面的按钮能够运行EXE文件!


如图:
           

#include <ButtonConstants.au3>
#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <TabConstants.au3>
#include <WindowsConstants.au3>

#Region ### START Koda GUI section ### Form=E:\热咖啡里的冰U盘工具\Professional System Tools\系统维护菜单.kxf
$Form1 = GUICreate("系统维护工具菜单 v1.0", 294, 350, 191, 125)
$Tab1 = GUICtrlCreateTab(1, 24, 292, 305)
GUICtrlSetFont(-1, 9, 400, 0, "宋体")
GUICtrlSetResizing(-1, $GUI_DOCKWIDTH+$GUI_DOCKHEIGHT)
$TabSheet1 = GUICtrlCreateTabItem("系统维护")
$Button1 = GUICtrlCreateButton("联想一键6.0", 16, 56, 129, 25, 0)
$Button2 = GUICtrlCreateButton("Vista一键还原1.3.5", 152, 56, 129, 25, 0)
$Button3 = GUICtrlCreateButton("U盘写保护工具 ", 16, 88, 129, 25, 0)
$Button4 = GUICtrlCreateButton("个人资料转移3.5", 152, 88, 129, 25, 0)
$Button5 = GUICtrlCreateButton("增加", 16, 120, 129, 25, 0)
$Button6 = GUICtrlCreateButton("Button6", 152, 120, 129, 25, 0)
$TabSheet2 = GUICtrlCreateTabItem("设置软件")
$Button7 = GUICtrlCreateButton("Windows优化大师 8.0", 16, 56, 129, 25, 0)
$Button8 = GUICtrlCreateButton("修改CPU显示信息", 152, 56, 129, 25, 0)
$Button9 = GUICtrlCreateButton("电源模式修改工具 ", 16, 88, 129, 25, 0)
$Button10 = GUICtrlCreateButton("深度XP优化工具v1.6.5 ", 152, 88, 129, 25, 0)
$Button11 = GUICtrlCreateButton("Button11", 16, 120, 129, 25, 0)
$Button12 = GUICtrlCreateButton("Button12", 152, 120, 129, 25, 0)
$TabSheet3 = GUICtrlCreateTabItem("精品收藏")
$Button13 = GUICtrlCreateButton("微软雅黑字体 V6.0 ", 16, 56, 129, 25, 0)
$Button14 = GUICtrlCreateButton("Button14", 152, 56, 129, 25, 0)
$Button16 = GUICtrlCreateButton("Button16", 16, 88, 129, 25, 0)
$Button17 = GUICtrlCreateButton("Button17", 152, 88, 129, 25, 0)
$Button18 = GUICtrlCreateButton("Button18", 16, 120, 129, 25, 0)
$Button19 = GUICtrlCreateButton("Button19", 152, 120, 129, 25, 0)
$TabSheet4 = GUICtrlCreateTabItem("应用软件")
$Button20 = GUICtrlCreateButton("Button20", 16, 56, 129, 25, 0)
$Button21 = GUICtrlCreateButton("Button21", 152, 56, 129, 25, 0)
$Button15 = GUICtrlCreateButton("Button15", 16, 88, 129, 25, 0)
$Button22 = GUICtrlCreateButton("Button22", 152, 88, 129, 25, 0)
$Button23 = GUICtrlCreateButton("Button23", 16, 120, 129, 25, 0)
$Button24 = GUICtrlCreateButton("Button24", 152, 120, 129, 25, 0)
$TabSheet5 = GUICtrlCreateTabItem("说明")
$Label3 = GUICtrlCreateLabel("本工具热咖啡里的冰专用个人工具菜单", 40, 104, 208, 16)
GUICtrlSetFont(-1, 9, 400, 0, "宋体")
$Label4 = GUICtrlCreateLabel("正在进一步学习请高手指教", 64, 144, 148, 17)
GUICtrlCreateTabItem("")
$Label1 = GUICtrlCreateLabel("欢迎使用", 3, 333, 52, 12)
$Label2 = GUICtrlCreateLabel("热咖啡里的冰作品", 192, 332, 100, 12)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###

While 1
        $nMsg = GUIGetMsg()
        Switch $nMsg
                Case $GUI_EVENT_CLOSE
                        Exit

        EndSwitch
WEnd


[ 本帖最后由 热咖啡里的冰 于 2008-12-6 09:15 编辑 ]

本帖子中包含更多资源

您需要 登录 才可以下载或查看,没有账号?加入

×
 楼主| 发表于 2008-12-5 12:00:16 | 显示全部楼层
原帖由 sliqi 于 2008-12-4 23:24 发表
比如说 $Button1 = GUICtrlCreateButton("联想一键6.0", 16, 56, 129, 25, 0)这行代码来运行记事本
在While 里这样
Case $Button1
Run("notepad.exe");这里就写你要运行的程序

纯新手~~飘过!!!



我试过了可以  但是运行以后程序界面就会关闭 有办法不让它关闭吗?
发表于 2008-12-5 17:45:28 | 显示全部楼层
坛子里有太多这样的脚本了
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
$Form1 = GUICreate("Form1", 241, 109, 192, 124)
$Button1 = GUICtrlCreateButton("记事本", 72, 32, 89, 33, 0)
GUISetState(@SW_SHOW)
While 1
        $nMsg = GUIGetMsg()
        Switch $nMsg
                Case $GUI_EVENT_CLOSE
                        Exit
                Case $Button1
                        Run("notepad.exe")
        EndSwitch
WEnd
 楼主| 发表于 2008-12-6 09:11:35 | 显示全部楼层

回复 4# juyz 的帖子

谢谢的你指教  我新来的有点急用就求贴了!  

我会来今后多多留意帖子的!谢谢你!!
您需要登录后才可以回帖 登录 | 加入

本版积分规则

QQ|手机版|小黑屋|AUTOIT CN ( 鲁ICP备19019924号-1 )谷歌 百度

GMT+8, 2024-5-17 18:11 , Processed in 0.073007 second(s), 20 queries .

Powered by Discuz! X3.5 Licensed

© 2001-2024 Discuz! Team.

快速回复 返回顶部 返回列表