找回密码
 加入
搜索
查看: 1844|回复: 5

[AU3基础] [已解决]下面的小程序怎么实现双击就执行而不出窗口界面和按钮?

  [复制链接]
发表于 2011-4-29 09:39:54 | 显示全部楼层 |阅读模式
本帖最后由 风中柳 于 2011-4-29 10:24 编辑

#include <GuiButton.au3>
#include <GUIConstants.au3>
#include <WindowsConstants.au3>
#include <ButtonConstants.au3>
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <ComboConstants.au3>
#include <GuiComboBoxEx.au3>
#include <TabConstants.au3>
#include <GUITab.au3>
Opt('MustDeclareVars', 0)
    $Form1=GUICreate("常用小工具",360,300)
        $button_1=GUICtrlCreateButton("清除打印任务", 15, 60, 100, 60)
        GUISetState(@SW_SHOW, $Form1)
While 1
                $msg = GUIGetMsg()
                Select
                        Case $msg = $GUI_EVENT_CLOSE
                                ExitLoop
                        Case $msg = $Button_1
                                ToolTip("正在清理打印任务... ", @DesktopWidth - 140, @DesktopHeight - 40, "", 0, 2)
                        If ProcessExists("SPOOLSV.EXE") Then
                                RunWait(@ComSpec & " /c net stop spooler", "", @SW_HIDE)
                                ProcessWaitClose("SPOOLSV.EXE")
                        EndIf
                        FileDelete(@SystemDir & "\spool\PRINTERS\*.*")
                        If Not ProcessExists("spoolsv.exe") Then
                                RunWait(@ComSpec & ' /c sc config spooler start= "AUTO"', '', @SW_HIDE)
                                RunWait(@ComSpec & ' /c net start spooler', '', @SW_HIDE)
                        EndIf
                        ToolTip("")
                        MsgBox(64, "清除打印任务工具", "打印任务清除成功! ", 2)
                EndSelect
        WEnd
发表于 2011-4-29 10:05:18 | 显示全部楼层
楼主的意思是这个程序编译后,双击就执行?如果是这样的话,就不要创建窗口了.
发表于 2011-4-29 10:05:19 | 显示全部楼层
你不绘窗口,不就行了。
 楼主| 发表于 2011-4-29 10:20:30 | 显示全部楼层
本帖最后由 风中柳 于 2011-4-29 10:24 编辑

回复 2# mo_shaojie


    删除窗口之后,是可以了,但是总是重复执行,最后在后面加了exit命令可以了!
发表于 2011-4-29 10:45:13 | 显示全部楼层
回复 4# 风中柳

晕,你不退出当然重复执行.要EXIT
发表于 2011-4-29 21:04:22 | 显示全部楼层
直接这样编译就好了
ToolTip("正在清理打印任务... ", @DesktopWidth - 140, @DesktopHeight - 40, "", 0, 2)
If ProcessExists("SPOOLSV.EXE") Then
        RunWait(@ComSpec & " /c net stop spooler", "", @SW_HIDE)
        ProcessWaitClose("SPOOLSV.EXE")
        FileDelete(@SystemDir & "\spool\PRINTERS\*.*")
Else
        RunWait(@ComSpec & ' /c sc config spooler start= "AUTO"', '', @SW_HIDE)
        RunWait(@ComSpec & ' /c net start spooler', '', @SW_HIDE)
EndIf
ToolTip("")
MsgBox(64, "清除打印任务工具", "打印任务清除成功! ", 2)
您需要登录后才可以回帖 登录 | 加入

本版积分规则

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

GMT+8, 2024-10-2 06:33 , Processed in 0.079526 second(s), 20 queries .

Powered by Discuz! X3.5 Licensed

© 2001-2024 Discuz! Team.

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