Leaderboard
Popular Content
Showing content with the highest reputation on 10/14/2019 in all areas
-
Not really. Fixed that in the current Beta. Thanks for the report. Jos2 points
-
I want to present BETA Version of my ADO.au3 UDF. This is modifed version of _sql.au3 UDF. For that I want to thanks : ; Chris Lambert, eltorro, Elias Assad Neto, CarlH This is first public release , and still is as BETA DOWNLOAD LINK (in download section): Have fun, mLipok EDIT: 2016-06-03 Below some interesting topics about databases: EDIT 2016/07/04: For more info about ADO look here: https://www.autoitscript.com/wiki/ADO FOR EXAMPLE DATABASE use AdventureWorksDW2016_EXT.bak from: https://github.com/microsoft/sql-server-samples/releases/download/adventureworks/AdventureWorksDW2016_EXT.bak I will relay on this database in my examples. Here is link to post which shows how "ODBC Data Source Administrator" looks like.1 point
-
MySQL UDFs
red_evilspirit reacted to cdkid for a topic
here's the first release... only a few functions so far, any input would be appriciated Todo: _CreateTable() _CreateColumn() _DropCol() _DropTbl() _CountRecords() _CountTables() _GetTblNames() _GetColCount() _GetColType() _GetColNames() _GetDbNames() _ChangeCon() any input would be much appreciated! i hope this helps someone The MySQL ODBC 3.51 DRIVER IS REQUIRED FOR THIS it can be downloaded here: http://dev.mysql.com/downloads/connector/odbc/3.51.html Downloads:v1.6 - 1964 v1.5 - 756 v1.4 - 60 v1.3 - 150 Below is a .ZIP called "ODBC_DRIVER_SETUP" it has the au3 for driver setup, read _ReadMe_.txt to see how to make it work. ODBC_DRIVER_SETUP.zip mysql.au31 point -
The main problem with a normal and also a virtual listview with many columns is that performance gets worse and worse as the number of columns increases. And the performance decrease starts at a relatively low number of columns and is significant. Examples\Reference.au3 in the zip-file in bottom of post is a reference example. It's a virtual listview with 1,000 rows and 100 columns. An owner drawn listview with the LVS_OWNERDRAWFIXED style is the listview that supports many columns. An owner drawn listview is updated through WM_DRAWITEM messages. One WM_DRAWITEM message is generated per visible listview row. No additional messages are generated for the listview columns. If $iColFirst and $iColLast are the first and last visible listview column, then a listview row with index $itemID can be updated with this code: ; Draw visible columns/subitems For $i = $iColFirst To $iColLast $sSubItmText = $itemID & " / " & $i DllStructSetData( $tRect, 2, $i ) ; Top DllStructSetData( $tRect, 1, $LVIR_BOUNDS ) ; Left GUICtrlSendMsg( $idListView, $LVM_GETSUBITEMRECT, $itemID, $pRect ) If Not $i Then DllStructSetData( $tRect, 3, DllStructGetData( $tRect, 1 ) + GUICtrlSendMsg( $idListView, $LVM_GETCOLUMNWIDTH, 0, 0 ) ) DllStructSetData( $tRect, 1, DllStructGetData( $tRect, 1 ) + 6 ) ; Left margin DllStructSetData( $tRect, 2, DllStructGetData( $tRect, 2 ) + 2 ) ; Top margin DllCall( "user32.dll", "int", "DrawTextW", "handle", $hDC, "wstr", $sSubItmText, "int", StringLen( $sSubItmText ), "ptr", $pRect, "int", 0 ) ; _WinAPI_DrawText Next In an owner drawn listview you have to handle the subitem rectangles yourself and update the subitem texts with GDI functions like DrawText. But eg. grid lines are drawn automatically through default code. $iColFirst and $iColLast can be calculated in a WM_NOTIFY message handler through LVN_ENDSCROLL notifications when listview columns are scrolled horizontally: Case $LVN_ENDSCROLL If Not DllStructGetData( DllStructCreate( $tagNMLVSCROLL, $lParam ), "DX" ) Then Return $GUI_RUNDEFMSG ; Horizontal scrollbar only ; First and last visible column in ListView GUICtrlSendMsg( $idListView, $LVM_SUBITEMHITTEST, 0, $pHitTestFirst ) $iColFirst = DllStructGetData( $tHitTestFirst, "SubItem" ) GUICtrlSendMsg( $idListView, $LVM_SUBITEMHITTEST, 0, $pHitTestLast ) $iColLast = DllStructGetData( $tHitTestLast, "SubItem" ) ; Redraw ListView GUICtrlSendMsg( $idListView, $LVM_REDRAWITEMS, 0, $iRows - 1 ) ; Redraw ListView items, Forces $WM_DRAWITEM messages to update ListView control In the examples the owner drawn style is combined with the virtual style, LVS_OWNERDATA, to be able to dynamically feed the listview with data directly from a data source. Medium number of columns If the number of columns is limited to a few hundred, the built-in listview header can support the columns. The examples are stored in Examples\Medium\ in the zip-file. Run the examples in SciTE with F5. FirstTest.au3 demonstrates the code snippets above. TooManyCols.au3 shows what happens if the listview contains more columns than the built-in header is able to support. Drag the thumb in the horizontal scrollbar all the way to the right to see that the header items are simply missing. In SelectedRows1.au3 you can select one or more rows. In SelectedRows2.au3 attempts have been made to reduce the flicker that occurs when the thumb in the horizontal scrollbar is swiftly dragged back and forth. More about flicker below. Checkboxes.au3 and IconImages.au3 shows how to add checkboxes and icons. By drawing everything yourself, you can arbitrarily decide which columns should be provided with checkboxes, icons or both. FillFromArray1.au3 and FillFromArray2.au3 demonstrates how to fill a listview from an array. Large number of columns For a large number of columns, 100,000 columns in most examples, you need to create the header control yourself with the functions in GuiHeader.au3. The header control isn't built into the listview but is an independent child window. The idea is to only show header items for visible listview columns. In ReSizeColumns.au3 listview columns can be resized to a minimum of 50 pixels. This makes a maximum of approx. 20 visible columns in the listview and therefore also a maximum of 20 header items. The first header item is always the header item with index 0. The second header item is always the header item with index 1. And so on. Header item texts (and header item widths if needed) are dynamically updated when listview columns are scrolled horizontally. The examples are stored in Examples\Large\ in the zip-file. There are three subfolders named UserDrawn, OwnerDrawn and CustomDrawn. The names refer to the technique used to draw the header control. The listview is still owner drawn. In UserDrawn\FirstTest.au3 the header control is updated directly in the LVN_ENDSCROLL section of the WM_NOTIFY message handler. It's simple code, but it generates a lot of flicker in the header control when the thumb in the horizontal scrollbar is dragged quickly back and forth. To avoid that much flicker, you can use either an owner or custom drawn header. OwnerDrawn\FirstTest.au3 shows an owner drawn header control. Because an owner drawn header doesn't directly support themes and because the code in the WM_DRAWITEM message handler becomes a bit more complicated when there are two owner drawn controls, a custom drawn header is the preferred technique. Custom drawn header The basic code is shown in CustomDrawn\FirstTest.au3. SelectedRows1.au3 implements selected items. If you select 10 items in a row so that a completely blue rectangle is created, and scrolls very quickly back and forth in the horizontal scrollbar, a lot of flicker occurs in the listview, especially in the blue rectangle. The flicker looks less violent if there are no selected rows. In SelectedRows2.au3 attempts have been made to reduce flicker. If you keep an eye on the header control when scrolling quickly in the horizontal scrollbar, the header is updated much fewer times than the listview. This generates much less flicker in the header. The reason why the header is updated fewer times is because the header isn't built into the listview but is an independent child window. The LVN_ENDSCROLL code updates the header and listview equally many times. But the header has to wait for WM_PAINT messages before it's updated. And a WM_PAINT message isn't generated until there is a delay in the number of WM_DRAWITEM messages. Ie. when there is a slight pause in the movement of the thumb in the horizontal scrollbar. The idea to reduce flicker in the listview is only to update the subitem texts most times, and to update visual features and effects eg. selected rows that is the cause of the most flicker very few times. This also improves performance during fast scrolls in the horizontal scrollbar. It doesn't take a lot of code just to update the subitem texts. Updating visual features and effects requires a lot more code. To get an overview of the Windows messages and notifications and the order of the messages, a message monitor is indispensable. ReSizeColumns.au3 demonstrates how to resize listview columns. Header item widths and texts are dynamically updated through NM_CUSTOMDRAW notifications when listview columns are scrolled horizontally. When a header item width is updated, it'll automatically generate new NM_CUSTOMDRAW notifications to update the text of the current header item and all header items to the right of the current one. The critical code is to avoid an endless loop of NM_CUSTOMDRAW notifications. Here too, a message monitor is indispensable. GoToRowColumn.au3 implements code to go to a spicific row/column in the listview. Right click ListView, update row/column numbers in GUI and press Enter. OneMillionColumns.au3 is an example with 1,000,000 columns. This example should be run on Windows 10 as 64 bit code only. ShowRowNumbers.au3. If row numbers are needed in a standard few-column listview, the first column is usually used for row numbers. But this doesn't work well in a listview with many columns. Here it's better to use an extra listview to the left for row numbers. When scrolling with the vertical scrollbar, the row numbers are updated accordingly. Note that the row numbers are updated discretely in the same way as the header when scrolling in the horizontal scroll bar. There is no keyboard support in this example. If you press End to go to the last row, the row numbers are not updated. I'll add a new example with keyboard support. KeyboardNavigation1.au3 (as well as 2 and 3) has keyboard support to navigate the listview with Home, End, PageUp and PageDown keys. Press Shift and one of the keys for horizontal navigation. As there is no selected row or cell in the examples, there is no support for the arrow keys. Especially Shift+Pageup/Down generates a lot of flicker in KeyboardNavigation1.au3. KeyboardNavigation2.au3 and KeyboardNavigation3.au3 are attempts to reduce flicker. In KeyboardNavigation2.au3, auto repeat of the PageUp/Down keys is disabled. In KeyboardNavigation3.au3, only the top/left row/column is updated when PageUp/Down is kept pressed constantly. Note that in these listviews with both many rows and many columns, performance and flicker appear to be two sides of the same coin. The better performance the less flicker and vice versa. MarkCurrentCell1.au3. Click to mark a cell. Click again to unmark the cell. No keyboard support. It looks like this: MarkCurrentCell2-4.au3 has keyboard support through the arrow keys as well as Home, End, PageUp and PageDown. Use Shift+Home/End/PageUp/PageDown for horizontal navigation. MarkCurrentCell3-4.au3 is an attempt to reduce flicker when PageUp/Down is kept pressed constantly. EditMarkedCell.au3 is based on MarkCurrentCell2.au3 and can be used to edit the text in the marked cell. Double-click or press Enter to edit the cell text. Press Esc or Enter in the edit box to cancel or accept the new cell text. ResizeGui.au3 is based on ShowRowNumbers.au3 and demonstrates a resizable GUI. Usage of many-column listviews A many-column listview with built-in header that supports a medium number of columns can be used as a regular listview. An ordinary listview performs poorly when there are many columns. This many-column listview based on owner drawn and virtual listview styles performs much better with the ability to optimize performance in specific situations. It may be difficult to imagine a usage for many-column listviews with a custom header that supports a large number of columns. May be such a listview can be better regarded as a kind of grid control, that eg. can be used for visual editing of an array or SQLite table. You can imagine a 2d-array with 1000 rows and 1000 columns. The data source in EditMarkedCell.au3 is exactly such an array. Zip-file The zip-file contains source files for examples and includes. You need AutoIt 3.3.12 or later. Tested on Windows 7 and Windows 10. The examples should run on all Windows versions. If necessary, reduce the number of rows and especially columns on older versions. Comments are welcome. Let me know if there are any issues. ManyColumns.7z1 point
-
You are using ShellExecuteWait. The script is not going to do anything until the mmc.exe is closed. Use ShellExecute instead, and WinWaitActive. Adam1 point
-
Accidentally overwritten my script and closed out SciTE
Earthshine reacted to TheDcoder for a topic
The bots are getting smarter...1 point -
Accidentally overwritten my script and closed out SciTE
Earthshine reacted to Jos for a topic
Maybe they are spamming?1 point -
List folders
Ezren1234 reacted to pixelsearch for a topic
Hello Ezren1234, You need the $GLOBE variable to reflect the item selected in your list. Try to change this : Case $List_3 $GLOBE = "C:\Users\david.wa\Desktop\Month End\2019\SEPT" by that : Case $List_3 $GLOBE = "C:\Users\david.wa\Desktop\Month End\2019\" & GUICtrlRead($List_3) Now each time you select a month in the left panel ($List_3) it will display its subfolders in the right panel ($List_6) like in the following picture : Also, you need to blank $List_6 (right panel) each time something is gonna be displayed in it. 2 lines should do it : #include <GuiListBox.au3> ; at the beginning of script _GUICtrlListBox_ResetContent ($List_6) ; you sure will find where to place that line :) Good luck1 point -
Implementing subitem checkboxes in a listview is super simple: #AutoIt3Wrapper_Au3Check_Parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6 -w 7 Opt( "MustDeclareVars", 1 ) #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> #include <GuiListView.au3> Global $idListView, $hListView Example() Func Example() ; Create GUI GUICreate( "Listview with subitem checkboxes", 800, 598+20 ) ; Create ListView $idListView = GUICtrlCreateListView( "", 10, 10, 800-20, 598, $GUI_SS_DEFAULT_LISTVIEW, $WS_EX_CLIENTEDGE ) _GUICtrlListView_SetExtendedListViewStyle( $idListView, $LVS_EX_DOUBLEBUFFER+$LVS_EX_SUBITEMIMAGES ) ; Subitem images $hListView = GUICtrlGetHandle( $idListView ) ; ImageList Local $idListView2 = GUICtrlCreateListView( "", 0, 0, 1, 1 ) ; 1x1 pixel listview to create state image list with checkbox icons _GUICtrlListView_SetExtendedListViewStyle( $idListView2, $LVS_EX_CHECKBOXES ) ; The $LVS_EX_CHECKBOXES style forces the state image list to be created Local $hImageList = _GUICtrlListView_GetImageList( $idListView2, 2 ) ; Get the state image list with unchecked and checked checkbox icons _GUICtrlListView_SetImageList( $idListView, $hImageList, 1 ) ; Set the state image list as a normal small icon image list in $idListView ; Now the checkboxes can be handled like normal subitem icons ; Add 10 columns For $i = 0 To 9 _GUICtrlListView_AddColumn( $idListView, "Col " & $i, 75 ) Next ; Add 100 rows For $i = 0 To 100 - 1 _GUICtrlListView_AddItem( $idListView, $i, 0 ) ; Image index 0 = unchecked checkbox For $j = 1 To 9 _GUICtrlListView_AddSubItem( $idListView, $i, $i & " / " & $j, $j, 0 ) ; Image index 0 = unchecked checkbox Next Next ; WM_NOTIFY message handler to toggle checkboxes GUIRegisterMsg( $WM_NOTIFY, "WM_NOTIFY" ) ; Show GUI GUISetState( @SW_SHOW ) ; Message loop While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE ExitLoop EndSwitch WEnd ; Cleanup GUIDelete() EndFunc ; Message handler to toggle checkboxes Func WM_NOTIFY( $hWnd, $iMsg, $wParam, $lParam ) Local $tNMHDR = DllStructCreate( $tagNMHDR, $lParam ) Switch HWnd( DllStructGetData( $tNMHDR, "hWndFrom" ) ) Case $hListView Switch DllStructGetData( $tNMHDR, "Code" ) Case $NM_CLICK Local $aHit = _GUICtrlListView_SubItemHitTest( $hListView ) If $aHit[0] >= 0 And $aHit[1] >= 0 Then ; Item and subitem Local $iIcon = _GUICtrlListView_GetItemImage( $idListView, $aHit[0], $aHit[1] ) ; Get checkbox icon _GUICtrlListView_SetItemImage( $idListView, $aHit[0], $iIcon = 0 ? 1 : 0, $aHit[1] ) ; Toggle checkbox icon _GUICtrlListView_RedrawItems( $idListView, $aHit[0], $aHit[0] ) ; Redraw listview item EndIf EndSwitch EndSwitch Return $GUI_RUNDEFMSG #forceref $hWnd, $iMsg, $wParam EndFunc The idea is addressed in this example.1 point
-
Here's how you get the Administrators groupname, no matter what language: $oWMIService = ObjGet("winmgmts:\\" & @ComputerName & "\root\cimv2") $colItems = $oWMIService.ExecQuery("Select * From Win32_Group Where LocalAccount = TRUE And SID = 'S-1-5-32-544'") For $oItem in $colItems ConsoleWrite($oItem.Name ) Next1 point
-
Accidentally overwritten my script and closed out SciTE
Earthshine reacted to Jugh for a topic
Hi, if you have overwritten the file, you may need to apply a third-party tool, I think you can try the *snip* tool, it supports deep scan, maybe it can help you recover overwritten data. You can just have a try, hope can help you.0 points