JPLackman Posted October 31, 2006 Posted October 31, 2006 K this is my third time asking for help here. Here is what I need to do I have a list of databases and I need to run several scripts on each one of them with the number of scripts depended on whether a module is being used or not. Seems liek it should be fairly easy but I keep getting stopped at the first step. The Query Analyzer has a Change Database Listview. In my script I open that using Ctrl U. Then set focus to the control. Now I want to get the number of items in that listview. I would use that for a loop, going through each database checking for whether they are using a module or notand then running the required scripts. Right now I have 42 databases. When I run this code the msgbox shows a value of 4100 which makes no sense. Do I need a different include? Just please help get this going. #include "ListViewConstants.au3" Opt("WinWaitDelay",100) Opt("WinTitleMatchMode",4) Opt("WinDetectHiddenText",1) Opt("MouseCoordMode",0) WinWait("SQL Query Analyzer","Query - ALWDEV1\ALWS") If Not WinActive("SQL Query Analyzer","Query - ALWDEV1\ALWS") Then WinActivate("SQL Query Analyzer","Query - ALWDEV1\ALWS") WinWaitActive("SQL Query Analyzer","Query - ALWDEV1\ALWS") Send("{CTRLDOWN}u{CTRLUP}") ;Open Change DataBase Window using Keyboard command WinWait("Select Database of ALWDEV1\ALWSQL2K","&Refresh") If Not WinActive("Select Database of ALWDEV1\ALWSQL2K","&Refresh") Then WinActivate("Select Database of ALWDEV1\ALWSQL2K","&Refresh") WinWaitActive("Select Database of ALWDEV1\ALWSQL2K","&Refresh") ControlFocus("Select Database of ALWDEV1\ALWSQL2K","List1",1056) ;Set focus to Database listfrom Window information tool $varListNumber = $LVM_GETITEMCOUNT ;Get number of items in list to set the upper limit for Loop counter MsgBox(0,"ListBox Count", "Number of items in list = " & $varListNumber,1000) ; This displays the number for verification only
PaulIA Posted October 31, 2006 Posted October 31, 2006 Taken mostly from the Auto3Lib ListView demo script: expandcollapse popup#include <A3LListView.au3> $hQA = WinGetHandle("SQL Query Analyzer -", "") if @Error then _ShowError("Unable to find Query Analyzer") if not WinActive("SQL Query Analyzer -") then WinActivate("SQL Query Analyzer -") Send("{CTRLDOWN}u{CTRLUP}") $hList = ControlGetHandle("Select Database of ", "", "SysListView321") if @Error then _ShowError("Unable to find ListView") ShowItems() ; ================================================================================================= ; Show information about the items in the ListView ; ================================================================================================= Func ShowItems() Local $iI Local $sItem Local $rRect Local $iX1, $iY1, $iX2, $iY2 for $iI = 0 to _ListView_GetItemCount($hList) - 1 $rRect = _ListView_GetItemRect($hList, $iI) $iX1 = _DllStructGetData($rRect, $RECT_LEFT ) $iY1 = _DllStructGetData($rRect, $RECT_TOP ) $iX2 = _DllStructGetData($rRect, $RECT_RIGHT ) $iY2 = _DllStructGetData($rRect, $RECT_BOTTOM) $rRect = 0 $sItem = "Item " & $iI & " " ConsoleWrite($sItem & "ID ..................: " & _ListView_MapIndexToID ($hList, $iI ) & @CR) ConsoleWrite($sItem & "is cut ..............: " & _ListView_IsItemCut ($hList, $iI ) & @CR) ConsoleWrite($sItem & "is drop hilited .....: " & _ListView_IsItemDropHilited($hList, $iI ) & @CR) ConsoleWrite($sItem & "is focused ..........: " & _ListView_IsItemFocused ($hList, $iI ) & @CR) ConsoleWrite($sItem & "is selected .........: " & _ListView_IsItemSelected ($hList, $iI ) & @CR) ConsoleWrite($sItem & "next item index .....: " & _ListView_GetNextItem ($hList, $iI ) & @CR) ConsoleWrite($sItem & "position X ..........: " & _ListView_GetItemPositionX ($hList, $iI ) & @CR) ConsoleWrite($sItem & "position Y ..........: " & _ListView_GetItemPositionY ($hList, $iI ) & @CR) ConsoleWrite($sItem & "rectangle ...........: [" & $iX1 & ", " & $iY1 & ", " & $iX2 & ", " & $iY2 & "]" & @CR) ConsoleWrite($sItem & "text ................: " & _ListView_GetItemText ($hList, $iI ) & @CR) ConsoleWrite($sItem & "text (sub item 1) ...: " & _ListView_GetItemText ($hList, $iI, 1) & @CR) ConsoleWrite($sItem & "text (sub item 2) ...: " & _ListView_GetItemText ($hList, $iI, 2) & @CR) ConsoleWrite(@CR) next EndFunc Auto3Lib: A library of over 1200 functions for AutoIt
JPLackman Posted November 1, 2006 Author Posted November 1, 2006 Bah I am such a neeb did not have the latest version so the listbox was not included in mine. Thank you
PaulIA Posted November 4, 2006 Posted November 4, 2006 Bah I am such a neeb did not have the latest version so the listbox was not included in mine. Thank youNo problem. Let me know if you need any help. Auto3Lib: A library of over 1200 functions for AutoIt
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now