见笑了,写了个框框,却不知道怎么实现功能[已解决]
本帖最后由 无名蜘蛛 于 2010-9-19 08:58 编辑#include <GUIConstantsEx.au3>
$winman = GUICreate("运行命令",300,100,-1,-1)
$inputcmd = GUICtrlCreateInput("",20,30,180,25)
$buttoncmd = GUICtrlCreateButton("运行",210,25,70,35)
GUISetState()
While 1
$nMsg = GUIGetMsg()
Switch $nMsg
Case $gui_event_close
Exit
EndSwitch
WEnd我知道这很扯淡,希望有人能帮我解决,还有就是不用点击运行,在框框里输入命令直接回车也运行的那种!!!
拜谢!!!!!!!!! 我把他改成
#include <GUIConstantsEx.au3>
$winman = GUICreate("运行命令",300,100,-1,-1)
$inputcmd = GUICtrlCreateInput("",20,30,180,25)
$buttoncmd = GUICtrlCreateButton("运行",210,25,70,35)
GUISetState()
While 1
$nMsg = GUIGetMsg()
Switch $nMsg
Case $gui_event_close
Exit
Case $buttoncmd
$inputcmdcmd = GUICtrlRead($inputcmd)
Run($inputcmdcmd)
EndSwitch
WEnd
但是只可以运行环境变量里的EXE
控制台必须加mmc才识别例如mmc gpedit.msc直接gpedit.msc是不可用的
除了Run其他的不知道可以不? 最后想法#include <GUIConstantsEx.au3>
$winman = GUICreate("运行命令",300,100,-1,-1)
$inputcmd = GUICtrlCreateInput("",20,30,180,25)
$buttoncmd = GUICtrlCreateButton("运行",210,25,70,35)
GUISetState()
While 1
$nMsg = GUIGetMsg()
Switch $nMsg
Case $gui_event_close
Exit
Case $buttoncmd
$inputcmdcmd = GUICtrlRead($inputcmd)
Run(@ComSpec & "/c" &$inputcmdcmd,"",@SW_HIDE)
EndSwitch
WEnd还是失败 本帖最后由 netegg 于 2010-9-19 07:17 编辑
那个用这个函数不行, 看看关于wm_click消息的操作可能有帮助 本帖最后由 republican 于 2010-9-19 07:57 编辑
回复 3# 无名蜘蛛
你自己写的命令不规范而已。#include <GUIConstantsEx.au3>
$winman = GUICreate("运行命令",300,100,-1,-1)
$inputcmd = GUICtrlCreateInput("",20,30,180,25)
$buttoncmd = GUICtrlCreateButton("运行",210,25,70,35)
GUICtrlSetState(-1,$GUI_DEFBUTTON)
GUISetState()
While 1
$nMsg = GUIGetMsg()
Switch $nMsg
Case $gui_event_close
Exit
Case $buttoncmd
Run("cmd /c " &GUICtrlRead($inputcmd),"",@SW_HIDE)
EndSwitch
WEnd
回复 5# republican
你有试过吗?
我复制过去,测试不可以啊? 终于搞好了,汗!!
不知道可用实现回车,不需要点运行???????#include <GUIConstantsEx.au3>
$winman = GUICreate("运行命令",300,100,-1,-1)
$inputcmd = GUICtrlCreateInput("",20,30,180,25)
$buttoncmd = GUICtrlCreateButton("运行",210,25,70,35)
GUISetState()
While 1
$nMsg = GUIGetMsg()
Switch $nMsg
Case $gui_event_close
Exit
Case $buttoncmd
$inputcmdcmd = GUICtrlRead($inputcmd)
Run("cmd /c "&$inputcmdcmd,"",@SW_HIDE)
EndSwitch
WEnd
全部完成#include <GUIConstantsEx.au3>
$winman = GUICreate("运行命令",300,100,-1,-1)
HotKeySet("{Enter}","_entercmd")
$inputcmd = GUICtrlCreateInput("",20,30,180,25)
$buttoncmd = GUICtrlCreateButton("运行",210,25,70,35)
GUISetState()
While 1
$nMsg = GUIGetMsg()
Switch $nMsg
Case $gui_event_close
Exit
Case $buttoncmd
$inputcmdcmd = GUICtrlRead($inputcmd)
Run("cmd /c "&$inputcmdcmd,"",@SW_HIDE)
EndSwitch
WEnd
;回车运行命令的函数
Func _entercmd()
Local $enterinput
$enterinput = GUICtrlRead($inputcmd)
Run("cmd /c "&$enterinput,"",@SW_HIDE)
EndFunc 回复 8# 无名蜘蛛
这样子就好了,五楼的代码已经包含了。
GUICtrlSetState($buttoncmd,$GUI_DEFBUTTON) 不过还有一大缺陷,不能运行CMD其他都可用运行 难道还要做个判断输入的是CMD或者CMD.EXE是就直接运行,不是就跳过? 回复 11# 无名蜘蛛
回复 10# 无名蜘蛛
CMD使用"ShellExecute"就可以打开
我以前也写过运行,请你参考(你写的比我好,可可)
http://www.autoitx.com/forum.php?mod=viewthread&tid=17677&highlight= 就是这个问题,龙哥,谢了{:face (197):} 学到了1```
页:
[1]