Leaderboard
Popular Content
Showing content with the highest reputation on 11/01/2015 in all areas
-
Version 1.0.1.6
757 downloads
Mp3SilenceRemover can trim a bunch of mp3 files that have silence at the beginnings and ends, automatically. Script scans each file for when the sound starts and ends, by detecting a pre-determined silence threshold, then reencode them without silent parts found. Usefull if you want use mp3 files for a mix or avoid long silences between tracks. Multiple settings are available for preserving mp3 quality. Mp3Gain can be used for avoid a too big difference in sound level between 2 tracks. Main Id3 Tags can be preserved and the fade at end of the track too. Script use : bass.dll, bassenc.dll, bassext.dll, tags.dll, lame.exe and mp3gain.exe.1 point -
Windows Environment Variables Viewer
coffeeturtle reacted to wakillon for a topic
There is several ways to get programmatically Windows Environment Variables : - using "set" cmd line tool. - using objWMIService with Win32_Environment. - reading HKLM\SYSTEM\CurrentControlSet\Control\Session Manager\Environment. but also using the WinAPi GetEnvironmentStrings function. Here is the Ansi version : #NoTrayIcon #Region ;************ Includes ************ #Include <WindowsConstants.au3> #Include <GUIConstantsEx.au3> #Include <GuiListView.au3> #Include <WinAPIMisc.au3> #Include <GuiMenu.au3> #EndRegion ;************ Includes ************ Opt ( 'GUIResizeMode', $GUI_DOCKAUTO ) Opt ( 'MustDeclareVars', 1 ) Global $hGui, $hListview, $iGuiWidth, $iGuiHeight, $aEnvVariables, $iIndex, $hLVMenu, $bRightClick = False Global $iExport, $sExportFilePath, $sTxt, $hFile Global Enum $iId_Copy = 3000, $Id_Save $aEnvVariables = _WinApi_GetEnvironmentStringsA() _Gui() For $i = 0 To UBound ( $aEnvVariables ) -1 $iIndex = _GUICtrlListView_AddItem ( $hListview, $aEnvVariables[$i][0], -1, 0 ) _GUICtrlListView_AddSubItem ( $hListView, $iIndex, $aEnvVariables[$i][1], 1 ) Next #Region ------ Main Loop ------------------------------ While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE GUIDelete ( $hGui ) Exit Case Else If $bRightClick = True Then $bRightClick = False $hLVMenu = _GUICtrlMenu_CreatePopup() If _GUICtrlMenu_IsMenu ( $hLVMenu ) Then _GUICtrlMenu_InsertMenuItem ( $hLVMenu, 0, 'Copy Selected Variable Name', $iId_Copy ) _GUICtrlMenu_InsertMenuItem ( $hLVMenu, 1, 'Export Variables List', $Id_Save ) _GUICtrlMenu_SetMenuStyle ( $hLVMenu, BitOR ( $MNS_CHECKORBMP, $MNS_AUTODISMISS, $MNS_NOCHECK ) ) _GUICtrlMenu_TrackPopupMenu ( $hLVMenu, $hGui ) _GUICtrlMenu_DestroyMenu ( $hLVMenu ) $hLVMenu = 0 EndIf EndIf If $iExport Then $iExport = 0 $sExportFilePath = FileSaveDialog ( 'Export Variables List', '', 'Text Files (*.txt;*.csv)|All Files (*.*)', 2+16, 'Windows Environment Variables List', $hgui ) If Not @error Then $sTxt = '' For $i = 0 To UBound ( $aEnvVariables ) -1 $sTxt &= StringStripWS ( $aEnvVariables[$i][0], 7 ) & ' : ' & StringStripWS ( $aEnvVariables[$i][1], 7 ) & @CRLF Next $hFile = FileOpen ( $sExportFilePath, 2+8+512 ) FileWrite ( $hFile, $sTxt ) FileClose ( $hFile ) EndIf EndIf EndSwitch Sleep ( 10 ) WEnd #EndRegion --- Main Loop ------------------------------ Func _Gui() $hGui = GUICreate ( 'Windows Environment Variables Viewer', 700, 600, -1, -1, BitOR ( $WS_MINIMIZEBOX, $WS_MAXIMIZEBOX, $WS_SYSMENU, $WS_SIZEBOX ) ) GUICtrlCreateListView ( 'Environment Variable Names|Values', 10, 10, 680, 555 ) $hListview = GUICtrlGetHandle ( -1 ) _GUICtrlListView_SetColumnWidth ( $hListview, 0, 220 ) _GUICtrlListView_SetColumnWidth ( $hListview, 1, @DesktopWidth - 270 ) Local $aPos = WinGetPos( $hGui ) $iGuiWidth = $aPos[2] $iGuiHeight = $aPos[3] GUIRegisterMsg ( $WM_GETMINMAXINFO, '_WM_GETMINMAXINFO' ) GUIRegisterMsg ( $WM_NOTIFY, '_WM_NOTIFY' ) GUIRegisterMsg ( $WM_COMMAND, '_WM_COMMAND' ) GUISetState() EndFunc ;==> _Gui() Func _WinApi_FreeEnvironmentStringsA ( $pEnv ) ; https://msdn.microsoft.com/en-us/library/windows/desktop/ms683151(v=vs.85).aspx Local $aRet = DllCall ( 'kernel32.dll', 'int', 'FreeEnvironmentStringsA', 'ptr', $pEnv ) If Not @error And $aRet[1] <> 0 Then Return SetError ( 0, @extended, $aRet[1] ) Return SetError ( @error, 0, 0 ) EndFunc ;==> _WinApi_FreeEnvironmentStringsA() Func _WinApi_GetEnvironmentStringsA() ; https://msdn.microsoft.com/en-us/library/windows/desktop/ms683187(v=vs.85).aspx Local $pEnvBlock, $iPtrStringLen, $tEnvString, $aSplit, $aRet, $sEnvString, $aEnvString[0][2] $aRet = DllCall ( 'kernel32.dll', 'ptr', 'GetEnvironmentStringsA' ) ; GetEnvironmentStringsA returns OEM characters. If @error Then Return SetError ( @error, @extended, '' ) $pEnvBlock = $aRet[0] ; pointer to a block of memory that contains the environment variables. If Not IsPtr ( $pEnvBlock ) Then Return SetError ( -1, 0, '' ) While 1 $iPtrStringLen = _WinAPI_StringLenA ( $pEnvBlock ) If $iPtrStringLen > 0 Then $tEnvString = DllStructCreate ( 'char[' & $iPtrStringLen + 1 & ']', $pEnvBlock ) $sEnvString = _WinAPI_OemToChar ( DllStructGetData ( $tEnvString, 1 ) ) ; Convert Oem to Ansi. If StringLeft ( $sEnvString, 1 ) <> '=' Then $aSplit = StringSplit ( $sEnvString, '=', 1+2 ) If Not @error Then ReDim $aEnvString[UBound ( $aEnvString )+1][2] $aEnvString[UBound ( $aEnvString )-1][0] = $aSplit[0] ; name $aEnvString[UBound ( $aEnvString )-1][1] = $aSplit[1] ; value EndIf EndIf $pEnvBlock += $iPtrStringLen + 1 Else _WinApi_FreeEnvironmentStringsA ( $pEnvBlock ) ; Free memory block. $tEnvString = 0 Return SetError ( 0, 0, $aEnvString ) EndIf WEnd EndFunc ;==> _WinApi_GetEnvironmentStringsA() Func _WM_COMMAND ( $hWnd, $iMsg, $wParam, $lParam ) #forceref $hWnd, $iMsg, $wParam, $lParam Switch $wParam Case $iId_Copy ClipPut ( _GUICtrlListView_GetItemText ( $hListview, _GUICtrlListView_GetSelectedIndices ( $hListview ), 0 ) ) Case $Id_Save $iExport = 1 EndSwitch EndFunc ;==> _WM_COMMAND() Func _WM_GETMINMAXINFO ( $hWnd, $iMsg, $wParam, $lParam ) #forceref $hWnd, $iMsg, $wParam, $lParam Switch $hWnd Case $hGui Local $tMinMaxInfo = DllStructCreate ( 'int;int;int;int;int;int;int;int', $lParam ) DllStructSetData ( $tMinMaxInfo, 7, $iGuiWidth ) ; min w DllStructSetData ( $tMinMaxInfo, 8, $iGuiHeight ) ; min h $tMinMaxInfo = 0 ; Release resource. EndSwitch EndFunc ;==> _WM_GETMINMAXINFO() Func _WM_NOTIFY ( $hWnd, $iMsg, $wParam, $lParam ) #forceref $hWnd, $iMsg, $wParam, $lParam Local $hWndFrom, $iCode, $tNMHDR, $tInfo $tNMHDR = DllStructCreate ( $tagNMLISTVIEW, $lParam ) $hWndFrom = HWnd ( DllStructGetData ( $tNMHDR, 'hWndFrom' ) ) $iCode = DllStructGetData ( $tNMHDR, 'Code' ) $tInfo = DllStructCreate ( $tagNMLISTVIEW, $lParam ) Switch $hWndFrom Case $hListView Switch $iCode Case $NM_RCLICK If DllStructGetData ( $tInfo, 'Item' ) >= 0 Then If $hLVMenu <> 0 Then _GUICtrlMenu_DestroyMenu ( $hLVMenu ) $hLVMenu = 0 $bRightClick = True EndIf EndSwitch EndSwitch $tInfo = 0 $tNMHDR = 0 Return $GUI_RUNDEFMSG EndFunc ;==> _WM_NOTIFY()Tested under Win XP SP3x86 and Win 8.1x641 point -
kcvinu, And what ControlID do you think is returned when you create the button? M231 point
-
always is 3 because autoit create two hidden controls internally. maybe internally use a counter for HMENU parameter of CreateWindowEx. Saludos1 point
-
kcvinu, As I explained above, the control ControlIDs start from 3, so using a lower value in a ControlID parameter will not affect any existing control. Thus in this case nothing is deleted and the next created control will follow on from the earlier sequence. M231 point
-
kcvinu, The first ControlID returned has always been 3 since I started using AutoIt - you will have to ask Jon why, but I imagine that the earlier elements are used for other things that AutoIt needs to track. M231 point
-
kcvinu, AutoIt ControlIDs are actually the index numbers of the internal array that AutoIt uses to track the native created controls. They are usually in numerical order, but to save space, the first empty index is used - this means that deleting controls will allow the same ControlID to be reused, as you can see here: #include <GUIConstantsEx.au3> $hGUI = GUICreate("Test", 500, 500) For $i = 0 To 9 $cCID = GUICtrlCreateLabel("", 10, 10 + (20 * $i), 200, 20) GUICtrlSetData($cCID, $cCID) Next $cReuse = GUICtrlCreateButton("Delete/Recreate", 10, 450, 100, 30) GUISetState() While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE Exit Case $cReuse GUICtrlDelete(5) $cCID = GUICtrlCreateLabel("", 10, 10 + (20 * $i), 200, 20) GUICtrlSetData($cCID, $cCID) EndSwitch WEndM231 point
-
Look inside SciTEConfig for the code that set's up the the "Edit Colors" window. I use a For..Next loop to create the 3 columns of CheckBoxes and also a For..Next loop to see which are checked/ Jos1 point
-
Yes I'm looping through all controls ID and check if is a Edit box. starting from first control ID (the first before the GUI) till last one. this case $button3. Saludos1 point
-
Here is a version without the menu, toolbar, tab control and status bar. You can zoom image, move image and resize GUI. images\Image.bmp is opened on startup. Add a new post if you have more questions. Regards Lars. Navigating.7z1 point
-
incepator, And here is the drag with a native ListView: #include <GuiConstantsEx.au3> #include <WindowsConstants.au3> #include <GuiTreeView.au3> Global $fDragging = False $hGUI = GUICreate("Test", 300, 200) $cTreeView = GUICtrlCreateTreeView(10, 10, 140, 140) $cTreeView_0 = GUICtrlCreateTreeViewItem("Base1", $cTreeView) GUICtrlCreateTreeViewItem("test1", $cTreeView_0) GUICtrlCreateTreeViewItem("test2", $cTreeView_0) GUICtrlCreateTreeViewItem("test3", $cTreeView_0) $cTreeView_2 = GUICtrlCreateTreeViewItem("Base2", $cTreeView) GUICtrlCreateTreeViewItem("test4", $cTreeView_2) GUICtrlCreateTreeViewItem("test5", $cTreeView_2) GUICtrlSetState($cTreeView_0, $GUI_EXPAND) GUICtrlSetState($cTreeView_2, $GUI_EXPAND) $cListView = GUICtrlCreateListView("Items ", 160, 10, 120, 140) GUISetState(@SW_SHOW, $hGUI) While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE Exit Case $GUI_EVENT_PRIMARYUP If $fDragging Then $fDragging = False ; Look for ListView under cursor $aCInfo = GUIGetCursorInfo($hGUI) If $aCInfo[4] = $cListView Then ; Get handle and text of clicked item $hDragItem = GUICtrlGetHandle(GUICtrlRead($cTreeView)) $sDragText = _GUICtrlTreeView_GetText($cTreeView, $hDragItem) ; If not at level 0 If _GUICtrlTreeView_Level($cTreeView, $hDragItem) Then ; Insert in ListView GUICtrlCreateListViewItem($sDragText, $cListView) EndIf EndIf EndIf Case $GUI_EVENT_PRIMARYDOWN ; Look for ListView under cursor $aCInfo = GUIGetCursorInfo($hGUI) If $aCInfo[4] = $cTreeView Then $fDragging = True EndIf EndSwitch WEndM231 point
-
No worries and it helps to put a smiley behind it to indicate you were kidding. Jos1 point
-
Here another workaround: #include <GUIConstantsEx.au3> #include <GuiHeader.au3> #include <GuiImageList.au3> #include <GDIPlus.au3> #include <WindowsConstants.au3> Global $g_hGUI, $g_idMemo, $g_hHeader Example() Func Example() Local $g_hGUI, $tRect, $tPos, $iHeight_Column = 40 _GDIPlus_Startup() ; Create GUI $g_hGUI = GUICreate("Header", 400, 300) $g_hHeader = _GUICtrlHeader_Create($g_hGUI, $HDS_FLAT) _GUICtrlHeader_SetUnicodeFormat($g_hHeader, True) $g_idMemo = GUICtrlCreateEdit("", 1, 40, 398, 259, 0) GUICtrlSetFont($g_idMemo, 9, 400, 0, "Courier New") GUISetState(@SW_SHOW) $tRect = _WinAPI_GetClientRect( $g_hHeader ) $tPos = _GUICtrlHeader_Layout( $g_hHeader, $tRect ) _WinAPI_SetWindowPos( $g_hHeader, DllStructGetData( $tPos, "InsertAfter" ), _ DllStructGetData( $tPos, "X" ), DllStructGetData( $tPos, "Y" ), _ DllStructGetData( $tPos, "CX" ), $iHeight_Column, DllStructGetData( $tPos, "Flags" ) ) $hImage = _GUIImageList_Create(0, 0, 6) ; Add columns _GUICtrlHeader_AddItem($g_hHeader, "", 100, 1, 0) _GUICtrlHeader_AddItem($g_hHeader, "Column 2", 100, 0, 1) _GUICtrlHeader_AddItem($g_hHeader, "Column 3", 100, 0, 2) _GUICtrlHeader_AddItem($g_hHeader, "Column 4", 100) Local $iBgColor = _WinAPI_GetSysColor($COLOR_MENU) ;I don'T know which color index is the correct one ConsoleWrite(Hex($iBgColor, 6) & @CRLF) $hHBitmap = _GDIPlus_DrwTxt(" Line 1" & @CRLF & " Line 2", 90, $iHeight_Column, 0xFFFCFCFC) _GUICtrlHeader_SetItemBitmap($g_hHeader, 0, $hHBitmap) _GUICtrlHeader_SetImageList($g_hHeader, $hImage) ; Loop until the user exits. Do Until GUIGetMsg() = $GUI_EVENT_CLOSE _WinAPI_DeleteObject($hHBitmap) _GDIPlus_Shutdown() EndFunc ;==>Example Func _GDIPlus_DrwTxt($sText, $iW, $iH, $iBgColor = 0xFFF0F0F0, $iFontSize = 8.5, $sFont = "MS Shell Dlg", $iAlign = 0, $iFontColor = 0xFF000000, $bAntiAlias = False) Local Const $hBitmap = _GDIPlus_BitmapCreateFromScan0($iW, $iH) Local Const $hCtxt = _GDIPlus_ImageGetGraphicsContext($hBitmap) _GDIPlus_GraphicsClear($hCtxt, $iBgColor) If $bAntiAlias Then _GDIPlus_GraphicsSetSmoothingMode($hCtxt, 2) _GDIPlus_GraphicsSetTextRenderingHint($hCtxt, 4) EndIf Local Const $hBrush = _GDIPlus_BrushCreateSolid($iFontColor) Local Const $hFormat = _GDIPlus_StringFormatCreate() Local Const $hFamily = _GDIPlus_FontFamilyCreate($sFont) Local Const $hFont = _GDIPlus_FontCreate($hFamily, $iFontSize) _GDIPlus_StringFormatSetAlign($hFormat, $iAlign) _GDIPlus_StringFormatSetLineAlign($hFormat, 1) Local $tLayout = _GDIPlus_RectFCreate(0, 0, $iW, $iH) _GDIPlus_GraphicsDrawStringEx($hCtxt, $sText, $hFont, $tLayout, $hFormat, $hBrush) _GDIPlus_FontDispose($hFont) _GDIPlus_FontFamilyDispose($hFamily) _GDIPlus_StringFormatDispose($hFormat) _GDIPlus_BrushDispose($hBrush) _GDIPlus_GraphicsDispose($hCtxt) Local Const $hHBitmap = _GDIPlus_BitmapCreateHBITMAPFromBitmap($hBitmap) _GDIPlus_BitmapDispose($hBitmap) Return $hHBitmap EndFunc1 point
-
Header.au3 (run this): #include <WindowsConstants.au3> #include <GUIConstants.au3> #include <WinAPITheme.au3> #include <GuiListView.au3> #include <GuiHeader.au3> #include "DrawItem.au3" Opt( "MustDeclareVars", 1 ) Global $hHeader, $idHeaderOrder, $hLV, $aOrder = [ 0, 1, 2, 3 ] Global $aHeader = [ [ "Column 1", "", "" ], _ [ "Column 2", "Line 2", "" ], _ [ "Column 3", "Line 2", "Line 3" ], _ [ "Column 4", "Line 2", "" ] ] Example() Func Example() ; Create GUI Local $hGui = GUICreate( "ListView with multiple-line header", 400, 300, -1, 300 ) ; Create child Local $hChild = GUICreate( "", 380, 280, 10, 10, $WS_CHILD, -1, $hGui ) ; Create Header in child $hHeader = _GUICtrlHeader_Create( $hChild ) _GUICtrlHeader_AddItem( $hHeader, "", 95 ) _GUICtrlHeader_AddItem( $hHeader, "", 95 ) _GUICtrlHeader_AddItem( $hHeader, "", 95 ) _GUICtrlHeader_AddItem( $hHeader, "", 95 ) ; Doesn't work with themes _WinAPI_SetWindowTheme( $hHeader, "", "" ) ; Set all items owner drawn Local $tItem = DllStructCreate( $tagHDITEM ) For $i = 0 To 3 _GUICtrlHeader_GetItem( $hHeader, $i, $tItem ) DllStructSetData( $tItem, "Mask", $HDI_FORMAT ) DllStructSetData( $tItem, "Fmt", $HDF_OWNERDRAW ) _GUICtrlHeader_SetItem( $hHeader, $i, $tItem ) Next ; Set Header height Local $tRect = _WinAPI_GetClientRect( $hChild ) Local $tPos = _GUICtrlHeader_Layout( $hHeader, $tRect ) _WinAPI_SetWindowPos( $hHeader, DllStructGetData( $tPos, "InsertAfter" ), _ DllStructGetData( $tPos, "X" ), DllStructGetData( $tPos, "Y" ), _ DllStructGetData( $tPos, "CX" ), 54, DllStructGetData( $tPos, "Flags" ) ) ; Height = 54 ; Create ListView in child Local $idLV = GUICtrlCreateListView( "", 0, 54, 380, 280-54, $LVS_NOCOLUMNHEADER ) $hLV = GUICtrlGetHandle( $idLV ) _GUICtrlListView_AddColumn( $hLV, "Column 1", 94 ) _GUICtrlListView_AddColumn( $hLV, "Column 2", 94 ) _GUICtrlListView_AddColumn( $hLV, "Column 3", 94 ) _GUICtrlListView_AddColumn( $hLV, "Column 4", 94 ) For $i = 0 To 9 GUICtrlCreateListViewItem( $i & "/1|" & $i & "/2|" & $i & "/3|" & $i & "/4", $idLV ) Next ; Show child GUISetState() ; Switch to GUI GUISwitch( $hGui ) GUICtrlCreateLabel( "", 8, 8, 384, 58, 0x12 ) ; 0x12 = $SS_ETCHEDFRAME $idHeaderOrder = GUICtrlCreateDummy() GUIRegisterMsg( $WM_DRAWITEM, "WM_DRAWITEM" ) ; Draw Header item texts GUIRegisterMsg( $WM_NOTIFY, "WM_NOTIFY" ) ; Header events ; Show GUI GUISetState() Local $aMsg, $aOrderPrev = $aOrder, $aColValues[4], $aColWidths[4] While 1 $aMsg = GUIGetMsg( 1 ) Switch $aMsg[1] Case $hGui Switch $aMsg[0] Case $idHeaderOrder ; Get Header item order For $i = 0 To 3 $aOrder[$i] = _GUICtrlHeader_GetItemOrder( $hHeader, $i ) Next ; New order? If $aOrder[0] <> $aOrderPrev[0] Or $aOrder[1] <> $aOrderPrev[1] Or $aOrder[2] <> $aOrderPrev[2] Or $aOrder[3] <> $aOrderPrev[3] Then For $i = 0 To 3 $aColValues[$aOrder[$i]] = $i + 1 ; ListView column values $aColWidths[$aOrder[$i]] = _GUICtrlHeader_GetItemWidth( $hHeader, $i ) ; ListView column widths Next _GUICtrlListView_BeginUpdate( $hLV ) _GUICtrlListView_DeleteAllItems( $hLV ) For $i = 0 To 3 _GUICtrlListView_SetColumnWidth( $hLV, $i, $aColWidths[$i] ) ; Set ListView column widths Next For $i = 0 To 9 ; Set ListView column values GUICtrlCreateListViewItem( $i & "/" & $aColValues[0] & "|" & $i & "/" & $aColValues[1] & "|" & $i & "/" & $aColValues[2] & "|" & $i & "/" & $aColValues[3], $idLV ) Next _GUICtrlListView_EndUpdate( $hLV ) $aOrderPrev = $aOrder EndIf Case $GUI_EVENT_CLOSE ExitLoop EndSwitch EndSwitch WEnd EndFunc Func WM_NOTIFY( $hWnd, $iMsg, $wParam, $lParam ) #forceref $hWnd, $iMsg, $wParam Local $tNMHDR = DllStructCreate( $tagNMHDR, $lParam ) Local $hWndFrom = HWnd( DllStructGetData( $tNMHDR, "hWndFrom" ) ) Local $iCode = DllStructGetData( $tNMHDR, "Code" ) Switch $hWndFrom Case $hHeader Switch $iCode Case $HDN_TRACK, $HDN_TRACKW ; Header item width change (dragging the delimiter) Local $tNMHEADER = DllStructCreate( $tagNMHEADER, $lParam ), $tItem = DllStructCreate( $tagHDITEM, DllStructGetData( $tNMHEADER, "pItem" ) ) If BitAND( DllStructGetData( $tItem, "Mask" ), $HDI_WIDTH ) Then _GUICtrlListView_SetColumnWidth( $hLV, $aOrder[DllStructGetData( $tNMHEADER, "Item" )], DllStructGetData( $tItem, "XY" ) ) Case $HDN_ENDDRAG ; Dragging Header item finished GUICtrlSendToDummy( $idHeaderOrder ) EndSwitch EndSwitch Return $GUI_RUNDEFMSG EndFunc Func WM_DRAWITEM( $hWnd, $iMsg, $wParam, $lParam ) #forceref $hWnd, $iMsg, $wParam Local $tDRAWITEM = DllStructCreate( $tagDRAWITEM, $lParam ) If DllStructGetData( $tDRAWITEM, "CtlType" ) <> $ODT_HEADER Then Return $GUI_RUNDEFMSG Switch DllStructGetData( $tDRAWITEM, "hwndItem" ) Case $hHeader Switch DllStructGetData( $tDRAWITEM, "itemAction" ) Case $ODA_DRAWENTIRE ; Set Header item texts Local $hDC = DllStructGetData( $tDRAWITEM, "hDC" ) DllStructSetData( $tDRAWITEM, "Left", DllStructGetData($tDRAWITEM, "Left") + 6 ) ; 6 pixel left margin DllStructSetData( $tDRAWITEM, "Top", DllStructGetData($tDRAWITEM, "Top") + 6 ) ; 6 pixel top margin Switch DllStructGetData( $tDRAWITEM, "itemID" ) Case 0 DllCall( "user32.dll", "int", "DrawTextW", "handle", $hDC, "wstr", $aHeader[0][0], "int", StringLen( $aHeader[0][0] ), "ptr", DllStructGetPtr($tDRAWITEM, "Left"), "uint", 0 ) ; _WinAPI_DrawText Case 1 DllCall( "user32.dll", "int", "DrawTextW", "handle", $hDC, "wstr", $aHeader[1][0], "int", StringLen( $aHeader[1][0] ), "ptr", DllStructGetPtr($tDRAWITEM, "Left"), "uint", 0 ) ; _WinAPI_DrawText DllStructSetData( $tDRAWITEM, "Top", DllStructGetData($tDRAWITEM, "Top") + 14 ) ; 14 pixels between lines DllCall( "user32.dll", "int", "DrawTextW", "handle", $hDC, "wstr", $aHeader[1][1], "int", StringLen( $aHeader[1][1] ), "ptr", DllStructGetPtr($tDRAWITEM, "Left"), "uint", 0 ) ; _WinAPI_DrawText Case 2 DllCall( "user32.dll", "int", "DrawTextW", "handle", $hDC, "wstr", $aHeader[2][0], "int", StringLen( $aHeader[2][0] ), "ptr", DllStructGetPtr($tDRAWITEM, "Left"), "uint", 0 ) ; _WinAPI_DrawText DllStructSetData( $tDRAWITEM, "Top", DllStructGetData($tDRAWITEM, "Top") + 14 ) ; 14 pixels between lines DllCall( "user32.dll", "int", "DrawTextW", "handle", $hDC, "wstr", $aHeader[2][1], "int", StringLen( $aHeader[2][1] ), "ptr", DllStructGetPtr($tDRAWITEM, "Left"), "uint", 0 ) ; _WinAPI_DrawText DllStructSetData( $tDRAWITEM, "Top", DllStructGetData($tDRAWITEM, "Top") + 14 ) ; 14 pixels between lines DllCall( "user32.dll", "int", "DrawTextW", "handle", $hDC, "wstr", $aHeader[2][2], "int", StringLen( $aHeader[2][2] ), "ptr", DllStructGetPtr($tDRAWITEM, "Left"), "uint", 0 ) ; _WinAPI_DrawText Case 3 DllCall( "user32.dll", "int", "DrawTextW", "handle", $hDC, "wstr", $aHeader[3][0], "int", StringLen( $aHeader[3][0] ), "ptr", DllStructGetPtr($tDRAWITEM, "Left"), "uint", 0 ) ; _WinAPI_DrawText DllStructSetData( $tDRAWITEM, "Top", DllStructGetData($tDRAWITEM, "Top") + 14 ) ; 14 pixels between lines DllCall( "user32.dll", "int", "DrawTextW", "handle", $hDC, "wstr", $aHeader[3][1], "int", StringLen( $aHeader[3][1] ), "ptr", DllStructGetPtr($tDRAWITEM, "Left"), "uint", 0 ) ; _WinAPI_DrawText EndSwitch EndSwitch EndSwitch Return $GUI_RUNDEFMSG EndFunc DrawItem.au3 (you need this): #include-once #include <StructureConstants.au3> Global Const $tagDRAWITEM = _ "uint CtlType;" & _ "uint CtlID;" & _ "uint itemID;" & _ "uint itemAction;" & _ "uint itemState;" & _ "hwnd hwndItem;" & _ "handle hDC;" & _ $tagRECT & ";" & _ ; longs: Left, Top, Right, Bottom "ulong_ptr itemData" ; CtlType constants Global Const $ODT_MENU = 1 Global Const $ODT_LISTBOX = 2 Global Const $ODT_COMBOBOX = 3 Global Const $ODT_BUTTON = 4 Global Const $ODT_STATIC = 5 Global Const $ODT_HEADER = 100 Global Const $ODT_TAB = 101 Global Const $ODT_LISTVIEW = 102 ; itemAction constants Global Const $ODA_DRAWENTIRE = 0x0001 Global Const $ODA_SELECT = 0x0002 Global Const $ODA_FOCUS = 0x0004 ; itemState constants Global Const $ODS_SELECTED = 0x0001 Global Const $ODS_GRAYED = 0x0002 Global Const $ODS_DISABLED = 0x0004 Global Const $ODS_CHECKED = 0x0008 Global Const $ODS_FOCUS = 0x0010 Global Const $ODS_DEFAULT = 0x0020 Global Const $ODS_HOTLIGHT = 0x0040 Global Const $ODS_INACTIVE = 0x0080 Global Const $ODS_NOACCEL = 0x0100 Global Const $ODS_NOFOCUSRECT = 0x0200 Global Const $ODS_COMBOBOXEDIT = 0x10001 point
-
Alda: Music programming language
JAPP reacted to jvanegmond for a topic
http://daveyarwood.github.io/alda/2015/09/05/alda-a-manifesto-and-gentle-introduction/1 point -
For get bits you can do it using AutoIt ways. Local $sFile="12-1234.wav" Local $tData=DllStructCreate("byte Data[" & FileGetSize($sFile) & "]") $tData.Data=FileRead($sFile) Local $tInfo=DllStructCreate("byte Data[34];word Bits",DllStructGetPtr($tData)) MsgBox(0,"",$tInfo.Bits)Saludos1 point
-
As many are aware, the standard AutoIt Send() function can leave modifier keys (usually Shift, Alt, Ctrl) in a pressed-like state. While there are at least a few alternatives that can be found on this forum, as well as one in the Wiki (which i can't find at the moment), they have all failed me at some point, leaving a modifier key "stuck". So far i have had no issues with this function however. LAST UPDATED: 21-SEP-2014 #include-once ; #FUNCTION# ==================================================================================================================== ; Name ..........: _SendEx ; Description ...: alternative to built-in Send() function which prevents modifier keys from being left in a pressed state ; Syntax ........: _SendEx($sSendKeys[, $iTimeout[, $sReleaseKeys[, $hUser32Dll]]]) ; Parameters ....: $sSendKeys - string of keys to send in Send() format ; $hUser32Dll - [optional] handle to user32.dll ; $iTimeout - [optional] maximum time in ms to attempt to release pressed keys (minimum = 250) ; $sReleaseKeys - [optional] comma seperated string of keys to release before issuing Send() (no spaces). ; defaults to: Shift, Ctrl, Alt, L Win, R Win ; Return values .: Success returns 1, else sets @error to 1 and returns an error message string ; Release date ..: 25-May-2014 ; Modify date ...: 21-Sep-2014 ; Author ........: iCode ; Modified by ...: ; Remarks .......: ; Related .......: Send() ; Link ..........: ; Example .......: No ; =============================================================================================================================== Func _SendEx($sSendKeys, $hUser32Dll = "", $iTimeout = 2000, $sReleaseKeys = "0x10,0x11,0x12,0x5B,0x5C") Local $bCloseDll, $sRet Local $iDelay = Opt("SendKeyDelay") + Opt("SendKeyDownDelay") If $iDelay < 50 Then $iDelay = 50 Local $aReleaseKeys = StringSplit($sReleaseKeys, ",") If @error Then Return SetError(1, 0, "Failed to create release key array") If $hUser32Dll <> "user32.dll" Then $hUser32Dll = DllOpen("user32.dll") If @error Then Return SetError(1, 0, "Failed to open handle to user32.dll") $bCloseDll = True EndIf $sRet = __ReleaseKeys($aReleaseKeys, $iTimeout, $hUser32Dll) If Not @error Then Send($sSendKeys) Sleep($iDelay) $sRet = __ReleaseKeys($aReleaseKeys, $iTimeout, $hUser32Dll) EndIf If $bCloseDll Then DllClose("user32.dll") If $sRet Then Return SetError(1, 0, $sRet) Return 1 EndFunc ; #INTERNAL_USE_ONLY# =========================================================================================================== ; Name ..........: __ReleaseKeys ; Description ...: release pressed keys ; Syntax ........: __ReleaseKeys(Byref $aReleaseKeys, $iTimeout, $hUser32Dll) ; Parameters ....: $aReleaseKeys - [in/out] An array of unknowns. ; $iTimeout - An integer value. ; $hUser32Dll - A handle value. ; Return values .: None ; Author ........: iCode ; Modified ......: 25-May-2014 ; Remarks .......: ; Related .......: ; Link ..........: ; Example .......: No ; =============================================================================================================================== Func __ReleaseKeys(ByRef $aReleaseKeys, $iTimeout, $hUser32Dll) If $iTimeout < 50 Then $iTimeout = 250 Local $aRet, $hTimer = TimerInit() For $i = 0 To UBound($aReleaseKeys) - 1 $aRet = DllCall($hUser32Dll, "short", "GetAsyncKeyState", "int", $aReleaseKeys[$i]) If @error Then Return SetError(1, 0, "Dll call GetAsyncKeyState failed with key: " & $aReleaseKeys[$i]) If BitAND($aRet[0], 0x8000) <> 0 Then Do Sleep(100) DllCall($hUser32Dll, "int", "keybd_event", "int", $aReleaseKeys[$i], "int", 0, "long", 2, "long", 0) If @error Then Return SetError(1, 0, "Dll call keybd_event failed with key: " & $aReleaseKeys[$i]) $aRet = DllCall($hUser32Dll, "short", "GetAsyncKeyState", "int", $aReleaseKeys[$i]) If TimerDiff($hTimer) >= $iTimeout Then Return SetError(1, 0, "Time out limit reached") Until BitAND($aRet[0], 0x8000) = 0 EndIf Next EndFunc Change log... 29-JUN-2014 - changed the order of the parameters for _SendEx, moving $sReleaseKeys to the last position 21-SEP-2014 - in the interest of efficiency, i removed the StringStripWS() function - $sReleaseKeys can no longer have spaces in the string1 point