找回密码
 加入
搜索
查看: 1830|回复: 9

[AU3基础] [已解决]請問 list view 要如何抓取同一列 Halt 字串有幾個?

  [复制链接]
发表于 2016-9-5 14:24:51 | 显示全部楼层 |阅读模式
本帖最后由 ipmitool 于 2016-9-7 15:00 编辑



請問 list view 要如何抓取同一列 Halt 字串有幾個?

本帖子中包含更多资源

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

×
发表于 2016-9-5 14:33:44 | 显示全部楼层
这好像没什么便捷的方法,遍历、对比,不知道其他人有什么见解。
发表于 2016-9-5 14:58:06 | 显示全部楼层
我也只能使用楼上的办法。
发表于 2016-9-5 18:02:55 | 显示全部楼层
回复 2# nmgwddj

這是資料庫的工作  利用簡單的資料庫 計算後 可得到結果
 楼主| 发表于 2016-9-7 08:08:32 | 显示全部楼层
回复 4# kk_lee69


    可是我的程式, 每10分鐘會update 一次 ListView, 如果每10分鐘就同步一次資料庫, 會不會太耗費記憶體呢? Thanks
发表于 2016-9-7 10:47:35 | 显示全部楼层
回复 5# ipmitool

不會啦 你不一定要用甚麼資料庫   MDB 也是資料庫
可以自己弄自己小型的資料庫就好

只是 你可以使用SQL 語法 做資料庫的計算工作而已
发表于 2016-9-7 10:48:54 | 显示全部楼层
回复 5# ipmitool

不會啦 你不一定要用甚麼資料庫   MDB 也是資料庫
可以自己弄自己小型的資料庫就好

只是 你可以使用SQL 語法 做資料庫的計算工作而已

陣列(數組) 要做搜尋 比對   是麻煩多了

如果是簡單的比對  那倒也不一定用資料庫     可以 直接用數組 做比對
 楼主| 发表于 2016-9-7 11:14:25 | 显示全部楼层
回复 7# kk_lee69


    那假設不用資料庫, 以下語法要怎麼改啊...?
#include <GUIConstantsEx.au3>
#include <GuiListView.au3>
#include <MsgBoxConstants.au3>

Example()

Func Example()
    Local $iI, $idListview

    GUICreate("ListView Find In Text", 400, 300)
    $idListview = GUICtrlCreateListView("", 2, 2, 394, 268)
    GUISetState(@SW_SHOW)

    ; Add columns
    _GUICtrlListView_InsertColumn($idListview, 0, "Items", 100)

    ; Add items
    _GUICtrlListView_BeginUpdate($idListview)

    _GUICtrlListView_AddItem($idListview, "Halt")
        _GUICtrlListView_AddItem($idListview, "On-going")
        _GUICtrlListView_AddItem($idListview, "Halt")
        _GUICtrlListView_AddItem($idListview, "Halt")
        _GUICtrlListView_AddItem($idListview, "On-going")
        _GUICtrlListView_AddItem($idListview, "Halt")
    _GUICtrlListView_AddItem($idListview, "Halt")
        _GUICtrlListView_AddItem($idListview, "On-going")
        _GUICtrlListView_AddItem($idListview, "Halt")
        _GUICtrlListView_AddItem($idListview, "On-going")
        _GUICtrlListView_AddItem($idListview, "Halt")

    _GUICtrlListView_EndUpdate($idListview)

    ; Search for target item

    ; Loop until the user exits.
    Do
    Until GUIGetMsg() = $GUI_EVENT_CLOSE
    GUIDelete()
EndFunc   ;==>Example
发表于 2016-9-7 11:44:39 | 显示全部楼层
回复 8# ipmitool

LIST VIEW 本身是無法做判斷的  你得將內容放到數組 裡面

再由 數組  跑回圈  才能判斷.....

方法一  用你現在會的方法  把 資料 再放到數組裡面   

方法二   用 虛擬 LISTVIE  數組本身的內容就是 LIST VIEW  更新了數組  LISTVIE 就更新了

所以 本身就存在 數組  你就從數組 去做排序 跟搜尋即可

http://www.autoitx.com/forum.php ... hlight=%D0%E9%C4%E2
http://www.autoitx.com/thread-50083-1-1.html

這兩篇文章 看看   學會了 對於 你幫助很大  虛擬的比較好用 速度快
发表于 2016-9-7 12:07:57 | 显示全部楼层
回复 8# ipmitool

#include <GUIConstantsEx.au3>
#include <GuiListView.au3>
#include <MsgBoxConstants.au3>

Example()

Func Example()
    Local $iI, $idListview
        
        DIM $ARRAY[11]
        $ARRAY[0]="Halt"
        $ARRAY[1]="On-going"
        $ARRAY[2]="Halt"
        $ARRAY[3]="Halt"
        $ARRAY[4]="On-going"
        $ARRAY[5]="Halt"
        $ARRAY[6]="Halt"
        $ARRAY[7]="On-going"
        $ARRAY[8]="Halt"
        $ARRAY[9]="On-going"
        $ARRAY[10]="Halt"

    GUICreate("ListView Find In Text", 400, 300)
    $idListview = GUICtrlCreateListView("", 2, 2, 394, 268)
    GUISetState(@SW_SHOW)

    ; Add columns
    _GUICtrlListView_InsertColumn($idListview, 0, "Items", 100)
        
    ; Add items
    _GUICtrlListView_BeginUpdate($idListview)
    FOR $i=0 TO 10


    _GUICtrlListView_AddItem($idListview,$ARRAY[$i])


        Next
        
    _GUICtrlListView_EndUpdate($idListview)

    ; Search for target item
        
        $a=0
        
    FOR $i=0 TO 10


    If $ARRAY[$i]="Halt" THEN $a=$a+1


        Next

        MsgBox(0,"","Halt 一共 "&$a&" 個")



    ; Loop until the user exits.
    Do
    Until GUIGetMsg() = $GUI_EVENT_CLOSE
    GUIDelete()
EndFunc   ;==>Example

评分

参与人数 2金钱 +20 收起 理由
ipmitool + 10 感謝師兄!
heroxianf + 10 KK有耐心

查看全部评分

您需要登录后才可以回帖 登录 | 加入

本版积分规则

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

GMT+8, 2024-9-28 23:35 , Processed in 0.149097 second(s), 23 queries .

Powered by Discuz! X3.5 Licensed

© 2001-2024 Discuz! Team.

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