找回密码
 加入
搜索
查看: 3728|回复: 0

[系统综合] [已解决]脚本未执行,进程已关闭,急!

[复制链接]
发表于 2009-11-1 04:51:28 | 显示全部楼层 |阅读模式
本帖最后由 jevonleen 于 2012-8-1 21:42 编辑

先上源码:
#NoTrayIcon
#Include <GuiToolBar.au3>
_SysTray_ClickItem("卡巴斯基全功能安全软件", "right", 1)
If @error Then MsgBox(48, "Failure", "Required item not found")
Send('{UP 6}')
Send('{ENTER}')
Send('{TAB 4}')
Send('{TAB }')
Send('{SPACE}')
Send('{RIGHT}')
Send('{DOWN 18}')
Send('{TAB}')
Send('{SPACE}')
Send('{ENTER}')
;=========# _SysTray_ClickItem #======================================================
;
;Function Name:    _SysTray_ClickItem()
;Description:      Click on item in Windows system tray by any substring in the title
;Parameters:       $iTitle - The title of the item in Windows system tray (you can see the title of the item when mouse cursor hovered on item).
;                  $iButton - [optional] The button to click, "left" or "right". Default is the left button.
;                  $iClick - [optional] The number of times to click the mouse. Default is 1
;               $sMove = [optional] True = Mouse will be moved, False (default) = Mouse will not be moved
;               $iSpeed = [optional] Mouse movement speed
;Return Value(s):  Success - Returns 1
;                  Failure - Returns 0 and sets @error to 1 if required item not found
;Requirement(s):   AutoIt 3.2.10.0 and above
;Autor(s):        R.Gilman (a.k.a rasim); Siao (Thanks for idea)
;
;====================================================================================
Func _SysTray_ClickItem($iTitle, $iButton = "left", $iClick = 1, $sMove = False, $iSpeed = 1)
    Local $hToolbar, $iButCount, $aRect, $hButton, $cID, $i
   
    $hToolbar = ControlGetHandle("[Class:Shell_TrayWnd]", "", "[Class:ToolbarWindow32;Instance:1]")
    If @error Then
        Return SetError(1, 0, 0)
    EndIf
   
    $iButCount = _GUICtrlToolbar_ButtonCount($hToolbar)
    If $iButCount = 0 Then
        Return SetError(1, 0, 0)
    EndIf
   
    $hButton = ControlGetHandle("[Class:Shell_TrayWnd]", "", "Button2")
    If $hButton <> "" Then ControlClick("[Class:Shell_TrayWnd]", "", "Button2")
   
    For $i = 0 To $iButCount - 1
        $cID = _GUICtrlToolbar_IndexToCommand($hToolBar, $i)
        If StringInStr(_GUICtrlToolbar_GetButtonText($hToolBar, $cID), $iTitle) Then
            _GUICtrlToolbar_ClickButton($hToolbar, $cID, $iButton, $sMove, $iClick, $iSpeed)
            Return 1
        EndIf
    Next
    Return SetError(1, 0, 0)
EndFunc

因为本人想搞个自动激活卡巴的,所以写了以上代码.(托盘右键不是本人写的).但执行代码后,打开窗口还未出现,后台进程却已关闭.而源码能正常执行完毕.但是后面执行的程序需要此代码完全执行完毕后再执行,用RunWait和ProcessWaitClose都不行,请高手帮忙,谢谢!
注:不用SLEEP

刚刚又试了一个脚本,原来可以关闭卡巴保护和自我保护的,现在却只能关闭保护而不能关闭自我保护!请高手帮忙,谢谢!
您需要登录后才可以回帖 登录 | 加入

本版积分规则

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

GMT+8, 2024-5-18 12:01 , Processed in 0.077336 second(s), 24 queries .

Powered by Discuz! X3.5 Licensed

© 2001-2024 Discuz! Team.

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