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

如何让AU3单击此 TreeView 的子项目

[复制链接]
发表于 2009-9-28 15:57:44 | 显示全部楼层 |阅读模式
本帖最后由 maxkingmax 于 2009-9-28 23:13 编辑

刚才提问时,以为是给回答者的奖金,所以加了付费被删贴了

如图所示:如何使用 Au3 命令自动点击所选项目“计划任务”
软件为: 比特精灵V3.6.0.300

#Include <GuiTreeView.au3>

func smartspeedoff()
       
        _SysTray_ClickItem("比特精灵", "right", 1)
sleep(2000)
send("p")
winwaitactive("选项","确定",10)

$handle = ControlGetHandle ( "选项", "确定", "TTreeView1")
$hItemFound = _GUICtrlTreeView_FindItem($handle, "高级选项")
$a=_GUICtrlTreeView_GetLastChild($handle,$hItemFound)
   _GUICtrlTreeView_ClickItem($handle, $a , "left", False, 1)



   winwaitactive("选项","启用任务计划")
ControlCommand ("选项", "启用任务计划","TCheckBox1","Check", "")
sleep(500)
controlclick("选项", "确定","TButton4")
EndFunc
smartspeedoff()

#Include <GuiToolBar.au3>
;=========# _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

本帖子中包含更多资源

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

×
发表于 2009-9-28 17:11:40 | 显示全部楼层
红字部分一般获取不到控件id的,你加个打印看看
为什么不用ControlTreeView?
 楼主| 发表于 2009-9-28 23:12:08 | 显示全部楼层
谢谢了二楼,光想用UDF,忘了最基本的了!
发表于 2010-6-11 17:59:28 | 显示全部楼层
看看先1111
发表于 2011-4-13 00:03:11 | 显示全部楼层
发表于 2012-2-22 13:07:56 | 显示全部楼层
相当不错,很正常
您需要登录后才可以回帖 登录 | 加入

本版积分规则

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

GMT+8, 2024-11-19 14:45 , Processed in 0.071748 second(s), 20 queries .

Powered by Discuz! X3.5 Licensed

© 2001-2024 Discuz! Team.

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