Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation since 11/22/2024 in all areas

  1. Hi all, I've just been playing with window messages that are sent to win32 controls themselves (rather than to the parent GUI), and it looks like you can do some cool stuff. So I thought I'd share some things that I found interesting. And yeah I know the code probably needs a cleanup - but I figure its good enough to get the point across... Anyway what I have is: while the "lock" checkbox is selected, the buttons behave normally. Otherwise you can drag them around and/or resize them. Because you're essentially dragging the buttons by their "Caption" bar, double clicking will also maximise them. #include <guiConstants.au3> #include <winapi.au3> Global Const $DLGC_BUTTON = 0x2000 Global Const $DLGC_WANTTAB = 0x0002 Global $hGui = GUICreate("", 300, 200) Global $idBtn = GUICtrlCreateButton("Button 1", 4, 4, 80, 80) Global $idBtn2 = GUICtrlCreateButton("Button 2", 90, 4, 80, 80) Global $idLockButtons = GUICtrlCreateCheckbox("Lock Buttons", 200, 20, 80, 20) Global $hCursor = _WinAPI_CopyCursor(_WinAPI_LoadCursor(0, $OCR_CROSS)) Global $hBtnMoveProc = DllCallbackRegister("ButtonMoveProc", "long", "hwnd;uint;wparam;lparam") Global $pBtnMoveProc = DllCallbackGetPtr($hBtnMoveProc) Global $hBtn = GUICtrlGetHandle($idBtn) Global $hBtn2 = GUICtrlGetHandle($idBtn2) Global $pOrigBtnProc = _WinAPI_SetWindowLong($hBtn, $GWL_WNDPROC, $pBtnMoveProc) _WinAPI_SetWindowLong($hBtn2, $GWL_WNDPROC, $pBtnMoveProc) GUISetState() While 1 Local $iMsg = GUIGetMsg() Switch $iMsg Case $GUI_EVENT_CLOSE Exit Case $idLockButtons _WinAPI_SetWindowLong($hBtn, $GWL_WNDPROC, (GUICtrlRead($iMsg) = $GUI_CHECKED) ? $pOrigBtnProc : $pBtnMoveProc) _WinAPI_SetWindowLong($hBtn2, $GWL_WNDPROC, (GUICtrlRead($iMsg) = $GUI_CHECKED) ? $pOrigBtnProc : $pBtnMoveProc) Case $idBtn, $idBtn2 ConsoleWrite("Click " & GUICtrlRead($iMsg) & @CRLF) EndSwitch WEnd Func ButtonMoveProc($hWnd, $uMsg, $wParam, $lParam) Local $aPos, $iRet, $aPoint[2], $iSrc, $iEvent Local $aRes = DllCallAddress("long", $pOrigBtnProc, "hwnd", $hWnd, "uint", $uMsg, "wparam", $wParam, "lparam", $lParam) Switch $uMsg Case $WM_NCHITTEST $aPos = WinGetPos($hWnd) $aPoint[0] = BitAND($lParam, 0xFFFF) $aPoint[1] = BitShift($lParam, 16) $iRet = $HTCAPTION If $aPoint[0] - $aPos[0] < 10 Then $iRet = $HTLEFT If $aPoint[0] - $aPos[0] > ($aPos[2] - 10) Then $iRet = $HTRIGHT If $aPoint[1] - $aPos[1] < 10 Then Switch $iRet Case $HTLEFT $iRet = $HTTOPLEFT Case $HTRIGHT $iRet = $HTTOPRIGHT Case Else $iRet = $HTTOP EndSwitch ElseIf $aPoint[1] - $aPos[1] > ($aPos[3] - 10) Then Switch $iRet Case $HTLEFT $iRet = $HTBOTTOMLEFT Case $HTRIGHT $iRet = $HTBOTTOMRIGHT Case Else $iRet = $HTBOTTOM EndSwitch EndIf Return $iRet Case $WM_SETCURSOR $iSrc = BitAND($lParam, 0xFFFF) $iEvent = BitShift($lParam, 16) If $iSrc = $HTCAPTION And $iEvent = $WM_LBUTTONDOWN Then _WinAPI_SetCursor($hCursor) Return True EndIf Case Else EndSwitch Return $aRes[0] ;~ Return _WinAPI_DefWindowProcW($hWnd, $uMsg, $wParam, $lParam) EndFunc ;==>ButtonProc
    6 points
  2. Nine

    x64 bitwise operations

    I needed a very fast x64 unsigned shift right, and doing it through an AutoIt array was way too slow. So I decided to make a .dll to perform such a task. While I was there, why not include all the bitwise operators that I know of. And then why not make a UDF. This is a bit like my wife does, she buys some draperies and then I end up repainting the whole room because the colors do not match anymore. Anyway, hope it can be useful for you too. Let me know if you have enhancements or comments, I will be glad to incorporate them (if possible). Version 2024-12-07 ASM * Code optimization (elimination of redundancy) Version 2024-12-06 ASM Func BitAND64 Func BitOR64 Func BitXOR64 Func BitSHIFT64 Func BitROTATE64 Func BitNOT64 Version 2020-04-27 DLL Func _BitAND64 Func _BitOR64 Func _BitXOR64 Func _BitEQV64 Func _BitIMP64 Func _BitSHIFT64 Func _BitROTATE64 Func _BitNOT64 Func _x64CloseDLL Version 2020-04-27 Util Func _Hex2Dec x64_Ops.zip
    6 points
  3. The example: The UDFish: The back story: I put together "Win 11 - My own border color" and looking at the logs I've found that I had a handle leak. The leak got fixed but I wanted ( out of OCD ? ) to have the script report on it's status. Ok, easy enough, I'll IPC the request. But I don't wanna have it in the main loop, constantly asking "are we there yet ?, are we there yet ?, ..." . I could not find a copy'n'paste UDF, that did that I wanted to have, so I had to code it 🥲 Now you can copy'n'paste it How does it work: When WM_COPYDATA gets a message, it puts the data in a global array that gets accessed by any user function triggered by AdlibRegister() after X mSec. You can set the AdlibRegister() time with WMCDIPC_AdlibTime(). Without a parameter it will return the current value. Can set the user function with WMCDIPC_AdlibFunc()**. Without a parameter it will return the current value. The UDF has notes that will hint it's use. Hope you find it useful. Edit: This is v2.0 ( yey ! ) ** there now is a WMCDIPC_AdlibRegister(func,time) that can do that too. This version allows running all Au3Stripper arguments, so that's good. Added WMCDIPC_PrintCallback() to handle the one line of debug in the UDF. Also added a return in case the script is already busy running in Adlib, therefore unable to process the IPC request right there and then. The int return is "0xFADE" and the string has how many mSec it's been busy. Giving the user a chance to know it "FADEd away" and formulate a resend or what not. Since is a new version, added WMCDIPC_Version(), just in case of a future one. But all in all, I think that this UDF is complete and needs no other functionality for the scenario it would be used at. Edit: This is v2.1 ( wow ! ) Added in the loop. Why ?. Well, the project that I wrote this for is GUIOnEventMode=1. Having the "are we there yet ?" is much slower given that a long Sleep() is common in that option. But the example I posted is GUIOnEventMode=0. It does use GUIGetMsg() to handle messages and CPU usage so, why not have the trigger right there. So that's what I added in this version. And obviously responds much faster than scheduling an Adlib. Edit: ..and this is v2.1.1 ( child proofing ? ) I was thinking that it would be nice to tell, the new to this UDF, that a set of choices would not work ( not as extreme as in MsgBox_Extn() but, something ). Also to run ControlViewer just in case of an "oops". where you can select a script, press DEL, and process close it, if something went wrong. ( and I use it a lot ) So there: for all those that should be sleeping at 3 AM but want to code and screw up, because the brain is sleeping regardless of will.
    5 points
  4. Nine

    AutoIt Snippets

    Owner Draw Combo Box with default $CBS_DROPDOWN. Not so obvious as it seems. #include <WinAPIConv.au3> #include <WinAPIGdi.au3> #include <GUIConstants.au3> #include <Constants.au3> #include <GuiComboBox.au3> Opt("MustDeclareVars", True) Global Const $tagDRAWITEMSTRUCT = "uint CtlType;uint CtlID;uint itemID;uint itemAction;uint itemState;hwnd hwndItem;handle hDC;dword rcItem[4];ptr itemData" Global Const $ODA_DRAWENTIRE = 1 Global Const $ODS_SELECTED = 1 Global $idCombo Example() Func Example() GUICreate("Owner Draw", 300, 200) $idCombo = GUICtrlCreateCombo("", 10, 10, 185, 20, BitOR($CBS_HASSTRINGS, $CBS_OWNERDRAWFIXED, $GUI_SS_DEFAULT_COMBO)) Local $idClose = GUICtrlCreateButton("Close", 210, 170, 85, 25) GUICtrlSetData($idCombo, "1|2|3|4|5|6|7|8|9|10|11|12|13|14|15|16|17") GUISetState() Local $aAccelKeys[1][2] = [["{ENTER}", $idCombo]] GUISetAccelerators($aAccelKeys) GUIRegisterMsg($WM_COMMAND, WM_COMMAND) GUIRegisterMsg($WM_DRAWITEM, WM_DRAWITEM) While True Switch GUIGetMsg() Case $GUI_EVENT_CLOSE, $idClose ExitLoop EndSwitch WEnd EndFunc ;==>Example Func WM_COMMAND($hWnd, $iMsg, $wParam, $lParam) Local $idCtrl = _WinAPI_LoWord($wParam), $iCode = _WinAPI_HiWord($wParam) If $idCtrl = $idCombo And ($iCode = $CBN_KILLFOCUS Or $iCode = $CBN_SELCHANGE) Then Validate($idCtrl) Return $GUI_RUNDEFMSG EndFunc ;==>WM_COMMAND Func Validate($idComboBox) Local Static $sSelection Local $sComboRead = GUICtrlRead($idComboBox) If $sSelection = $sComboRead Then Return Local $iList = _GUICtrlComboBox_FindStringExact($idComboBox, $sComboRead) If $iList = -1 Then GUICtrlSendMsg($idComboBox, $CB_SETCURSEL, -1, 0) $sSelection = "" ConsoleWrite("Invalid data" & @CRLF) Else $sSelection = $sComboRead ConsoleWrite("Currently displaying: " & $sComboRead & @CRLF) If _GUICtrlComboBox_GetCurSel($idComboBox) = -1 Then _GUICtrlComboBox_SetCurSel($idComboBox, $iList) EndIf EndFunc ;==>Validate Func WM_DRAWITEM($hWnd, $iMsg, $wParam, $lParam) If $wParam <> $idCombo Then Return $GUI_RUNDEFMSG Local $tDraw = DllStructCreate($tagDRAWITEMSTRUCT, $lParam), $sText If $tDraw.itemAction = $ODA_DRAWENTIRE Then Local $tRECT = DllStructCreate($tagRECT, DllStructGetPtr($tDraw, "rcItem")) Local $hBrush = _WinAPI_CreateSolidBrush(BitAND($tDraw.itemState, $ODS_SELECTED) ? 0xFFCDAD : Mod($tDraw.itemID, 2) ? 0xFFFFFF : 0xE0E0E0) _WinAPI_FillRect($tDraw.hDC, $tRECT, $hBrush) $tRECT.Left += 5 $tRECT.Top += 2 _GUICtrlComboBox_GetLBText($tDraw.hwndItem, $tDraw.itemID, $sText) _WinAPI_DrawText($tDraw.hDC, $sText, $tRECT, $DT_LEFT) _WinAPI_DeleteObject($hBrush) EndIf Return $GUI_RUNDEFMSG EndFunc ;==>WM_DRAWITEM Note : you can tab, enter, up arrow, down arrow to validate the combo input field.
    4 points
  5. Great investigations. Seems we can force the position of the button inside $WM_WINDOWPOSCHANGING message (by setting X, Y, CX and CY). I still haven't found the elegant way to set the right position at the right time, though. Got to go for now... Edit : this is what I got best so far... #include <guiConstants.au3> #include <winapi.au3> #include <MenuConstants.au3> Opt("MustDeclareVars", True) Global $hGUI, $bRestore Example() Func Example() $hGUI = GUICreate("WM_NCHITTEST", 300, 200, -1, -1, $WS_OVERLAPPEDWINDOW) Local $idBtn = GUICtrlCreateButton("Button 1", 4, 4, 80, 80, $WS_CLIPSIBLINGS) Local $idBtn2 = GUICtrlCreateButton("Button 2", 90, 4, 80, 80, $WS_CLIPSIBLINGS) Local $idLockButtons = GUICtrlCreateCheckbox("Lock Buttons", 200, 20, 80, 20) Local $hDll = DllCallbackRegister(ButtonMoveProc, 'lresult', 'hwnd;uint;wparam;lparam;uint_ptr;dword_ptr') _WinAPI_SetWindowSubclass(GUICtrlGetHandle($idBtn), DllCallbackGetPtr($hDll), $idBtn) _WinAPI_SetWindowSubclass(GUICtrlGetHandle($idBtn2), DllCallbackGetPtr($hDll), $idBtn2) GUIRegisterMsg($WM_SYSCOMMAND, WM_SYSCOMMAND) GUISetState() Local $iMsg While True $iMsg = GUIGetMsg() Switch $iMsg Case $GUI_EVENT_CLOSE ExitLoop Case $idLockButtons If GUICtrlRead($iMsg) = $GUI_CHECKED Then _WinAPI_RemoveWindowSubclass(GUICtrlGetHandle($idBtn), DllCallbackGetPtr($hDll), $idBtn) _WinAPI_RemoveWindowSubclass(GUICtrlGetHandle($idBtn2), DllCallbackGetPtr($hDll), $idBtn2) Else _WinAPI_SetWindowSubclass(GUICtrlGetHandle($idBtn), DllCallbackGetPtr($hDll), $idBtn, 0) _WinAPI_SetWindowSubclass(GUICtrlGetHandle($idBtn2), DllCallbackGetPtr($hDll), $idBtn2, 0) EndIf Case $idBtn, $idBtn2 ConsoleWrite("Click " & GUICtrlRead($iMsg) & @CRLF) Case $GUI_EVENT_RESTORE $bRestore = False EndSwitch WEnd GUIDelete() _WinAPI_RemoveWindowSubclass(GUICtrlGetHandle($idBtn), DllCallbackGetPtr($hDll), $idBtn) _WinAPI_RemoveWindowSubclass(GUICtrlGetHandle($idBtn2), DllCallbackGetPtr($hDll), $idBtn2) DllCallbackFree($hDll) EndFunc ;==>Example Func ButtonMoveProc($hWnd, $iMsg, $wParam, $lParam, $iID, $iData) Local $tPos, $aPos, $iRet, $aPoint[2], $iSrc, $iEvent, $hCursor Switch $iMsg Case $WM_NCHITTEST $aPos = WinGetPos($hWnd) $aPoint[0] = BitAND($lParam, 0xFFFF) $aPoint[1] = BitShift($lParam, 16) $iRet = $HTCAPTION If $aPoint[0] - $aPos[0] < 10 Then $iRet = $HTLEFT If $aPoint[0] - $aPos[0] > ($aPos[2] - 10) Then $iRet = $HTRIGHT If $aPoint[1] - $aPos[1] < 10 Then Switch $iRet Case $HTLEFT $iRet = $HTTOPLEFT Case $HTRIGHT $iRet = $HTTOPRIGHT Case Else $iRet = $HTTOP EndSwitch ElseIf $aPoint[1] - $aPos[1] > ($aPos[3] - 10) Then Switch $iRet Case $HTLEFT $iRet = $HTBOTTOMLEFT Case $HTRIGHT $iRet = $HTBOTTOMRIGHT Case Else $iRet = $HTBOTTOM EndSwitch EndIf Return $iRet Case $WM_SETCURSOR $iSrc = BitAND($lParam, 0xFFFF) $iEvent = BitShift($lParam, 16) If $iSrc = $HTCAPTION And $iEvent = $WM_LBUTTONDOWN Then _WinAPI_RedrawWindow($hWnd, 0, 0, $RDW_INVALIDATE + $RDW_FRAME) $hCursor = _WinAPI_LoadCursor(0, $OCR_SIZEALL) _WinAPI_SetCursor($hCursor) Return True EndIf Case $WM_WINDOWPOSCHANGING If $bRestore Then ConsoleWrite("WM_WINDOWPOSCHANGING" & @CRLF) $tPos = DllStructCreate($tagWINDOWPOS, $lParam) $aPos = ControlGetPos($hGUI, "", $hWnd) ConsoleWrite($aPos[0] & "/" & $aPos[1] & "/" & $aPos[2] & "/" & $aPos[3] & @CRLF) $tPos.X = $aPos[0] $tPos.Y = $aPos[1] $tPos.CX = $aPos[2] $tPos.CY = $aPos[3] Return 0 EndIf EndSwitch Return _WinAPI_DefSubclassProc($hWnd, $iMsg, $wParam, $lParam) EndFunc ;==>ButtonMoveProc Func WM_SYSCOMMAND($hWnd, $uMsg, $wParam, $lParam) If $wParam = $SC_RESTORE Then ConsoleWrite("---Start Restore---" & @CRLF) $bRestore = True EndIf Return $GUI_RUNDEFMSG EndFunc ;==>WM_SYSCOMMAND
    3 points
  6. Yes, it is working. But we should use : Local $hBitmap = _GDIPlus_BitmapCreateHBITMAPFromBitmap($hImage) _WinAPI_UpdateLayeredWindowEx($hGUI, -1, -1, $hBitmap) to ensure no memory leak. Also, I just noticed a small bug. _WinAPI_DeleteObject($hImage) is incorrect and should be replaced by : _GDIPlus_ImageDispose($hImage) and then add : _WinAPI_DeleteObject($hBitmap) EDIT : modified code above accordingly.
    3 points
  7. @Nine does this work for you ? ; SetBitmap($hGUI, $hImage, 255) _WinAPI_UpdateLayeredWindowEx($hGUI, -1, -1, _GDIPlus_BitmapCreateHBITMAPFromBitmap($hImage)) If it works, then we shouldn't need Function SetBitmap() and its 18 lines.
    3 points
  8. Here modern coding (removed useless code) : #include <WinAPISysWin.au3> #include <WinAPIConstants.au3> #include <GDIPlus.au3> #include <GuiComboBox.au3> #include <File.au3> #include <WindowsConstants.au3> #include <GuiConstants.au3> #include <ButtonConstants.au3> Opt("MustDeclareVars", True) Global Const $AC_SRC_ALPHA = 1 Example() Func Example() ; Load PNG file as GDI bitmap _GDIPlus_Startup() Local $sPngSrc = @ScriptDir & "\LaunchySkin.png" Local $hImage = _GDIPlus_ImageLoadFromFile($sPngSrc) ; Extract image width and height from PNG Local $iWidth = _GDIPlus_ImageGetWidth($hImage) Local $iHeight = _GDIPlus_ImageGetHeight($hImage) ; Create layered window Local $hGUI = GUICreate("", $iWidth, $iHeight, -1, -1, $WS_POPUP, $WS_EX_LAYERED) Local $hBitmap = _GDIPlus_BitmapCreateHBITMAPFromBitmap($hImage) _WinAPI_UpdateLayeredWindowEx($hGUI, -1, -1, $hBitmap) ; Register notification messages GUIRegisterMsg($WM_NCHITTEST, WM_NCHITTEST) GUISetState() WinSetOnTop($hGUI, "", $WINDOWS_ONTOP) ; As per help file : ; When using $WS_EX_MDICHILD the position is relative to client area of the parent window. ; With $WS_EX_LAYERED it is possible to have a transparent picture on a background picture defined in the parent window. ; To have a transparent picture, create the GUI with the WS_EX_LAYERED extended style. ; The left-top pixel will be used as the transparency color. ; If several pictures are created the last picture defines the transparent color. GUICreate("", $iWidth, $iHeight, 0, 0, $WS_POPUP, BitOR($WS_EX_LAYERED, $WS_EX_MDICHILD), $hGUI) GUICtrlCreatePic(@ScriptDir & "\grey.gif", 0, 0, $iWidth, $iHeight) ; makes the whole child GUI transparent GUICtrlSetState(-1, $GUI_DISABLE) GUICtrlCreateLabel("Type the name of a file on" & @CR & "your desktop and press Enter", 50, 30, 140, 60) GUICtrlSetBkColor(-1, $GUI_BKCOLOR_TRANSPARENT) GUICtrlSetColor(-1, 0xFFFFFF) ; combo box listing all items on desktop Local $idCombo = GUICtrlCreateCombo("", 210, 30, 250, -1, BitOR($CBS_DROPDOWNLIST, $CBS_AUTOHSCROLL)) GUICtrlSetFont($idCombo, 10) ; set default button for Enter key activation - renders outside GUI window Local $idButton = GUICtrlCreateButton("", 0, 0, 0, 0, $BS_DEFPUSHBUTTON) GUISetState() ; get list of files on desktop, show in combobox Local $aFileList = _FileListToArray(@DesktopDir), $sRun _ArraySort($aFileList, 0, 1) GUICtrlSetData($idCombo, _ArrayToString($aFileList, "|", 1)) While True Switch GUIGetMsg() Case $GUI_EVENT_CLOSE ExitLoop Case $idButton $sRun = GUICtrlRead($idCombo) ExitLoop EndSwitch WEnd If $sRun And FileExists(@DesktopDir & "\" & $sRun) Then Beep(2000, 50) ShellExecute($sRun, "", @DesktopDir) EndIf _WinAPI_DeleteObject($hBitmap) _GDIPlus_ImageDispose($hImage) _GDIPlus_Shutdown() EndFunc ;==>Example Func WM_NCHITTEST($hWnd, $iMsg, $iwParam, $ilParam) Return $HTCAPTION EndFunc ;==>WM_NCHITTEST
    3 points
  9. Just uploaded SciTEx86.zip & SciTEx64.zip which contain the Latest SciTE 5.5.4 versions released today 18 December 2024.
    3 points
  10. Version 1.7.0 has just been released! Notable changes: Peek/Goto build-in function declarations now works (will open my mock included file) Include statements that fail to resolve will now be indicated with an error on that line Absolute paths for include statements now resolves New setting (autoit3.ignoreInternalInIncludes). When set to true, internal declarations (vars and funcs) within includes, will be ignored from completion suggestions I have not picked my goals for 1.8 yet, so please let me know here or on GitHub, if you have any wishes. The extension got it's first review on the visualstudio marketplace! So many thanks to Valentin for the glowing review! And a personal achivement of making my repository auto publish to the visualstudio marketplace and Open VSX, whenever i create a new release!
    3 points
  11. yep got it. Here a way to solve it : Case $WM_SETCURSOR $iSrc = BitAND($lParam, 0xFFFF) $iEvent = BitShift($lParam, 16) If $iSrc = $HTCAPTION And $iEvent = $WM_LBUTTONDOWN Then _WinAPI_RedrawWindow($hWnd, 0, 0, $RDW_INVALIDATE + $RDW_FRAME) $hCursor = _WinAPI_LoadCursor(0, $OCR_SIZEALL) _WinAPI_SetCursor($hCursor) Return True EndIf ps. it is not working all the times... pps. seems that solves the issue (changed code above) _WinAPI_RedrawWindow($hWnd, 0, 0, $RDW_INVALIDATE + $RDW_FRAME)
    3 points
  12. Was the dot in GUICtrlCreateUpdown #include <GUIConstantsEx.au3> #include <EditConstants.au3> Local $sMyHex = "FFFFFF" $hGUI = GUICreate("Test", 500, 500) $cInput = GUICtrlCreateInput($sMyHex, 10, 100, 100, 20, $ES_CENTER) $cDummyInput = GUICtrlCreateInput(Int("0x" & $sMyHex), 110, 100, 100, 20) $cUpDown = GUICtrlCreateUpdown($cDummyInput) GUICtrlSetLimit($cUpDown, 16777215, 0) ; Set range for valid 6-digit hex values (0 to FFFFFF) GUICtrlSetState($cDummyInput, $GUI_FOCUS) GUISetState() While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE Exit Case $cDummyInput ; Remove the dot Local $intValue = Int(StringReplace(GUICtrlRead($cDummyInput), ".", "")) Local $sHexValue = Hex($intValue, 6) ; Convert to 6-digit hex GUICtrlSetData($cInput, $sHexValue) EndSwitch WEnd
    3 points
  13. [New VERSION] - 11 Dec 24 Added: New function _GUIListViewEx_EditProcessActive which returns the handle of the ListView concerned if an element is being edited. Usage scenario: prevent HotKeys from working when editing is underway. Fixed: A couple of bugs with columns: added columns were automatically sortable; dragging columns meant editing pop-up could appear in wrong place. Thanks to ValentinM for the reports. New UDF in the first post. M23
    3 points
  14. Input control for the GUI with label and rounded corners It all started in this post I tried to make a rectangle with rounded corners, using $GUI_GR_BEZIER. I managed to do it but the result did not satisfy me because $GUI_GR_BEZIER produced (is producing) a rough result. A flickering, which I could not overcome. So I changed the approach with two rectangles and a circle for each corner The script demonstrates the use of functions to create input fields with and without labels, and rounded corners, where the font size changes dynamically depending on the height of Input control. Valid value for Corner [0=Rectangle] to [($Height/2)=Round], Default=($Height/4) Example1: _CreateInputWL() #include <GUIConstants.au3> _Example() ;---------------------------------------------------------------------------------------- Func _Example() Local $hGUI = GUICreate("Shipping Details", 390, 320) GUISetStyle(-1, $WS_EX_COMPOSITED) GUISetBkColor(0x0D1117) Local $ShippingDetails = GUICtrlCreateLabel("Shipping Address", 10, 5, 380, 30) GUICtrlSetFont(-1, 18, 800, 0, "MS Sans Serif") GUICtrlSetColor(-1, 0xFFD800) Local $Exit = GUICtrlCreateButton("EXIT", 20, 270, 95, 40) GUICtrlSetFont(-1, 10, 800, 0, "MS Sans Serif") GUICtrlSetColor(-1, 0x0D1117) GUICtrlSetBkColor(-1, 0xFFD800) Local $Corner = -1 ; *** <- Valid value from [0=Rectangle] to [($Height/2)=Round], Default=($Height/4) *** <- Local $FirstName = _CreateInputWL("First Name:", "John", 10, 50, 180, 40, 0x00FFFF, $Corner) Local $LastName = _CreateInputWL("Last Name:", "Doe", 200, 50, 180, 40, 0x00FFFF, $Corner) Local $Address = _CreateInputWL("Address:", "123 Main St", 10, 100, 230, 40, 0x00FFFF, $Corner) Local $Apt = _CreateInputWL("Apt:", "4B", 250, 100, 130, 40, 0x00FFFF, $Corner) Local $City = _CreateInputWL("City:", "Springfield", 10, 150, 140, 40, 0x00FFFF, $Corner) Local $State = _CreateInputWL("State:", "IL", 160, 150, 80, 40, 0x00FFFF, $Corner) Local $ZipCode = _CreateInputWL("Zip Code:", "627 01", 250, 150, 130, 40, 0x00FFFF, $Corner) Local $Email = _CreateInputWL("Email:", "jdoe627@gmail.com", 10, 200, 230, 40, 0x00FFFF, $Corner) Local $Phone = _CreateInputWL("Phone:", "0123456789", 250, 200, 130, 40, 0x00FFFF, $Corner) GUISetState(@SW_SHOW) Sleep(4000) GUICtrlSetData($Email[0], "Johndoe@gmail.com") GUICtrlSetData($Phone[1], "Mobile:") GUICtrlSetData($Phone[0], "654210789") ;********************************** While True Switch GUIGetMsg() Case $GUI_EVENT_CLOSE, $Exit ExitLoop EndSwitch WEnd ;********************************** EndFunc ;==>_Example ;---------------------------------------------------------------------------------------- Func _CreateInputWL($Label, $Text, $Left, $Top, $Width, $Height, $Color, $Corner = -1) ; $Corner Valid value [0=Rectangle] to [($Height/2)=Round], Default=($Height/4) ; Validate parameters If $Corner < 0 Or $Corner = Default Then $Corner = $Height / 4 If $Corner > $Height / 2 Then $Corner = $Height / 2 If $Width <= 0 Or $Height <= 0 Then Return SetError(1, 0, 0) EndIf ; graphic GUICtrlCreateGraphic($Left, $Top, $Width, $Height) GUICtrlSetGraphic(-1, $GUI_GR_COLOR, $Color, $Color) ; body GUICtrlSetGraphic(-1, $GUI_GR_RECT, $Corner, 0, $Width - ($Corner * 2), $Height) ; outer part GUICtrlSetGraphic(-1, $GUI_GR_RECT, 0, $Corner, $Width, $Height - ($Corner * 2)) ; inner part ; corners GUICtrlSetGraphic(-1, $GUI_GR_ELLIPSE, 0, 0, $Corner * 2, $Corner * 2) ; Top-left GUICtrlSetGraphic(-1, $GUI_GR_ELLIPSE, $Width - $Corner * 2, 0, $Corner * 2, $Corner * 2) ; Top-right GUICtrlSetGraphic(-1, $GUI_GR_ELLIPSE, 0, $Height - $Corner * 2, $Corner * 2, $Corner * 2) ; Bottom-left GUICtrlSetGraphic(-1, $GUI_GR_ELLIPSE, $Width - $Corner * 2, $Height - $Corner * 2, $Corner * 2, $Corner * 2) ; Bottom-right GUICtrlSetState(-1, $GUI_DISABLE) Local $idLabel = GUICtrlCreateLabel($Label, $Left + $Corner, $Top, $Width - ($Corner * 2), $Height * 0.4) GUICtrlSetBkColor($idLabel, $Color) GUICtrlSetFont($idLabel, $Height * 0.25) Local $idInput1 = GUICtrlCreateInput($Text, $Left + $Corner, $Top + ($Height * 0.35), $Width - ($Corner * 2), $Height * 0.60, -1 ,$WS_EX_COMPOSITED) GUICtrlSetFont($idInput1, $Height * 0.35) GUICtrlSetBkColor($idInput1, $Color) Local $aRet[] = [$idInput1, $idLabel] Return $aRet ; Return both ID EndFunc ;==>_CreateInputWL ;---------------------------------------------------------------------------------------- Example2: _CreateInputWL(), _CreateInput() #include <GUIConstants.au3> Global $hGUI = GUICreate("GUI") GUISetStyle ( -1, $WS_EX_COMPOSITED ) GUISetBkColor(0x0D1117) Global $id_1 = _CreateInput("INPUT1", 20, 20, 150, 30, "0xFFD800", 15) Global $id_2 = _CreateInput("INPUT2", 20, 60, 150, 30, "0xB6FF00") Global $id_3 = _CreateInput("INPUT3", 20, 100, 150, 35, "0x00FFFF", 10) Global $id_4 = _CreateInput("INPUT4", 20, 145, 150, 35, "0x0094FF") Global $id_5 = _CreateInput("INPUT5", 20, 190, 150, 40, "0xFF0000", 10) Global $id_6 = _CreateInput("INPUT6", 20, 240, 150, 40, "0xFF80EE") Global $id_7 = _CreateInputWL("Label:", "INPUT7", 220, 20, 150, 30, "0xFFD800", 10) Global $id_8 = _CreateInputWL("Label:", "INPUT8", 220, 60, 150, 30, "0xB6FF00") Global $id_9 = _CreateInputWL("Label:", "INPUT9", 220, 100, 150, 35, "0x00FFFF", 10) Global $id_10 = _CreateInputWL("Label:", "INPUT10", 220, 145, 150, 35, "0x0094FF") Global $id_11 = _CreateInputWL("Label:", "INPUT11", 220, 190, 150, 40, "0xFF0000", 10) Global $id_12 = _CreateInputWL("Label:", "INPUT12", 220, 240, 150, 40, "0xFF80EE") Global $id_13 = _CreateInputWL("LabelXXL:", "INPUTXXL", 20, 300, 350, 60, "0xB6B6B6", 30) GUISetState() While True Switch GUIGetMsg() Case $GUI_EVENT_CLOSE ExitLoop EndSwitch WEnd ;---------------------------------------------------------------------------------------- Func _CreateInput($Text, $Left, $Top, $Width, $Height, $Color, $Corner = 10) ; $Corner Valid value [0=Rectangle] to [($Height/2)=Round], Default=($Height/4) ; Validate parameters If $Corner < 0 Or $Corner = Default Then $Corner = $Height / 4 If $Corner > $Height / 2 Then $Corner = $Height / 2 If $Width <= 0 Or $Height <= 0 Then Return SetError(1, 0, 0) EndIf ; graphic GUICtrlCreateGraphic($Left, $Top, $Width, $Height) GUICtrlSetGraphic(-1, $GUI_GR_COLOR, $Color, $Color) ; body GUICtrlSetGraphic(-1, $GUI_GR_RECT, $Corner, 0, $Width - ($Corner * 2), $Height) ; outer part GUICtrlSetGraphic(-1, $GUI_GR_RECT, 0, $Corner, $Width, $Height - ($Corner * 2)) ; inner part ; corners GUICtrlSetGraphic(-1, $GUI_GR_ELLIPSE, 0, 0, $Corner * 2, $Corner * 2) ; Top-left GUICtrlSetGraphic(-1, $GUI_GR_ELLIPSE, $Width - $Corner * 2, 0, $Corner * 2, $Corner * 2) ; Top-right GUICtrlSetGraphic(-1, $GUI_GR_ELLIPSE, 0, $Height - $Corner * 2, $Corner * 2, $Corner * 2) ; Bottom-left GUICtrlSetGraphic(-1, $GUI_GR_ELLIPSE, $Width - $Corner * 2, $Height - $Corner * 2, $Corner * 2, $Corner * 2) ; Bottom-right GUICtrlSetState(-1, $GUI_DISABLE) $idInput1 = GUICtrlCreateInput($Text, $Left + $Corner, $Top + ($Height * 0.2), $Width - ($Corner * 2), $Height * 0.6, -1, $WS_EX_COMPOSITED) GUICtrlSetFont($idInput1, $Height * 0.4, 400) GUICtrlSetBkColor($idInput1, $Color) Return $idInput1 EndFunc ;==>_CreateInput ;---------------------------------------------------------------------------------------- Func _CreateInputWL($Label, $Text, $Left, $Top, $Width, $Height, $Color, $Corner = -1) ; $Corner Valid value [0=Rectangle] to [($Height/2)=Round], Default=($Height/4) ; Validate parameters If $Corner < 0 Or $Corner = Default Then $Corner = $Height / 4 If $Corner > $Height / 2 Then $Corner = $Height / 2 If $Width <= 0 Or $Height <= 0 Then Return SetError(1, 0, 0) EndIf ; graphic GUICtrlCreateGraphic($Left, $Top, $Width, $Height) GUICtrlSetGraphic(-1, $GUI_GR_COLOR, $Color, $Color) ; body GUICtrlSetGraphic(-1, $GUI_GR_RECT, $Corner, 0, $Width - ($Corner * 2), $Height) ; outer partt GUICtrlSetGraphic(-1, $GUI_GR_RECT, 0, $Corner, $Width, $Height - ($Corner * 2)) ; inner part ; corners GUICtrlSetGraphic(-1, $GUI_GR_ELLIPSE, 0, 0, $Corner * 2, $Corner * 2) ; Top-left GUICtrlSetGraphic(-1, $GUI_GR_ELLIPSE, $Width - $Corner * 2, 0, $Corner * 2, $Corner * 2) ; Top-right GUICtrlSetGraphic(-1, $GUI_GR_ELLIPSE, 0, $Height - $Corner * 2, $Corner * 2, $Corner * 2) ; Bottom-left GUICtrlSetGraphic(-1, $GUI_GR_ELLIPSE, $Width - $Corner * 2, $Height - $Corner * 2, $Corner * 2, $Corner * 2) ; Bottom-right GUICtrlSetState(-1, $GUI_DISABLE) Local $idLabel = GUICtrlCreateLabel($Label, $Left + $Corner, $Top, $Width - ($Corner * 2), $Height * 0.4) GUICtrlSetBkColor($idLabel, $Color) GUICtrlSetFont($idLabel, $Height * 0.25) Local $idInput1 = GUICtrlCreateInput($Text, $Left + $Corner, $Top + ($Height * 0.35), $Width - ($Corner * 2), $Height * 0.60, -1, $WS_EX_COMPOSITED) GUICtrlSetFont($idInput1, $Height * 0.35) GUICtrlSetBkColor($idInput1, $Color) Local $aRet[]=[$idInput1, $idLabel] Return $aRet ; Return both ID EndFunc ;==>_CreateInputWL ;---------------------------------------------------------------------------------------- Please, every comment is appreciated! leave your comments and experiences here! Thank you very much
    3 points
  15. ioa747

    TennisPong

    What can I say, the holidays are coming, ho ho ho Happy holidays to all of you with health and joy. prologue: Pong is one of the first computer games that ever created, Research Interview Series #16: Allan Alcorn, the creator of Pong This is a simple outline variation "tennis like" game, that helped me kill my time ; https://www.autoitscript.com/forum/topic/212523-tennispong/ ;---------------------------------------------------------------------------------------- ; Title...........: TennisPong.au3 ; Description.....: Pong is one of the first computer games that ever created, ; this a simple outline "tennis like" game ; AutoIt Version..: 3.3.16.1 Author: ioa747 Script Version: 1.0 ; Note............: Testet in Win10 22H2 ;---------------------------------------------------------------------------------------- #AutoIt3Wrapper_Au3Check_Parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6 -w 7 #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> #include <StaticConstants.au3> #include <Misc.au3> #include <WinAPISysWin.au3> HotKeySet("{ESC}", "_Exit") _Pong() Func _Pong() Local $iWidth = @DesktopWidth, $iHeight = @DesktopHeight Local $iBallSize = 25 Local $iPaddleWidth = 200, $iPaddleHeight = 165 Local $iBallX = $iWidth / 2, $iBallY = $iHeight / 2 Local $iBallSpeedX = 15, $iBallSpeedY = 15 Local $iPaddleX = ($iWidth / 2) - ($iPaddleWidth / 2) Local $iPaddelSpace = 30 Local $iScore = 0 ; Create score GUI as parent Local $hDisplay = GUICreate("TennisPong", 150, 50, $iWidth - 160, 3, $WS_POPUP, BitOR($WS_EX_COMPOSITED, $WS_EX_LAYERED, $WS_EX_TOPMOST, $WS_EX_TRANSPARENT)) Local $idScore = GUICtrlCreateLabel($iScore, 0, 0, 150, 50, $SS_CENTER) GUICtrlSetFont(-1, 30, 800, 0, "MS Sans Serif") GUICtrlSetColor(-1, 0x00FF21) GUISetBkColor(0x000000, $hDisplay) WinSetTrans($hDisplay, "", 80) GUISetState(@SW_SHOW, $hDisplay) ; Create paddle GUI Local $hPaddle = GUICreate("", $iPaddleWidth, $iPaddleHeight, $iPaddleX, $iHeight - $iPaddleHeight + $iPaddelSpace, _ $WS_POPUP, BitOR($WS_EX_LAYERED, $WS_EX_MDICHILD), $hDisplay) GUICtrlCreatePic(".\res\paddel2.gif", 0, 0, 0, 0) ; Create ball GUI Local $hBall = GUICreate("", $iBallSize, $iBallSize, $iBallX, $iBallY, $WS_POPUP, BitOR($WS_EX_LAYERED, $WS_EX_MDICHILD), $hDisplay) GUICtrlCreatePic(".\res\Tball.gif", 0, 0, 0, 0) GUISetState(@SW_SHOW, $hPaddle) GUISetState(@SW_SHOW, $hBall) While 1 Local $aMPos = MouseGetPos() $iPaddleX = $aMPos[0] ; Keep paddle within screen If $iPaddleX < 0 Then $iPaddleX = 0 If $iPaddleX > $iWidth - $iPaddleWidth Then $iPaddleX = $iWidth - $iPaddleWidth ; Move the ball $iBallX += $iBallSpeedX $iBallY += $iBallSpeedY ; Ball collision with top If $iBallY <= 0 Then $iBallSpeedY = -$iBallSpeedY Beep(300, 100) EndIf ; Ball collision with left and right If $iBallX <= 0 Or $iBallX >= ($iWidth - $iBallSize) Then $iBallSpeedX = -$iBallSpeedX Beep(200, 100) EndIf ; Ball collision with paddle If ($iBallX >= $iPaddleX And $iBallX <= ($iPaddleX + $iPaddleWidth) And _ $iBallY >= ($iHeight - $iPaddleHeight - $iBallSize + $iPaddelSpace)) And _ $iBallY <= ($iHeight - $iPaddleHeight - $iBallSize + $iPaddelSpace + $iBallSize / 2) Then $iBallSpeedY = -$iBallSpeedY Beep(300, 100) $iScore += 1 GUICtrlSetData($idScore, $iScore) EndIf ; Reset ball if it goes out of bounds If $iBallY > $iHeight Then $iBallX = $iWidth / 2 $iBallY = $iHeight / 2 Sleep(3000) $iScore = 0 GUICtrlSetData($idScore, $iScore) Beep(200, 200) EndIf WinMove($hPaddle, "", $iPaddleX, $iHeight - $iPaddleHeight) WinMove($hBall, "", $iBallX, $iBallY) ; Check for exit If GUIGetMsg() = $GUI_EVENT_CLOSE Then ExitLoop Sleep(30) WEnd GUIDelete() EndFunc ;==>_Pong ;---------------------------------------------------------------------------------------- Func _Exit() Exit EndFunc ;==>_Exit ;---------------------------------------------------------------------------------------- TennisPong.zip have fun Thank you very much
    3 points
  16. You must send it as HTML not as TEXT and of course you must prepare your HTML to be like a MHT file. I mean the HTML should include image as a base64 encoded string. for example:
    3 points
  17. Is using the SMTP Mailer UDF a hard requirement? If so, I will let someone else figure that out. I don't use the SMTP Mailer UDF. I use my own UDF which is based on the CMail CLI tool. I've used CMail to send emails from AutoIt for several years (2017) and it works quite well. As you can see below, it can handle sending inline images to Gmail recipients (or any other recipients) without any issues. Since CMail is a command line tool, you just need to build the correct command line and execute it. CMail also lets you use configuration files. Using a config file makes building the command line much easier. Image of GMail email sent from AutoIt script using CMail: To point you in the right direction, the CMail parameter for attaching an inline image is "-ai:file". The HTML email then needs to include the following img tag where you want the inline image embedded. In general, to send an inline image in an HTML email, you need to send it as a "multipart/related" MIME type. The content ID (CID) in the img tag tells it which multipart section to embed. The email client, in my case CMail, is responsible for including the file in the correct format. I don't want to get too deep into the weeds of SMTP and MIME types, so if you have additional questions, feel free to ask for more information. <img width="48" height="48" src="cid:BrainAvatar.jpg"> The section below shows the HTML used to send the email from the image above. Near the bottom, you will see img tag with the CID referencing the image to embed. Basically, the "-ai:file" parameter in CMail attaches a "multipart/related" section in the email, which is needed for inline images. The relevant lines in the script that set up and sent the email looks like this: This gives you an idea of how it can be done using an alternate method. If you want to stick with your current method, or prefer some other method, please disregard it all together.
    3 points
  18. Oops it was broken for Autoit x86 - I didn't register the callback correctly when I've moved from WindowSetLong to setwindowssubclass. I've updated the example. And here's one for @argumentum if I've done things correctly Hold shift to move/resize the controls. #include <guiConstants.au3> #include <winapi.au3> #include <misc.au3> Opt("MustDeclareVars", 1) Global $hGui = GUICreate("", 300, 200, 100, 100, BitOR($WS_SIZEBOX, $WS_MINIMIZEBOX)) Global $idBtn = GUICtrlCreateButton("Button 1", 4, 4, 80, 80) Global $idBtn2 = GUICtrlCreateButton("Button 2", 90, 4, 80, 80) Global $hCursor = _WinAPI_CopyCursor(_WinAPI_LoadCursor(0, $OCR_CROSS)) Global $hBtn = GUICtrlGetHandle($idBtn) Global $hBtn2 = GUICtrlGetHandle($idBtn2) Global $hBtnProc = DllCallbackRegister("btnProc", "lresult", "hwnd;uint;wparam;lparam;uint_ptr;dword_ptr") Global $pBtnProc = DllCallbackGetPtr($hBtnProc) _WinAPI_SetWindowSubclass($hBtn, $pBtnProc, $idBtn) _WinAPI_SetWindowSubclass($hBtn2, $pBtnProc, $idBtn2) GUIRegisterMsg($WM_SIZE, "WM_SIZE") GUISetState() Local $iMsg While 1 $iMsg = GUIGetMsg() Switch $iMsg Case $GUI_EVENT_CLOSE Exit Case $idBtn, $idBtn2 ConsoleWrite(GUICtrlRead($iMsg) & @CRLF) EndSwitch WEnd Func btnProc($hWnd, $uMsg, $wParam, $lParam, $uIdSubclasss, $dwRefData) Local $iRet Switch $uMsg Case $WM_NCHITTEST Local $aPoint[2] = [BitAND($lParam, 0xFFFF), BitShift($lParam, 16)] ;Mouse coords can be negative on edge cases! If BitAND($aPoint[0], 0x8000) Then $aPoint[0] = BitOR(0xFFFF0000, $aPoint[0]) If BitAND($aPoint[1], 0x8000) Then $aPoint[1] = BitOR(0xFFFF0000, $aPoint[1]) Local $aPos = WinGetPos($hWnd), $iMar = 10 If Not _IsPressed("10") Then $iRet = _WinAPI_DefSubclassProc($hWnd, $uMsg, $wParam, $lParam) Else $iRet = $HTCAPTION If $aPoint[0] - $aPos[0] < $iMar Then $iRet = $HTLEFT If $aPoint[0] - $aPos[0] > ($aPos[2] - $iMar) Then $iRet = $HTRIGHT If $aPoint[1] - $aPos[1] < $iMar Then Switch $iRet Case $HTLEFT $iRet = $HTTOPLEFT Case $HTRIGHT $iRet = $HTTOPRIGHT Case Else $iRet = $HTTOP EndSwitch ElseIf $aPoint[1] - $aPos[1] > ($aPos[3] - $iMar) Then Switch $iRet Case $HTLEFT $iRet = $HTBOTTOMLEFT Case $HTRIGHT $iRet = $HTBOTTOMRIGHT Case Else $iRet = $HTBOTTOM EndSwitch EndIf If $aPoint[0] < 0 Then $iRet = _WinAPI_DefSubclassProc($hWnd, $uMsg, $wParam, $lParam) If $aPoint[1] < 0 Then $iRet = _WinAPI_DefSubclassProc($hWnd, $uMsg, $wParam, $lParam) _WinAPI_RedrawWindow($hWnd) EndIf Case $WM_SETCURSOR Local $iSrc = BitAND($lParam, 0xFFFF), $iEvent = BitShift($lParam, 16) If $iSrc = $HTCAPTION And $iEvent = $WM_LBUTTONDOWN Then _WinAPI_SetCursor($hCursor) $iRet = 1 Else $iRet = _WinAPI_DefSubclassProc($hWnd, $uMsg, $wParam, $lParam) EndIf Case Else $iRet = _WinAPI_DefSubclassProc($hWnd, $uMsg, $wParam, $lParam) EndSwitch Return $iRet EndFunc ;==>btnProc Func WM_SIZE($hWnd, $uMsg, $wParam, $lParam) Return _WinAPI_DefWindowProcW($hWnd, $uMsg, $wParam, $lParam) EndFunc ;==>WM_SIZE
    2 points
  19. There is definitely room for improvement (exploring the scrolling) and that's why I said it as an idea. The idea where you can use one of this type (auto-hide) where no extra space is needed (as its purpose is only to call a command) #include <WindowsConstants.au3> #include <StaticConstants.au3> #include <GUIConstantsEx.au3> Global $g_bAutoHide = True Global $idBtnAutoHide Global $g_hTriggerGUI, $g_hRibonGUI ;~ $g_hTriggerGUI = TriggerGUI() $g_hTriggerGUI = TriggerGUI(0xF0F0F0, 15, 100, 250) $g_hRibonGUI = RibonGUI() ;********************************** While Sleep(50) TriggerCheck() WEnd ;********************************** ;---------------------------------------------------------------------------------------- Func GoToExit() ; exit Exit EndFunc ;==>GoToExit ;---------------------------------------------------------------------------------------- Func TriggerGUI($BkColor = 0xF0F0F0, $Width = 12, $Height = 50, $Trans = 50) Local $hWnd = GUICreate("TriggerGUI", $Width, $Height, -7, (@DesktopHeight - $Height) * 0.4, $WS_POPUP, BitOR($WS_EX_TOOLWINDOW, $WS_EX_TOPMOST)) GUISetBkColor($BkColor) WinSetTrans($hWnd, "", $Trans) GUICtrlCreateLabel("", 0, 0, $Width, $Height) WinSetState($hWnd, "", @SW_SHOW) Return $hWnd EndFunc ;==>TriggerGUI ;---------------------------------------------------------------------------------------- Func TriggerCheck() ;if mouse over Trigger Local $aTrigger = GUIGetCursorInfo($g_hTriggerGUI) If $aTrigger[4] Then ;Make the RibonGUI Local $WinPos = WinGetPos($g_hRibonGUI) Local $BakPos = $WinPos WinMove($g_hRibonGUI, "", $WinPos[0], $WinPos[1], $WinPos[2], $WinPos[3]) GUISetState(@SW_SHOW, $g_hRibonGUI) ;Show the RibonGUI For $i = 1 To $WinPos[2] Step 5 WinMove($g_hRibonGUI, "", $WinPos[0], $WinPos[1], $i, $WinPos[3]) Next Local $aRibon ;********************************** While 1 $aRibon = GUIGetCursorInfo($g_hRibonGUI) If $aRibon[4] = 0 And $g_bAutoHide = True Then ExitLoop Sleep(100) WEnd ;********************************** ;Hide the RibonGUI For $i = $WinPos[2] To 1 Step -5 WinMove($g_hRibonGUI, "", $WinPos[0], $WinPos[1], $i, $WinPos[3]) Next GUISetState(@SW_HIDE, $g_hRibonGUI) WinMove($g_hRibonGUI, "", $BakPos[0], $BakPos[1], $BakPos[2], $BakPos[3]) EndIf EndFunc ;==>TriggerCheck ;---------------------------------------------------------------------------------------- Func RibonGUI() ; Ribon make Opt("GUIOnEventMode", 1) ;0=disabled, 1=OnEvent mode enabled GUISetOnEvent($GUI_EVENT_CLOSE, "GoToExit") ConsoleWrite("@DesktopWidth=" & @DesktopWidth & @CRLF) ConsoleWrite("@DesktopHeight=" & @DesktopHeight & @CRLF) ConsoleWrite("@OSVersion=" & @OSVersion & @CRLF) ConsoleWrite("@AutoItX64=" & @AutoItX64 & @CRLF) Local $Width = 320 Local $Height = @DesktopHeight - 40 ; $DTs[1] Local $hWnd = GUICreate("RibonGUI", $Width, $Height, -7, -1, $WS_POPUPWINDOW, BitOR($WS_EX_TOOLWINDOW, $WS_EX_TOPMOST)) ; $idLblHead = GUICtrlCreateLabel("", 0, 0, $Width, 32) ; GUICtrlSetBkColor(-1, 0x004A7F) Local $iStep = 2 $idBtnAutoHide = GUICtrlCreateButton("◀", $Width - 30, $iStep, 28, 28) GUICtrlSetFont(-1, 14) GUICtrlSetTip(-1, "Auto Hide ") GUICtrlSetOnEvent(-1, "Ribon_BtnAutoHide") $iStep += 50 GUICtrlCreateLabel("$idInput1", 10, $iStep, 300, 15) $iStep += 15 $idInput1 = GUICtrlCreateInput("Tex1", 10, $iStep, 305, 22) GUICtrlSetFont(-1, 12, 400, 0, "DejaVuSansMono") $iStep += 40 GUICtrlCreateLabel("$idInput2", 10, $iStep, 300, 15) $iStep += 15 $idInput2 = GUICtrlCreateInput("Tex2", 10, $iStep, 305, 22) GUICtrlSetFont(-1, 12, 400, 0, "DejaVuSansMono") $iStep += 40 GUICtrlCreateLabel("$idInput3", 10, $iStep, 300, 15) $iStep += 15 $idInput3 = GUICtrlCreateInput("Tex3", 10, $iStep, 305, 22) GUICtrlSetFont(-1, 12, 400, 0, "DejaVuSansMono") $iStep += 40 GUICtrlCreateLabel("$idInput4", 10, $iStep, 300, 15) $iStep += 15 $idInput4 = GUICtrlCreateInput("Tex4", 10, $iStep, 305, 22) GUICtrlSetFont(-1, 12, 400, 0, "DejaVuSansMono") GUICtrlCreateLabel("", 0, 0, $Width, $Height, $SS_GRAYFRAME) Return $hWnd EndFunc ;==>RibonGUI ;---------------------------------------------------------------------------------------- Func Ribon_BtnAutoHide() If $g_bAutoHide = True Then $g_bAutoHide = False GUICtrlSetData($idBtnAutoHide, "⏸️") Else $g_bAutoHide = True GUICtrlSetData($idBtnAutoHide, "◀️") EndIf EndFunc ;==>Ribon_BtnAutoHide ;----------------------------------------------------------------------------------------
    2 points
  20. You are probably confused by the difference between 0-based and 1-based arrays. @TheDcoder has created a helpful tutorial on arrays. This contains, for instance, an explanation of this particular topic. Excerpt : UBound returns the no. of elements in an array with the index starting from 1! That's right, you need to remove 1 from the total no. of elements in order to process the array because the index of an array starts with 0! So append a simple - 1 to the statment:
    2 points
  21. Thanks for testing @ioa747. Since the lost of handles is very minimal, I think it is preferable to use True in _WinAPI_OpenProcess in order to catch all possible processes.
    2 points
  22. TwoCanoe, For simplicity, I would use a dummy input like this: #include <GUIConstantsEx.au3> #include <EditConstants.au3> Local $sMyHex = "0000FF" $hGUI = GUICreate("Test", 500, 500) $cInput = GUICtrlCreateInput(String($sMyHex), 10, 100, 100, 20, $ES_CENTER) $cDummyInput = GUICtrlCreateInput(Dec($sMyHex), 110, 100, 20, 20) $cUpDown = GUICtrlCreateUpdown($cDummyInput) GUICtrlSetState($cDummyInput, $GUI_FOCUS) GUISetState() While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE Exit Case $cDummyInput GUICtrlSetData($cInput, Hex(Number(GUICtrlRead($cDummyInput)), 6)) EndSwitch WEnd Increase the width of the dummy input to see what is going on. M23
    2 points
  23. ValentinM, Good day yesterday with the nietos and I think I have a new solution for you today - the scrolling problem was exactly what I thought it might be and the solution was pretty easy to code. Here is a new Beta: GUIListViewEx_Mod.au3 And the example I have been using to test which works perfectly for me: GLVEx_Ex.au3 If you still have problems, please let me see the code you are using to create, load and initialise your ListView to see if I can spot the reason. M23 Edit: Found an edge case in testing - working on it. Edit 2: New Beta uploaded.
    2 points
  24. No, at least I can't . It looks like a typical XY problem to me - https://en.wikipedia.org/wiki/XY_problem
    2 points
  25. Can somebody please explain why this would be needed at all?
    2 points
  26. There is no easy way to perform what you want to achieve. But you can quite easily find WHERE the leak is happening. You will need to log at various strategic places (e.g. beginning and end of a function, beginning and end of a task, etc) the result of ProcessGetStats() (see help file for more details). As an example here, you see that by not closing the file makes the script grow rapidly in memory size. Instead of writing to the console, write it in a log file, put some timestamp and location within the script and you will find where the memory starts growing. Example() Func Example() Local $aMemory = ProcessGetStats(), $hFile ConsoleWrite("WorkingSetSize: " & $aMemory[0] & "/ PeakWorkingSetSize: " & $aMemory[1] & @CRLF) For $i = 1 To 1000 $hFile = FileOpen("Torus.jpg") ;FileClose($hFile) Next $aMemory = ProcessGetStats() ConsoleWrite("WorkingSetSize: " & $aMemory[0] & "/ PeakWorkingSetSize: " & $aMemory[1] & @CRLF) EndFunc ;==>Example ps. see Debug Management UDF in help file to support logging into a file
    2 points
  27. In my OutlookEX UDF I had to do it in two steps: First add the picture as attachment to the mail item, then refer to this attachment in the mail text. The trick is to create an inline picture by using a content id (CID). Please see example 4 from _OL_ItemCreate.au3.
    2 points
  28. WinGetClassList EnableExplicit Structure winparam hwnd.i title.s text.s result.s EndStructure Procedure EnumWinProc(hwnd.l, *ptr.winparam) Protected title${256} ; буфер GetWindowText_(hwnd, @title$, 256) If Asc(title$) And title$ = *ptr\title PokeL(@*ptr\hwnd, hwnd) ProcedureReturn 0 EndIf ProcedureReturn 1 EndProcedure Procedure EnumChildProc(hwnd.l, *ptr.winparam) Protected class${256}, text${256} GetClassName_(hwnd, @class$, 256) If Asc(class$) If Asc(*ptr\text) GetWindowText_(hwnd, @text$, 256) If text$ = *ptr\text *ptr\result + class$ + #LF$ EndIf Else *ptr\result + class$ + #LF$ EndIf EndIf ProcedureReturn 1 EndProcedure Procedure.s WinGetClassList(title$, text$ = "") Protected ptr.winparam ptr\title = title$ ptr\text = text$ EnumWindows_(@EnumWinProc(), @ptr) If ptr\hwnd EnumChildWindows_(ptr\hwnd, @EnumChildProc(), @ptr) ptr\result = RTrim(ptr\result, #LF$) ProcedureReturn ptr\result EndIf EndProcedure Debug WinGetClassList("Untitled — Notepad")
    2 points
  29. The strategy I prefer, as I am using it ALL the time, is the Tidy backup. You decide when you want to make your backup. If you are making a lot of changes and want to rollback to few days ago, then Tidy is more adapted to that situation. And one non-negligible benefit of Tidy is of course to have your scripts all cleaned-up.
    2 points
  30. I started on this before you found your above solution, but never had time to finish. I thought I might as well share it now since I completed it. It’s a bit more complex looking than yours, and can also be broken a few different ways. But it does works for the examples you posted, here it is. #include <StringConstants.au3> ; looking to discern the parameters with RegExp ConsoleWriteDebug(anyFunc(' ''1''', "2""", @ScriptLineNumber) & @CRLF) ; add @ScriptLineNumber ConsoleWriteDebug('This, is'' a string' & @CRLF) ; add @ScriptLineNumber ConsoleWriteDebug("This, is' a string" & @CRLF) ; add @ScriptLineNumber ConsoleWriteDebug('This, is'' a string' & @CRLF, @ScriptLineNumber) ; don't add @ScriptLineNumber ConsoleWriteDebug("This, is' a string" & @CRLF, 88, 1, 2) ; don't add @ScriptLineNumber ;~ ConsoleWriteDebug("This is' a string" & @CRLF, @ScriptLineNumber, 1, 2) ; don't touch Global $sString = "This is' a string" ConsoleWriteDebug($sString & @CRLF, @ScriptLineNumber) ; don't add @ScriptLineNumber ConsoleWriteDebug($sString, @ScriptLineNumber) ; don't add @ScriptLineNumber ConsoleWriteDebug($sString) ; ConsoleWriteDebug(anyFunc(anyFunc(' ''1''', "2""", @ScriptLineNumber), "2""", @ScriptLineNumber) & @CRLF) ; add @ScriptLineNumber ConsoleWriteDebug("10", "2") ; add @ScriptLineNumber ConsoleWriteDebug(-1, "2") ; add @ScriptLineNumber anyFunc(ConsoleWriteDebug("10")) ; add @ScriptLineNumber ;~ ConsoleWriteDebug("This is' a string" & @CRLF, 123, 1, 2) ; don't touch ConsoleWrite(_Add_ScriptLineNumber(FileRead(@ScriptFullPath)) & @CRLF) Func _Add_ScriptLineNumber($sScript, $sFuncName = "ConsoleWriteDebug", $iAddAtParameterNumber = 2) Local $sFixedScript = "", $sLine, $sAddCRLF = @CRLF, $sEmptyAddParam = '""' Local $asScript[0], $asMatch[0] Local Const $iQuoteChar = 34 Local $iParam = 1, $iFuncLevel = 1, $iLine = 0 ConsoleWrite("> =========== BEGINNING ===========" & @CRLF) $asScript = StringSplit($sScript, @CRLF, $STR_ENTIRESPLIT) For $i = 1 To $asScript[0] $sLine = $asScript[$i] $iLine += 1 If ($i = $asScript[0]) Then $sAddCRLF = "" If StringRegExp($sLine, "\Q" & $sFuncName & "\E\(") And Not StringRegExp($sLine, "^(?:[\s]*;|[\s]*\b[fF][uU][nN][cC]\b[ ]|[\s]*\b[eE][nN][dD][fF][uU][nN][cC]\b[ ])") Then ; If function is in the line, and not commented out, and not the Func declaration itself. $iParam = 1 $iFuncLevel = 1 $asMatch = StringRegExp($sLine, ".*\Q" & $sFuncName & "\E\([/s]*", $STR_REGEXPARRAYMATCH) _AddLine($sFixedScript, $sLine, $asMatch, $iLine, $sAddCRLF) Do If ($iParam = $iAddAtParameterNumber) And ($iFuncLevel = 1) Then If StringRegExp($sLine, "^[\d]") Then ; Raw digit in position. $asMatch = StringRegExp($sLine, "^[\d]*", $STR_REGEXPARRAYMATCH) If IsArray($asMatch) And ($iLine <> $asMatch[0]) Then ConsoleWrite("! Line " & $iLine & ", Raw line number is incorrect! Current = " & $asMatch[0] & "; Should be: " & $iLine & @CRLF) ElseIf StringRegExp($sLine, "^\Q@ScriptLineNumber\E") Then ; @ScriptLineNumber in position, do nothing. Else $asMatch = StringRegExp($sLine, "^.+?(?:\)|,)", $STR_REGEXPARRAYMATCH) ; Retrieve data to next comma or end parenthesis. If IsArray($asMatch) Then If StringRegExp($asMatch[0], "[^\d\), " & Chr($iQuoteChar) & "]") Then ; See if parameter contains anything other than digits, quotes and/or spaces. ConsoleWrite("- Line " & $iLine & ", Encountered parameter not containing @ScriptLineNumber and no line number alone:" & @TAB & $sLine & @CRLF) ElseIf StringRegExp($asMatch[0], "[\d]") Then ; See if parameter contains digits. $asMatch = StringRegExp($sLine, "[\d]+", $STR_REGEXPARRAYMATCH) If IsArray($asMatch) And ($iLine <> $asMatch[0]) Then ConsoleWrite("! Line " & $iLine & ", Raw quoted line number is incorrect! Current = " & $asMatch[0] & "; Should be: " & $iLine & @CRLF) ElseIf Not StringRegExp($asMatch[0], "\Q@ScriptLineNumber\E") Then ConsoleWrite("- Line " & $iLine & ", Encountered parameter not containing @ScriptLineNumber:" & @TAB & $sLine & @CRLF) Else ConsoleWrite("- Line " & $iLine & ", Encountered unknown parameter in @ScriptLineNumber position:" & @TAB & $sLine & @CRLF) EndIf EndIf EndIf $sFixedScript &= $sLine & $sAddCRLF ExitLoop EndIf Select Case StringRegExp($sLine, "^[a-zA-Z_]") ; A function as it starts with a letter or underscore. $asMatch = StringRegExp($sLine, "^[\w]+\(?[ ]*", $STR_REGEXPARRAYMATCH) _AddLine($sFixedScript, $sLine, $asMatch, $iLine, $sAddCRLF) $iFuncLevel += 1 ; Show I am in a function in a Parameter, and not the main ConsoleWriteDebug function. Case StringRegExp($sLine, "^[\[\(]") ; A Bracket. $asMatch = StringRegExp($sLine, "^((?:\(.+?\)|\[.+?\])[\s]*)", $STR_REGEXPARRAYMATCH) _AddLine($sFixedScript, $sLine, $asMatch, $iLine, $sAddCRLF) ;~ Case StringRegExp($sLine, "^\$") ; A Variable. ; $asMatch = StringRegExp($sLine, "(^\$[\w\[\]]*[\s]*)", $STR_REGEXPARRAYMATCH) ; can be broken with spaces in array brackets $aArray[ 0] $asMatch = StringRegExp($sLine, "(^\$[\w]*[\s]*)", $STR_REGEXPARRAYMATCH) _AddLine($sFixedScript, $sLine, $asMatch, $iLine, $sAddCRLF) Case StringRegExp($sLine, "^['" & Chr($iQuoteChar) & "]") ; A String. $asMatch = StringRegExp($sLine, "^((?:'.*?'|" & Chr($iQuoteChar) & ".*?" & Chr($iQuoteChar) & ")[\s]*)", $STR_REGEXPARRAYMATCH) _AddLine($sFixedScript, $sLine, $asMatch, $iLine, $sAddCRLF) Case StringRegExp($sLine, "^[@&]") ; A Macro or joiner. $asMatch = StringRegExp($sLine, "^((?:@|&)[\w]*[\s]*)", $STR_REGEXPARRAYMATCH) _AddLine($sFixedScript, $sLine, $asMatch, $iLine, $sAddCRLF) Case StringRegExp($sLine, "^[\-\d]") ; A digit, including a negative. $asMatch = StringRegExp($sLine, "^([\-\d,\.]+[\s]*)", $STR_REGEXPARRAYMATCH) _AddLine($sFixedScript, $sLine, $asMatch, $iLine, $sAddCRLF) Case StringRegExp($sLine, "^\)") ; An ending parenthesis. If ($iFuncLevel = 1) Then ; I'm in the main ConsoleWriteDebug function, determine if I need to add @ScriptLineNumber. Else I'm in a function in a function, just decrease count and process. If ($iParam < ($iAddAtParameterNumber - 1)) Then ; Minus 1 to compensate for @ScriptLineNumber parameter being added. While ($iParam < ($iAddAtParameterNumber - 1)) ; If Parameter to fill in @ScriptLineNumber isn't current one, add blanks $sFixedScript &= ", " & $sEmptyAddParam $iParam += 1 WEnd EndIf ConsoleWrite("- Adding @ScriptLineNumber to line: " & $iLine & @CRLF) $sFixedScript &= ", " & "@ScriptLineNumber" & $sLine & $sAddCRLF ExitLoop Else $iFuncLevel -= 1 $asMatch = StringRegExp($sLine, "^\)[\s]*", $STR_REGEXPARRAYMATCH) _AddLine($sFixedScript, $sLine, $asMatch, $iLine, $sAddCRLF) EndIf Case StringRegExp($sLine, "^,") ; A comma. If ($iFuncLevel = 1) Then $iParam += 1 ; I'm in the main ConsoleWriteDebug function, increase Parameter count. Else I'm in a function in a function, just process. $asMatch = StringRegExp($sLine, "^,[\s]*", $STR_REGEXPARRAYMATCH) _AddLine($sFixedScript, $sLine, $asMatch, $iLine, $sAddCRLF) Case Else ; Unexpected character, trim one off ConsoleWrite("> Encountered an unexpected character, trimming it off: " & StringLeft($sLine, 1) & @CRLF) $sFixedScript &= StringLeft($sLine, 1) ; add the removed character to the script string. $sLine = StringTrimLeft($sLine, 1) $asMatch = StringRegExp($sLine, "^[\s]*", $STR_REGEXPARRAYMATCH) ; Remove any white space. _AddLine($sFixedScript, $sLine, $asMatch, $iLine, $sAddCRLF) EndSelect Until $sLine = "" Else ; Just copy the line. $sFixedScript &= $sLine & $sAddCRLF EndIf Next ConsoleWrite("+ =========== FINISHED ===========" & @CRLF) Return $sFixedScript ; with the added ", @ScriptLineNumber)" where needed EndFunc ;==>_Add_ScriptLineNumber Func _AddLine(ByRef $sFixedScript, ByRef $sLine, ByRef $asArray, $iLine, $sAddCRLF) If Not IsArray($asArray) Then ConsoleWrite("! Identification failed on line: " & $iLine & " Skipping" & @CRLF) $sFixedScript &= $sLine & $sAddCRLF $sLine = "" Else $sFixedScript &= $asArray[0] ; add the beginning of the string to the script string. $sLine = StringTrimLeft($sLine, StringLen($asArray[0])) EndIf EndFunc ;==>_AddLine Func ConsoleWriteDebug($sStr = @CRLF, $iLine = @ScriptLineNumber, $iError = @error, $iExtended = @extended) Local $iRet = ConsoleWrite("@@ Debug (" & $iLine & ") : " & $sStr & (StringRight($sStr, 2) = @CRLF ? "" : @CRLF)) Return SetError($iError, $iExtended, $iRet) ; https://www.autoitscript.com/forum/topic/139260-autoit-snippets/?do=findComment&comment=1538974 EndFunc ;==>ConsoleWriteDebug Func anyFunc($1 = "", $2 = "", $3 = "") Return 'anyFunc' & $1 & $2 & $3 EndFunc ;==>anyFunc Can be broken if: A parameter contains an Array variable with spaces in the element $aArray[ 0] [Modified above script with a fix If ConsoleWriteDebug is commented out, but the comment mark (;) is not the first Character (besides whitespaces). Benefits: Works when ConsoleWriteDebug is nested. Works when functions in ConsoleWriteDebug are nested, i.e. ConsoleWriteDebug(anyFunc(anyFunc( Checks for accuracy raw line numbers. Can place @ScriptLineNumber in different Parameter place, filling in skipped parameters with a predesignated string. Maybe it will give some options.
    2 points
  31. Visit a Dentist?
    2 points
  32. or you could take this approach, where things have their place ;~ ----------------------------------------------- #include <GUIConstantsEx.au3> #include <GUIListBox.au3> #include <GuiListView.au3> #include <MsgBoxConstants.au3> ; ----------------------------------------------- Global $hGUI = GUICreate("Title", 220, 75) ; ----------------------------------------------- ; COLUMN 1 BUTTONS Global $_sCol1Row1 = GUICtrlCreateButton("Item 1", 10, 10, 200, 25) Global $_sCol1Row2 = GUICtrlCreateButton("Item 1", 10, 40, 200, 25) Global $idUserDocs = GUICtrlCreateDummy() ; ----------------------------------------------- Local $aAccelKeys[1][2] = [["{F1}", $idUserDocs]] GUISetAccelerators($aAccelKeys) ; ----------------------------------------------- GUISetState(@SW_SHOW, $hGUI) ; ----------------------------------------------- While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE Exit ; ----------------- ; COLUMN 1 BUTTONS Case $_sCol1Row1 _MyFunction1() Case $_sCol1Row2 _MyFunction2() Case $idUserDocs _UserDocs() EndSwitch WEnd ; ----------------------------------------------- ; COLUMN 1 BUTTONS ; ----------------------------------------------- Func _MyFunction1() MsgBox(0, "", "Inside _MyFunction1") EndFunc ;==>_MyFunction1 ; ----------------------------------------------- Func _MyFunction2() MsgBox(0, "", "Inside _MyFunction2") EndFunc ;==>_MyFunction2 ; ----------------------------------------------- Func _UserDocs() Local $sPdfProgram = "C:\Program Files (x86)\FoxitReader\Foxit Reader.exe" Local $sPdfFile = "C:\Working\TestMe.pdf" ; ----------------------------------------------- ShellExecute($sPdfProgram, $sPdfFile) EndFunc ;==>_UserDocs ; -----------------------------------------------
    2 points
  33. Nine

    window invert color

    @ioa747 I thought about it but, to be honest, never tried it seriously. Using your code (with modification to the UDF) solves the issue mentioned before, but created (in my perspective) larger problems. Invert the colors, you will see that submenus and popup windows do not display correctly. Maximize does not produce proper result, same goes with resizing larger than initial display. I stopped testing at this point. I have invested enough of my time on my proposal, sorry to say, I will not try to solve the problems of yours. Thanks for sharing. PS. I need a good night sleep, maybe tomorrow I will be more likely to further analyse your solution...
    2 points
  34. Nine

    window invert color

    Could you try this one, I think I have found a better way to remove topmost to the magnifier in a more efficient way : #include <WindowsConstants.au3> #include "WinMagnifier.au3" _MagnifierInit() Run("Notepad") Sleep(100) Local $hWnd = WinGetHandle("[CLASS:Notepad]"), $aPos[4], $aPosTmp[4] WinGetPosEx($hWnd, $aPos) Local $aHndl = _MagnifierGUICreate($aPos[2], $aPos[3], $aPos[0], $aPos[1]), $hMagnifyGUI = $aHndl[0], $hMagnifyCtrl = $aHndl[1] GUISetState(@SW_SHOWNOACTIVATE, $hMagnifyGUI) _MagnifierSetSource($hMagnifyCtrl, $aPos[0], $aPos[1], $aPos[2], $aPos[3]) _MagnifierSetColorEffect($hMagnifyCtrl, $COLOR_EFFECTS_INVERSION_MATRIX) While WinExists($hWnd) Sleep(10) If WinActive($hWnd) Or _WinAPI_GetParent(WinGetHandle("[ACTIVE]")) = $hWnd Then If Not BitAND(WinGetState($hMagnifyGUI), $WIN_STATE_VISIBLE) Then GUISetState(@SW_SHOWNOACTIVATE, $hMagnifyGUI) WinGetPosEx($hWnd, $aPosTmp) If $aPos[0] <> $aPosTmp[0] Or $aPos[1] <> $aPosTmp[1] Or $aPos[2] <> $aPosTmp[2] Or $aPos[3] <> $aPosTmp[3] Then $aPos = $aPosTmp WinMove($hMagnifyGUI, "", $aPos[0], $aPos[1], $aPos[2], $aPos[3]) _WinAPI_MoveWindow($hMagnifyCtrl, 0, 0, $aPos[2], $aPos[3], False) _MagnifierSetSource($hMagnifyCtrl, $aPos[0], $aPos[1], $aPos[2], $aPos[3]) EndIf WinSetOnTop($hMagnifyGUI, "", $WINDOWS_ONTOP) _WinAPI_RedrawWindow($hMagnifyCtrl) ElseIf Not BitAND(WinGetState($hWnd), $WIN_STATE_MINIMIZED) Then If BitAND(_WinAPI_GetWindowLong($hMagnifyGUI, $GWL_EXSTYLE), $WS_EX_TOPMOST) Then _WinAPI_SetWindowPos($hMagnifyGUI, WinGetHandle("[ACTIVE]"), 0, 0, 0, 0, $SWP_NOMOVE + $SWP_NOSIZE + $SWP_SHOWWINDOW) EndIf ElseIf BitAND(WinGetState($hMagnifyGUI), $WIN_STATE_VISIBLE) Then GUISetState(@SW_HIDE, $hMagnifyGUI) EndIf WEnd _WinAPI_DestroyWindow($hMagnifyCtrl) GUIDelete($hMagnifyGUI) Func WinGetPosEx($hWnd, ByRef $aPos) Local $aTmp = WinGetPos($hWnd) If @error Then Return $aPos = $aTmp ; adjust magnifier to the edge of the window $aPos[0] += 8 $aPos[1] += 1 $aPos[2] -= 16 $aPos[3] -= 9 EndFunc
    2 points
  35. argumentum

    AutoIt Snippets

    Report_GetDriveSpaceFree() Func Report_GetDriveSpaceFree($sDrive = "C:\", $iLine = @ScriptLineNumber) ; how I use it in my project Local $iFree = GetDriveSpaceFree($sDrive), $iTotal = @extended, $iError = @error, $iUsed = $iTotal - $iFree ConsoleWriteDebug(($iFree < 10 ? "!" : "+") & " DriveSpaceFree(" & $sDrive & "): " & $iFree & ' GB free of ' & $iTotal & ' GB total (Used: ' & $iUsed & ' GB)(Error: ' & $iError & ').' & @CRLF, $iLine) EndFunc ;==>Report_GetDriveSpaceFree Func GetDriveSpaceFree($sDrive = "C:\") ; in GB Local $iError = 0, $iFree = DriveSpaceFree($sDrive) $iError += @error ; https://www.autoitscript.com/forum/topic/139260-autoit-snippets/?do=findComment&comment=1538974 Local $iTotal = DriveSpaceTotal($sDrive) $iError += @error Return SetError($iError, Int($iTotal / 1024), Int($iFree / 1024)) EndFunc ;==>GetDriveSpaceFree Func ConsoleWriteDebug($sStr = @CRLF, $iLine = @ScriptLineNumber, $iError = @error, $iExtended = @extended) Local $iRet = ConsoleWrite("@@ Debug (" & $iLine & ") : " & $sStr & (StringRight($sStr, 2) = @CRLF ? "" : @CRLF)) Return SetError($iError, $iExtended, $iRet) ; https://www.autoitscript.com/forum/topic/139260-autoit-snippets/?do=findComment&comment=1538974 EndFunc ;==>ConsoleWriteDebug I needed GetDriveSpaceFree() for a project and ConsoleWriteDebug() is a good idea. ..and, code to add the @ScriptLineNumber to your main script.
    2 points
  36. I found that the effect of ▶/❚❚ varies depending on the OS character sets. It was very much noticeable in my computer which has Hangeul character set as default. So if you want to see the same effect as I see, you should use _GUICtrlRichEdit_SetFont($hRichEdit, 12, "Arial", 129) instead of _GUICtrlRichEdit_SetFont($hRichEdit, 12, "Arial") in the example above.
    2 points
  37. Mr es335, Very understandable. However; you do not have a pea-sized intellect. Get rid of that negative self-deprecation, as you are only making it harder on yourself with that thinking. We all want to run, but we all have to learn to walk first. Take short breaks. Do something else like play an ES335. Programming does seem to be new to you. Programming is hard. The first programming language anyone learns is usually the hardest. Again, one has to learn how to walk before one can run, and we all want to run. As you already know; Programs get complicated fast. Your mind will adjust if you stay with it long enough. AutoIt is probably the easiest dynamic programming language to learn. Learning to write programs does take time. A lot of time. A very large investment of time spent coding is required to become really good at coding. I have days where I just suck at it. So I smile, I take a break, and come back to it. The devil smiles at us all, all anyone can do is smile back.
    2 points
  38. Version 1.6.3.0

    17,362 downloads

    Extensive library to control and manipulate Microsoft Active Directory. Threads: Development - General Help & Support - Example Scripts - Wiki Previous downloads: 30467 Known Bugs: (last changed: 2020-10-05) None Things to come: (last changed: 2020-07-21) None BTW: If you like this UDF please click the "I like this" button. This tells me where to next put my development effort
    2 points
  39. Magnifier Functions UDF That magnify tool in Windows since Vista? Yeah, pretty nice feature eh? Well, turns out there's an API that is going unused around here! We've got to change that! MSDN Links: Magnification API Magnifier Functions Magnifier API Overview (includes examples) This UDF exposes most of the useful Magnifier API functions available since Windows Vista. The built-in Magnifier offers very easy screen magnification in the form of Magnifier controls or Full-screen magnification (since Windows 7). It also allows altering the colors of the magnifier or in face the whole screen. With the Magnify API, you can do all sorts of neat things: Create a hardware-accelerated Magnifier control in any GUI (of any size) Resize any part of the screen by any factor (as a floating point value) Alter the colors (invert, grayscale, etc) Ignore certain windows (they become like invisible windows to the magnifier) Full-screen Color Effects (Win 7+ but official as of Win 8) Full-screen Magnify (Win 7+ but official as of Win 8) Windows 7 has 2 Full-screen Magnification API functions that are considered undocumented, but are nearly identical to their Windows 8 documented API counterparts. Therefore, the UDF script takes care of calling the correct API function based on the O/S. The UDF functions are _MagnifierFullScreenSetScale() and _MagnifierFullScreenSetColorEffect(). The only difference in these functions is SetMagnificationDesktopMagnification uses a double for its 1st parameter whereas MagSetFullscreenTransform uses a float. Here's the Win7 undocumented to Win8 documented API mapping: SetMagnificationDesktopColorEffect - MagSetFullscreenColorEffect SetMagnificationDesktopMagnification - MagSetFullscreenTransform There are two examples included in the ZIP archive. The 1st, MagnifierExperiments, shows all the wacky things that can be done using the Magnifier. The 2nd is an example of Inverting screen colors via a Tray interface (both are below). Updates:: Magnifier Experiments: Various Full-screen and Window magnifier effects tests: ; =========================================================================================================== ; <MagnifierExperiments.au3> ; ; Experiments with the Built-In Windows Magnification API (since Windows Vista) ; Uses <WinMagnifier.au3> ; ; NOTE: TRY to run this at the same bit-mode your O/S is running in, as the GUI can be funky at times ; when run in an incompatible bit mode. So for 64-bit O/S's, run this as x64 only! ; ; Check out the Examples from 'Magnification API Overview', where much of the experiments thus far come from ; @ MSDN: http://msdn.microsoft.com/en-us/library/windows/desktop/ms692402%28v=vs.85%29.aspx ; ; Author: Ascend4nt ; =========================================================================================================== ;~ #AutoIt3Wrapper_UseX64=Y ; Use when necessary #include "WinMagnifier.au3" #include <WinAPIGdi.au3> ; _WinAPI_DwmIsCompositionEnabled() #Region MAGNIFIER_EXPERIMENTS ; ============================================================================= ; Func _MagnificationExperiments($nWidth, $nHeight, $iX1, $iY1, ; $fMagFactor = Default, $bInvertColors = 1, ; $bShowCursor = False) ; ; ; Author: Ascend4nt ; ============================================================================= Func _MagnificationExperiments($nWidth, $nHeight, $iX1, $iY1, $fMagFactor = Default, $bInvertColors = False, $bShowCursor = False) Local $aTmp, $aColorFX, $hMagnifyGUI, $hMagnifyCtrl ;~ If Not _MagnifierInit() Then Return SetError(@error, 0, 0) $aTmp = _MagnifierGUICreate($nWidth, $nHeight, $iX1, $iY1, $bInvertColors, $bShowCursor) If @error Then Return SetError(@error, 0, 0) $hMagnifyGUI = $aTmp[0] $hMagnifyCtrl = $aTmp[1] ; Optionally make the window Topmost ;~ WinSetOnTop($hMagnifyGUI, "", 0) ; ------------------------- ; -- MAGNIFICATION SCALE -- If $fMagFactor <> Default Then _MagnifierSetScale($hMagnifyCtrl, $fMagFactor) EndIf ; ------------------------- ; ------------------ ; -- SET SOURCE (on screen) -- ;~ _MagnifierSetSource($hMagnifyCtrl, 0, 0, 200, 100) ; ------------------ ; ------------------ ; Exclude Windows! _MagnifierSetWindowFilter($hMagnifyCtrl, WinGetHandle("[CLASS:SciTEWindow]")) ; ------------------ ConsoleWrite("InvertColors flag (MS_INVERTCOLORS) set? = " & _MagnifierIsInvertColorsStyle($hMagnifyCtrl) & @LF) ; ------------------ ; SHOW IT! GUISetState(@SW_SHOW, $hMagnifyGUI) MsgBox(0, "Normal Magnify", "Normal 2x scale") ; Inverted Colors Dim $aColorFX[5][5] = [ _ [-1.0, 0, 0, 0, 0], _ [ 0, -1.0, 0, 0, 0], _ [ 0, 0, -1.0, 0, 0], _ [ 0, 0, 0, 1.0, 0], _ [1.0, 1.0, 1.0, 0, 1.0] ] _MagnifierSetColorEffect($hMagnifyCtrl, $aColorFX) MsgBox(0, "Inverted Colors via ColorFX", "Inverted Colors via ColorEffects") ;~ _MagnifierSetInvertColorsStyle($hMagnifyCtrl, True) ;~ MsgBox(0, "Inverse Color Style", "Inverse Effect Color Style (control style)") ; ------------------ ;~ $aColorFX = _MagnifierGetColorEffect($hMagnifyCtrl) ;~ _ArrayDisplay($aColorFX, "Color Effects Matrix") ; ------------------ ; -- CLEAR COLOR EFFECTS -- _MagnifierClearColorEffects($hMagnifyCtrl) ; ------------------ ; Still set after Setting Color Effects to Identity Matrix (restored original colors) ;~ ConsoleWrite("InvertColors flag (MS_INVERTCOLORS) set? = " & _MagnifierIsInvertColorsStyle($hMagnifyCtrl) & @LF) ; ------------------------- ; -- SET SOURCE AGAIN -- _MagnifierSetSource($hMagnifyCtrl, $iX1 + 100, $iY1 + 100, $iX1 + $nWidth, $iY1 + $nHeight) MsgBox(0, "Source Change", "Moved Source & Cleared Effects") ; ------------------ ; -- COLOR EFFECTS -- If 1 Then _MagnifierSetColorEffect($hMagnifyCtrl, $COLOR_EFFECTS_GRAYSCALE_MATRIX) MsgBox(0, "Grayscale", "Grayscale Color Effects") EndIf ; ------------------ GUIDelete($hMagnifyGUI) Return 1 EndFunc #Region MAIN_CODE _WinMain() ; ------------------= MAIN CODE =----------------------- Func _WinMain() ; Force restart with AutoIt x64 if running on a 64-bit O/S If @OSArch = "X64" And Not @AutoItX64 And Not _IsScriptCompiledToExe() Then Exit ShellExecute(StringReplace(@AutoItExe, ".exe", "_x64.exe", -1),'/AutoIt3ExecuteScript "' & @ScriptFullPath & '"', @WorkingDir) EndIf ; Setting DWM off has these effects: ; - Full-screen Magnifier Color Effects AND Magnification do NOT work ; - Magnifier Control will not 'ignore' windows with _MagnifierSetWindowFilter() ; - Magnified images tend to look blurry - possibly software-mode magnification? ; Force DWM off so Full-screen Effect tests don't run ;_WinAPI_DwmEnableComposition(False) If Not _MagnifierInit() Then Exit @error ; Magnifier Full-screen Effects Require DWM Composition to be enabled If _WinAPI_DwmIsCompositionEnabled() Then If _MagnifierFullScreenSetColorEffect($COLOR_EFFECTS_GRAYSCALE_MATRIX) Then MsgBox(0, "Full-screen Magnify FX", "Gray-scale Color Effects!") ;~ $aColorFX = _MagnifierFullScreenGetColorEffect() ;~ _ArrayDisplay($aColorFX, "Full-screen matrix after Grayscale Transform") _MagnifierFullScreenClearColorEffects() MsgBox(0, "Full-screen Magnify FX", "Colors back to normal! Yay?") EndIf ; Full-screen Magnifier issues: ; - Windows Vista: Not supported ($g_nWinMagnifyAPILevel = 1) ; - Windows 7: Uses negative numbers, not entirely sure of how these values are mapped just yet ; - Windows 8: Works pretty much as expected (and documented) - use positive #'s indicating top-left of scaled screen If $g_nWinMagnifyAPILevel >= 7 Then Local $bRet ; Difference in calculations for Win7 and Win8 - need a consistent mapping method! If $g_nWinMagnifyAPILevel = 7 Then _MagnifierFullScreenSetScale(2.0, -1 * @DesktopWidth / 2, -1 * @DesktopHeight / 2) Else ; $g_nWinMagnifyAPILevel >= 8 _MagnifierFullScreenSetScale(2.0, @DesktopWidth / 4, @DesktopHeight / 4) EndIf MsgBox(0, "Full-screen Scale FX", "Scaled 2x") _MagnifierFullScreenSetScale(1.0) MsgBox(0, "Full-screen Scale FX", "Back to 1x scale") EndIf ; Brightness Lowering isolated (Contrast & Saturation look bad) Dim $aColorFX[5][5] = [ _ [ 1.0, 0, 0, 0, 0], _ [ 0, 1.0, 0, 0, 0], _ [ 0, 0, 1.0, 0, 0], _ [ 0, 0, 0, 1.0, 0], _ [-0.5, -0.5, -0.5, 0, 1.0] ] ; Brightness - Lowering - Color Components Dim $aColorFX[5][5] = [ _ [0.6, 0, 0, 0, 0], _ [ 0, 0.6, 0, 0, 0], _ [ 0, 0, 0.6, 0, 0], _ [ 0, 0, 0, 1.0, 0], _ [ 0, 0, 0, 0, 1.0] ] _MagnifierFullScreenSetColorEffect($aColorFX) MsgBox(0, "Brightness Lowered Fullscreen", "Fullscreen ColorEffects - Brightness Reduced") ; Verify effects (false here): ;ConsoleWrite("Inversion Matrix Comparison Result:" & _MagnifierColorEffectIsEqual(_MagnifierFullScreenGetColorEffect(), $COLOR_EFFECTS_INVERSION_MATRIX) & @LF) _MagnifierFullScreenSetColorEffect($COLOR_EFFECTS_INVERSION_MATRIX) MsgBox(0, "Inverted Fullscreen", "Fullscreen ColorEffects - Inversion." & @CRLF & _ "Inversion Matrix Comparison Result:" & _MagnifierColorEffectIsEqual(_MagnifierFullScreenGetColorEffect(), $COLOR_EFFECTS_INVERSION_MATRIX)) #cs ; Inverted Colors - Lowered Brightness (adding to color components, reducing brightness components) Dim $aColorFX[5][5] = [ _ [-0.7, 0, 0, 0, 0], _ [ 0, -0.7, 0, 0, 0], _ [ 0, 0, -0.7, 0, 0], _ [ 0, 0, 0, 1.0, 0], _ [0.7, 0.7, 0.7, 0, 1.0] ] _MagnifierFullScreenSetColorEffect($aColorFX) MsgBox(0, "Inverted LB Fullscreen", "Fullscreen ColorEffects - Inversion Lowered Brightness") #ce #cs ; Inverted Colors - Increased Brightness Dim $aColorFX[5][5] = [ _ [-1.3, 0, 0, 0, 0], _ [ 0, -1.3, 0, 0, 0], _ [ 0, 0, -1.3, 0, 0], _ [ 0, 0, 0, 1.0, 0], _ [1.3, 1.3, 1.3, 0, 1.0] ] _MagnifierFullScreenSetColorEffect($aColorFX) MsgBox(0, "Inverted IB Fullscreen", "Fullscreen ColorEffects - Inversion Increased Brightness") #ce ;~ _MagnifierFullScreenSetColorEffect($COLOR_EFFECTS_BW_MATRIX) ;~ MsgBox(0, "Black & White Fullscreen", "Black & White Fullscreen ColorEffects") _MagnifierFullScreenSetColorEffect($COLOR_EFFECTS_SEPIA_TONE_MATRIX) MsgBox(0, "Sepia FullScreen", "Sepia Fullscreen ColorEffects") _MagnifierFullScreenClearColorEffects() MsgBox(0, "Color Restored", "Restored Normal Colors") EndIf ; IMPORTANT - Magnification GUI will fail to work properly sometimes if run in x86 mode on a 64bit O/S ; For this reason, ALWAYS run the Magnification code in the SAME bit-mode as the O/S (x86 in 32-bit O/S's, x64 in 64-bit O/S's) ;~ ConsoleWrite("Title = " & WinGetTitle("[CLASS:SciTEWindow]") & @CRLF) _MagnificationExperiments(@DesktopWidth, @DesktopHeight / 2, 0, @DesktopHeight / 2, 2.0) EndFunc #EndRegion MAIN_CODE #EndRegion MAGNIFIER_EXPERIMENTS #Region MISC_FUNCTIONS ; ============================================================================= ; Func _IsScriptCompiledToExe() ; ; Returns True if the Script has been compiled to an Executable. ; Returns False for .AU3 and .A3X-compiled scripts, as well as scripts run from a different executable ; (CompiledScript.exe /AutoIt3ExecuteScript AnotherScript.exe) ; ; The common method for checking @Compiled is error-prone especially when a script is compiled to .A3X ; To deal with this annoying oversight by the devs (who could easily make @Compiled return -1 for A3X), ; this function checks the path to executable against the script path to make sure they are 1 and the same ; ; While this doesn't detect scripts run from another executable, the situation is basically the same ; - the script still does not have access to the original executable file's resources ; ; Author: Ascend4nt ; ============================================================================= Func _IsScriptCompiledToExe() Return (@Compiled And @AutoItExe = @ScriptFullPath) EndFunc #EndRegion MISC_FUNCTIONS _ Screen Inverter: Toggle full-screen Color Inversion on and off via the Tray: ; =========================================================================================================== ; <MagnifierScreenInverter.au3> ; ; Simple Full-Screen Color Inversion example. Toggle Color Inversion on/off via Tray. ; Important: Requires Win 7+ ; ; Note: May work cleaner if run in same bitness (32/64) as O/S.. it seems some transitions in DWM ; cause the Magnifier tool (magnifier.exe) to crash if used in conjunction with this script. ; ; Uses <WinMagnifier.au3> ; ; Author: Ascend4nt ; =========================================================================================================== ;~ #AutoIt3Wrapper_UseX64=Y ; Optional, may work better if in same bitness as O/S #include "WinMagnifier.au3" #include <WinAPIGdi.au3> ; _WinAPI_DwmIsCompositionEnabled() Global $g_bDwmActive = False Global $g_bInvertOn = False, $g_cTrayInvertToggle = 0 #Region MAIN_CODE Exit _WinMain() Func _WinMain() ; Singleton code: If WinExists("0bc53fe0-59c2-11e2-bcfd-0800200c_9a66") Then Return 1111 AutoItWinSetTitle("0bc53fe0-59c2-11e2-bcfd-0800200c_9a66") ; Vista Minimum for Magnifier, but Full-Screen FX requires Win7+ If Not _MagnifierInit() Or $g_nWinMagnifyAPILevel <= 1 Then Return @error Opt("TrayOnEventMode", 1) Opt("TrayMenuMode", 1+2) Opt("GUIOnEventMode", 1) If Not _WinAPI_DwmIsCompositionEnabled() Then If MsgBox(32 + 3, "Warning: DWM is OFF", _ "Desktop Composition is OFF, which makes Color Inversion Impossible" & @CRLF & _ "unless Re-Enabled!" & @CRLF & _ "Would you like to run this program anyway? ") <> 6 Then Return 2222 EndIf TraySetClick(8) $g_cTrayInvertToggle = TrayCreateItem("Invert Colors Toggle") TrayItemSetOnEvent(-1, "_ToggleInvertColors") TrayCreateItem("") TrayCreateItem("Exit") TrayItemSetOnEvent(-1, "_Exit") ; Automatically Invert on Left-Click Icon TraySetOnEvent(-7, "_ToggleInvertColors") ; $TRAY_EVENT_PRIMARYDOWN -7 TraySetToolTip("Screen Color Inverter (Left-Click Toggles, Right-Click For Menu)") #cs ; OPTIONAL: ; Create a Dummy GUI so we can receive and react to WM_DWMCOMPOSITIONCHANGED Messages Local $hDummyGUI = GUICreate("") GUIRegisterMsg(0x031E, "_DwmCompositionChange") ; WM_DWMCOMPOSITIONCHANGED 0x031E #ce ; Not necessary, but can free some memory by flushing data to disk DllCall("psapi.dll", "bool", "EmptyWorkingSet", "handle", -1) While 1 Sleep(50) WEnd EndFunc #EndRegion MAIN_CODE #Region TRAY_ONEVENT_FUNCS Func _ToggleInvertColors() If $g_bInvertOn Then TrayItemSetState($g_cTrayInvertToggle, 4) _MagnifierFullScreenClearColorEffects() ;~ ConsoleWrite("Inversion: OFF"&@LF) $g_bInvertOn = False Else ; Magnifier Full-screen Effects Require DWM Composition to be enabled If _WinAPI_DwmIsCompositionEnabled() Then TrayItemSetState($g_cTrayInvertToggle, 1) _MagnifierFullScreenSetColorEffect($COLOR_EFFECTS_INVERSION_MATRIX) ;~ ConsoleWrite("Inversion: ON"&@LF) $g_bInvertOn = True EndIf EndIf EndFunc #cs ; OPTIONAL: Func _DwmCompositionChange($hWnd, $nMsg, $wParam, $lParam) ConsoleWrite("DwmCompositionChanged!"&@LF) If _WinAPI_DwmIsCompositionEnabled() Then $g_bDwmActive = True If $g_bInvertOn Then ; Doesn't appear to be necessary (state is recovered): ;_MagnifierFullScreenSetColorEffect($COLOR_EFFECTS_INVERSION_MATRIX) EndIf Else $g_bDwmActive = False EndIf Return 0 EndFunc #ce Func _Exit() _MagnifierUnInit() Exit EndFunc #EndRegion TRAY_ONEVENT_FUNCS WinMagnifier.zip ~prev downloads: 48
    2 points
  40. @Frescard Will do. Here my latest version of it. Smaller - better. #RequireAdmin #include <Misc.au3> #include <WinAPIProc.au3> #include <ProcessConstants.au3> Global Enum $NT_SUSPEND, $NT_RESUME NtProcess("notepad.exe", $NT_SUSPEND) While Not _IsPressed("20") ; space WEnd NtProcess("notepad.exe", $NT_RESUME) Func NtProcess($sProcess, $iFlag) Local $iPID = ProcessExists($sProcess) If Not $iPID Then Return SetError(1, 0, 0) Local $hProcess = _WinAPI_OpenProcess($PROCESS_ALL_ACCESS, False, $iPID, True) Local $iRet = DllCall("ntdll.dll", "int", $iFlag = $NT_SUSPEND ? "NtSuspendProcess" : "NtResumeProcess", "int", $hProcess)[0] _WinAPI_CloseHandle($hProcess) If $iRet Then SetError(2, $iRet, 0) Return 1 EndFunc ;==>NtProcess
    1 point
  41. How is this different from the above? #include <Array.au3> #include <File.au3> #include <FileConstants.au3> #include <MsgBoxConstants.au3> Example() Func Example() Local $sTextFolder = "I:\Live_Rig\Scripts\Development\_FileMove\HelpFile\Data\FileListing.txt" ; Read the text file Local $sTextFileToRead = FileReadToArray($sTextFolder) ;~ ConsoleWrite("Contents of Text file..." & @CRLF) Local $sNewName = $sTextFileToRead ;~ For $i = 0 To UBound($sNewName) - 1 ;~ ConsoleWrite($sNewName[$i] & @CRLF) ;~ Next Local $sDataFolder = "I:\Live_Rig\Scripts\Development\_FileMove\HelpFile\Data\" ; Read the folder contents Local $aFileList = _FileListToArray($sDataFolder, "*.wma") Local $sOldName = $aFileList ;~ ConsoleWrite("Contents of Data folder..." & @CRLF) ;~ For $i = 1 To $sOldName[0] ;~ ConsoleWrite($sOldName[$i] & @CRLF) ;~ Next ; Update the folder data For $i = 1 To UBound($sNewName) - 1 ;~ ConsoleWrite($sNewName[$i] & @CRLF) ;~ ConsoleWrite($sOldName[$i + 1] & @CRLF) ;~ FileMove($sOldName[$i], $sNewName[$i], $FC_OVERWRITE) ConsoleWrite("FileMove:" & $sDataFolder & $sOldName[$i + 1] & ", " & $sDataFolder & $sNewName[$i] & ".wma" & @CRLF) Next EndFunc ;==>Example
    1 point
  42. Here I changed the approach with two rectangles and a circle for each corner 212533-input-control-with-label-and-rounded-corners/
    1 point
  43. ioa747

    HotKeySet Issues

    I turned them to match. Func _EnableHotKey() Local Static $hbHotKeyEnabled = True ConsoleWrite("$hbHotKeyEnabled=" & $hbHotKeyEnabled & @CRLF) If $hbHotKeyEnabled = True Then ; To enable hotkeys HotKeySet("{APPSKEY}", "_AccessMenuOption") GUICtrlSetData($_sCol2Row1, "Disable HotKey") GUICtrlSetTip($_sCol2Row1, "HotKey is now enabled!") $hbHotKeyEnabled = False ToolTip("Select [APPSKEY] to add SoundFile!", 84, 17, "HotKey Enabled", 1, $TIP_BALLOON) Else ; To disable hotkeys HotKeySet("{APPSKEY}") GUICtrlSetData($_sCol2Row1, "Enable HotKey") GUICtrlSetTip($_sCol2Row1, "HotKey is now disabled!") $hbHotKeyEnabled = True ToolTip("Select [Enable HotKey] to enable.", 84, 17, "HotKey Disabled", 1, $TIP_BALLOON) EndIf ; Provide time to dispay ToolTip Sleep(2000) ToolTip("") EndFunc ;==>_EnableHotKey ; -----------------------------------------------
    1 point
  44. ...food for thought. The idea was to showcase the function clearly. That's there. How to implement it, is up to the coder given the many ways that could be used based on a given project. The examples are there. The coder would decide how to implement it I guess. 🤷‍♂️
    1 point
  45. you can make a Signature Defaults Create a Gmail signature settings/general
    1 point
  46. ioa747

    StringRegExp Assistance

    ; ----------------------------------------------- #include <MsgBoxConstants.au3> ; ----------------------------------------------- Opt("MustDeclareVars", 1) ; ----------------------------------------------- _BrowseForFolder() ; ----------------------------------------------- Func _BrowseForFolder() While 1 Local $SetName = FileSelectFolder("Please select a valid Type_#\Set_Name folder...", "F:\Audio") ; ----------------------------------------------- Local $_aType = StringSplit($SetName, "\") If $_aType[0] = 4 Then ConsoleWrite("[0]=" & $_aType[0] & @CRLF) ConsoleWrite("[1]=" & $_aType[1] & @CRLF) ConsoleWrite("[2]=" & $_aType[2] & @CRLF) ConsoleWrite("[3]=" & $_aType[3] & @CRLF) ConsoleWrite("[4]=" & $_aType[4] & @CRLF) If $_aType[2] = "Audio" And StringRegExp($_aType[3], "Type_[1-4]") Then Local $_sTypeFolder = $_aType[1] & "\" & $_aType[2] & "\" & $_aType[3] & "\" & $_aType[4] _MoveSourceAudioData($_sTypeFolder) ExitLoop EndIf EndIf ; ----------------------------------------------- MsgBox($MB_TOPMOST, "Notice!", "Invalid [F:\Audio\Type_#\Set_Name] folder selected...") WEnd EndFunc ;==>_BrowseForFolder ; ----------------------------------------------- Func _MoveSourceAudioData($sFolderPath) ConsoleWrite("Inside of _MoveSourceAudioData...with: " & $sFolderPath & "\wav" & @CRLF) EndFunc ;==>_MoveSourceAudioData ; -----------------------------------------------
    1 point
  47. ioa747

    Snowfall

    Thanks for sharing. Impressed by the simplicity. I played around with it a bit and came up with this variation. snowflake: flake2.ico
    1 point
  48. LAST VERSION - 1.1 18-May-12 Control Viewer (CV) is a replacement of AutoIt Window Info with a number of advantages. I tried to stick to the interface of the last, so you almost do not have to be retrained. During testing, I never managed to find any controls that could not be identified by CV (on the contrary, shows a lot of hidden controls, especially for the system windows). The all program settings are stored in the following registry key: HKEY_CURRENT_USERSoftwareY'sControl Viewer The main differences CV from AWI Shows the complete list of all existing controls for the window that are interested (visible, hidden and deleted controls are displayed with different colors that can be changed to any other).Dynamically changing information during search for the windows and their controls.Ability to quickly switch between controls in the list.Ability to show/hide any controls from the list (useful for the overlaping controls).Information for the Style and ExStyle parameters shown in the form of hexadecimal values​​, and as its flags.Added the PID and Path parameters in the Window tab and ability to quickly open a folder that containing the process file.Added the coordinate system relative to the selected control.Shows a color of the selected pixel in RGB and BGR formats.Shows an example fill of the selected color.Ability to select the text encoding (affects the Text parameter in the Control tab).The complete change the appearance of pop-up frame for the selected controls.Simple and convenient tool to get a screenshot of the part screen of interest for publication on the forum (Capture tab).Create a report in the clipboard or a text file for subsequent publication on the forum.Search all running AutoIt scripts and their windows in the system (AutoIt tab).User-friendly interface. Used shortcuts Ctrl+Alt+T - Enable/Disable "Always On Top" mode (also available from the menu). Ctrl+Alt+H - Enable/Disable highlight selected controls (also available from the menu). Ctrl+A - Select all text (works in any input field). Ctrl - Hold down when moving the mouse to scroll the screenshot (Capture tab). Shift - Hold down when stretching/compression of the contour frame for an equilateral resizing screenshots (Capture tab). DoubleClick (on the screenshot) - Save the image to a file (Capture tab). DoubleClick (on any list item) - Open a folder with the file of the process or AutoIt script (AutoIt tab). Del (on any list item) - Close process (AutoIt tab). F5 - Updating the list (AutoIt tab). If anyone have any questions or comments about CV, please post it in this thread. I will be glad to any feedback and suggestions. Files to download Binary (x86 and x64) Redirection to CV_bin.zip, 1.14 MB CV_bin.html Source Redirection to CV_source.zip, 691 KB CV_source.html
    1 point
  49. Nah ...that needs to be removed again ... needed that for some debugging. Updated Beta. Thanks
    1 point
  50. Nhardel

    ListUserSessions

    @argumentum So I will be the first to admit I don't understand dll structure and converting back to readable data. I have been toying with your listusersessions array trying to understand it and get it to pull the data I want. But I need two additional columns of info. WTSLogonTime & WTSIdleTime. Here are the changes I have made to your base code but I don't think I am converting things correctly. If you could help me understand what I am doing wrong and where I can find the different structures for each property. I believe I want to create an array that list all the properties for all sessions. I made no changes to the function _WTSQuerySessionInformation Func ListUserSessions() ; mod. of https://www.autoitscript.com/forum/topic/139774-dllcall-and-returned-pointers/?do=findComment&comment=980850 Local $_Self_SessionId = _WTSQuerySessionInformation(-1, 4) ; -1 = current user ; 4 = WTSSessionId Local Enum $e_IsSelf_SessionId, $e_SessionName, $e_UserName, $e_SessionId, $e_StateName, $e_StateInt, $e_ClientName, $e_ClientIp, $e_Domain, $e_IdleTime, $e_LogonTime, $e_UBound Local Const $tagWTS_SESSION_INFO = 'dword SessionId;ptr WinStationName;uint State' Local $aResult = DllCall('wtsapi32.dll', 'int', 'WTSEnumerateSessionsW', 'ptr', 0, 'dword', 0, 'dword', 1, 'ptr*', 0, 'dword*', 0) If @error Or $aResult[0] = 0 Then Return SetError(1, 0, "") ; https://docs.microsoft.com/en-us/windows/desktop/api/wtsapi32/ne-wtsapi32-_wts_connectstate_class Local $aConnectionState = StringSplit("Active,Connected,ConnectQuery,Shadow,Disconnected,Idle,Listen,Reset,Down,Init", ",", 2) Local $tInfo, $Offset = 0, $c = 0, $aReturn[$aResult[5] + 1][$e_UBound] ; $e_UBound is the last enumerator, just to determine the size of the array $aReturn[0][$e_SessionId] = "ID" $aReturn[0][$e_SessionName] = "SessionName" $aReturn[0][$e_StateInt] = "StateInt" $aReturn[0][$e_StateName] = "State" $aReturn[0][$e_UserName] = "UserName" $aReturn[0][$e_ClientName] = "ClientName" $aReturn[0][$e_ClientIp] = "ClientIp" $aReturn[0][$e_Domain] = "Domain" $aReturn[0][$e_IdleTime] = "IdleTime" $aReturn[0][$e_LogonTime] = "LogonTime" For $i = 1 To $aResult[5] $tInfo = DllStructCreate($tagWTS_SESSION_INFO, $aResult[4] + $Offset) $Offset += DllStructGetSize($tInfo) $c += 1 $aReturn[$c][$e_SessionId] = DllStructGetData($tInfo, 'SessionId') $aReturn[$c][$e_SessionName] = DllStructGetData(DllStructCreate('wchar[1024]', DllStructGetData($tInfo, 'WinStationName')), 1) $aReturn[$c][$e_StateInt] = DllStructGetData($tInfo, 'State') If UBound($aConnectionState) > $aReturn[$c][$e_StateInt] Then $aReturn[$c][$e_StateName] = $aConnectionState[$aReturn[$c][$e_StateInt]] $aReturn[$c][$e_UserName] = _WTSQuerySessionInformation($aReturn[$c][$e_SessionId], 5) ; WTSUserName $aReturn[$c][$e_ClientName] = _WTSQuerySessionInformation($aReturn[$c][$e_SessionId], 10) ; WTSClientName $aReturn[$c][$e_ClientIp] = _WTSQuerySessionInformation($aReturn[$c][$e_SessionId], 14) ; WTSClientAddress $aReturn[$c][$e_Domain] = _WTSQuerySessionInformation($aReturn[$c][$e_SessionId], 7) ; WTSDomainName $aReturn[$c][$e_IdleTime] = _WTSQuerySessionInformation($aReturn[$c][$e_SessionId], 17) ; WTSIdleTime $aReturn[$c][$e_LogonTime] = _WTSQuerySessionInformation($aReturn[$c][$e_SessionId], 18) ; WTSLogonTime $aReturn[0][$e_IsSelf_SessionId] = $c If $_Self_SessionId = $aReturn[$c][$e_SessionId] Then $aReturn[$c][$e_IsSelf_SessionId] = 1 Else $aReturn[$c][$e_IsSelf_SessionId] = 0 EndIf Next DllCall('wtsapi32.dll', 'none', 'WTSFreeMemory', 'ptr', $aResult[4]) Return $aReturn EndFunc ;==>ListUserSessions
    1 point
×
×
  • Create New...