Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 03/09/2022 in all areas

  1. That seems to work : #include <GDIPlus.au3> #include <GUIConstants.au3> #include <WinAPISys.au3> #include <WinAPIConstants.au3> #include <WinAPIProc.au3> Global Const $tagMSLLHOOKSTRUCT = $tagPOINT & ";dword mouseData;dword flags;dword time;ulong_ptr dwExtraInfo" Global Const $TIMER_NUMBER = 5, $DOUBLE_CLICK_DELAY = 150 ; <<<<<<< ADJUST IF NEEDED Global $aTimer[$TIMER_NUMBER][3], $iTimer = 0 Global $hMSHook, $hMSProc $hMSProc = DllCallbackRegister(_MouseProc, "long", "int;wparam;lparam") $hMSHook = _WinAPI_SetWindowsHookEx($WH_MOUSE_LL, DllCallbackGetPtr($hMSProc), _WinAPI_GetModuleHandle(0)) _GDIPlus_Startup() OnAutoItExitRegister(_Cleanup) While True Sleep(50) WEnd Func ShowCircle($iColor) Local Const $iWidth = 100, $iHeight = 100, $iBgColor = 0xFFFF00 Local $hGUI = GUICreate("", $iWidth, $iHeight, MouseGetPos(0) - $iWidth / 2, MouseGetPos(1) - $iHeight / 2, $WS_POPUP, _ BitOR($WS_EX_TOPMOST, $WS_EX_LAYERED, $WS_EX_NOACTIVATE)) GUISetBkColor($iBgColor, $hGUI) GUISetState(@SW_SHOWNOACTIVATE) Local $hGraphics = _GDIPlus_GraphicsCreateFromHWND($hGUI) Local $hBmp = _GDIPlus_BitmapCreateFromGraphics(100, 100, $hGraphics) Local $hGfx = _GDIPlus_ImageGetGraphicsContext($hBmp) Local $hBrush = _GDIPlus_BrushCreateSolid($iColor) _GDIPlus_GraphicsFillEllipse($hGfx, 0, 0, 100, 100, $hBrush) _GDIPlus_GraphicsDrawImageRect($hGraphics, $hBmp, 0, 0, 100, 100) Local $hHBitmap = _GDIPlus_BitmapCreateHBITMAPFromBitmap($hBmp) _GDIPlus_BrushDispose($hBrush) _GDIPlus_GraphicsDispose($hGraphics) _GDIPlus_GraphicsDispose($hGfx) _GDIPlus_BitmapDispose($hBmp) StartTimer($hGUI, $hHBitmap) EndFunc ;==>ShowCircle Func UpdateGUI(ByRef $hHBitmap, ByRef $hGUI, $iOpacity) Local $tDim = DllStructCreate($tagBITMAP) _WinAPI_GetObject($hHBitmap, DllStructGetSize($tDim), $tDim) Local $tSize = DllStructCreate($tagSIZE), $tSource = DllStructCreate($tagPOINT), $tBlend = DllStructCreate($tagBLENDFUNCTION) Local $hScrDC = _WinAPI_GetDC($hGUI), $hMemDC = _WinAPI_CreateCompatibleDC($hScrDC), $hOld = _WinAPI_SelectObject($hMemDC, $hHBitmap) $tSize.X = $tDim.bmWidth $tSize.Y = $tDim.bmHeight $tBlend.Alpha = $iOpacity $tBlend.Format = 1 _WinAPI_UpdateLayeredWindow($hGUI, $hScrDC, 0, $tSize, $hMemDC, $tSource, 0, $tBlend, $ULW_ALPHA) _WinAPI_ReleaseDC($hGUI, $hScrDC) _WinAPI_SelectObject($hMemDC, $hOld) ;_WinAPI_DeleteObject($hOld) _WinAPI_DeleteDC($hMemDC) EndFunc ;==>UpdateGUI Func _Cleanup() _GDIPlus_Shutdown() _WinAPI_UnhookWindowsHookEx($hMSHook) DllCallbackFree($hMSProc) EndFunc ;==>_Cleanup Func StartTimer($hWnd, ByRef $hBitmap) $aTimer[$iTimer][0] = $hWnd $aTimer[$iTimer][1] = $hBitmap $aTimer[$iTimer][2] = 0 AdlibRegister("Timer" & $iTimer, 10) $iTimer = Mod($iTimer + 1, $TIMER_NUMBER) EndFunc ;==>StartTimer Func Timer0() Fade(0) EndFunc ;==>Timer0 Func Timer1() Fade(1) EndFunc ;==>Timer1 Func Timer2() Fade(2) EndFunc ;==>Timer2 Func Timer3() Fade(3) EndFunc ;==>Timer3 Func Timer4() Fade(4) EndFunc ;==>Timer4 Func Fade($iTmr) If $aTimer[$iTmr][2] = 15 Then GUIDelete($aTimer[$iTmr][0]) _WinAPI_DeleteObject($aTimer[$iTmr][1]) AdlibUnRegister("Timer" & $iTmr) Return EndIf $aTimer[$iTmr][2] += 1 UpdateGUI($aTimer[$iTmr][1], $aTimer[$iTmr][0], 150 - ($aTimer[$iTmr][2] * 10)) EndFunc ;==>Fade Func _MouseProc($nCode, $wParam, $lParam) If $nCode < 0 Then Return _WinAPI_CallNextHookEx($hMSHook, $nCode, $wParam, $lParam) Switch $wParam Case $WM_LBUTTONUP AdlibRegister(LeftClick, $DOUBLE_CLICK_DELAY) Case $WM_RBUTTONUP AdlibRegister(RightClick, 80) EndSwitch Return _WinAPI_CallNextHookEx($hMSHook, $nCode, $wParam, $lParam) EndFunc ;==>_MouseProc Func LeftClick() AdlibUnRegister(LeftClick) ShowCircle(0xFFE0A0FF) EndFunc ;==>LeftClick Func RightClick() AdlibUnRegister(RightClick) ShowCircle(0xFF10E010) EndFunc ;==>RightClick
    2 points
  2. Jon

    AutoIt (Latest Stable Version)

    Version v3.3.16.1

    50,304 downloads

    This is the current stable version of AutoIt. What's new: Changelog. Main AutoIt download page (for AutoIt and other tools like the script editor).
    1 point
  3. You could probably use a custom inputbox here. Saludos
    1 point
  4. Nine

    Bug with number 3

    Glad you like it.
    1 point
  5. @argumentumCorrections are applied to my previous code. Also corrected a memory leak. Happy testing !
    1 point
  6. 1 point
  7. Nine

    Bug with number 3

    Your two last loops seem to be the one defective : #include <Array.au3> #include <Math.au3> #include <MsgBoxConstants.au3> Global $g_aiOrden = [0, 2, 200, 1, -1, 1, 0, 0, 15, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] Global $eCount = 38 Orden($g_aiOrden) _ArrayDisplay($g_aiOrden) Func Orden(ByRef $aArray) Local $i = 0, $iMax = UBound($aArray) Local $oOrden = ObjCreate("Scripting.Dictionary") If @error Then Logs("Error creating the dictionary object $oOrden") For $i = 0 To $iMax - 1 If ($aArray[$i] < 0 Or $aArray[$i] > $iMax Or StringIsDigit($aArray[$i]) = 0) = True Then $aArray[$i] = -1 EndIf For $i3 = 0 To $iMax - 1 Local $located = -1 $located = _ArrayFindAll($aArray, $i3) If UBound($located) <> 1 And Not @error Then For $i2 = 1 To UBound($located) - 1 $aArray[$located[$i2]] = -1 ; $i = 0 Next EndIf Next Next ; _ArrayDisplay($aArray) For $i = 0 To $iMax - 1 $oOrden.Item($i) = _ArraySearch($aArray, $i) >= 0 Next $IC = -1 For $i = 0 To $iMax - 1 If $aArray[$i] < 0 Then Do $IC += 1 Until Not $oOrden.Item($IC) $aArray[$i] = $IC EndIf Next EndFunc ;==>Orden Func Logs($s, $a = 1) ConsoleWrite($s & @CRLF) EndFunc Notice, I did not try to change your algorithm too much, although I believe it could be optimized : Func Order(ByRef $aArray) Local Const $iMax = UBound($aArray) - 1 Local $iNum = -1 For $i = 0 To $iMax If $aArray[$i] > $iMax Or $aArray[$i] < 0 Or Not StringIsDigit($aArray[$i]) Or _ ($i > 1 And _ArraySearch($aArray, $aArray[$i], 0, $i-1) >= 0) Or ($i = 1 And $aArray[0] = $aArray[1]) Then Do $iNum += 1 Until _ArraySearch($aArray, $iNum) < 0 $aArray[$i] = $iNum EndIf Next EndFunc
    1 point
  8. Jos

    Tidy.exe

    I am regularly wondering why I wrote that Helpfile in the first place. ... but it will adhere to the settings for SciTE made in the properties file. This can be checked/changed via SciTEConfig.
    1 point
  9. Jon

    AutoIt v3.3.15.5 Beta

    Not sure, from my point of view the first 3 should return 0 but for some reason we were very friendly in converting misformatted text to valid numbers. If " 27/7" works then I guess " 0xcade" should.
    1 point
  10. I knew it would be something so obvious 😭 Thanks Subz for pointing out the error
    1 point
  11. Should be “adapted to”
    1 point
  12. Jon

    AutoIt v.3.3.16.0 Released

    AutoIt v3.3.16.0 has been released. Thanks to @jpm and the MVPs who were responsible for the majority of code in this version. Download it here. Complete list of changes: History
    1 point
  13. Here is very useful project. It could help many visually impaired Autoit programmers. jamalmazrui/Layout_by_Code: A function library in the AutoIt programming language for conveniently creating user interface dialogs via textual code rather than graphical tools (github.com)
    1 point
  14. See you want to copy formats, so would use something like: #include <Array.au3> #include <Excel.au3> #include <File.au3> Global $aFileList = _FileListToArrayRec(@DesktopDir & "\Nezavisimai\Papka2", "*.xlsx", 1, 1, 1, 2) If @error Then Exit Global $aExcelData[0][3] Global $oExcel = _Excel_Open() If @error Then Exit Global $oDestinyWorkbook = _Excel_BookNew($oExcel) $oExcel.ActiveSheet.Name = "Лист1" Global $iLastRow = $oDestinyWorkbook.ActiveSheet.UsedRange.Rows.Count Global $oWorkbook, $aRangeRead For $i = 1 To $aFileList[0] $oWorkbook = _Excel_BookOpen($oExcel, $aFileList[$i], True, True) If @error Then ContinueLoop $aCopyPaste = _Excel_RangeCopyPaste($oWorkbook.ActiveSheet, $oWorkbook.ActiveSheet.Usedrange.Columns("A:C"),$oDestinyWorkbook.ActiveSheet.Range("A" & $iLastRow)) $iLastRow = $oDestinyWorkbook.ActiveSheet.UsedRange.Rows.Count + 1 _Excel_BookClose($oWorkbook, False) Next
    1 point
  15. Hi guys today we're prepare new custom checkbox in autoit (modern checkbox) there're used some icon files with type of icons that you want install. If anybody interesting, Full Source code: https://cloud.mail.ru/public/fp2y/35K2983HE (from cloud storage) Screenshot:
    1 point
  16. Have a look at _Excel_RangeCopyPaste in the helpfile. Example 2 explains how to copy cells from one workbook to another.
    1 point
  17. Shouldn't $g_idTrayOption_Main = TrayCreateItem("Open sub-menu") be $g_idTrayOption_Main = TrayCreateMenu("Open sub-menu")
    0 points
×
×
  • Create New...