Leaderboard
Popular Content
Showing content with the highest reputation on 05/09/2020 in all areas
-
I had this GIF animation script, but it was kind of slow when multiple GIFs were displayed. And then Bilgus posted a framework of how to use GDI+ Cached Bitmaps. I transformed my script and was very happy of the result. Hope you like it too. I enclosed the GIF, the UDF and the example into the zip file. ps. Hope KaFu won't mind as I used his avatar in the example Version 2023-08-15 * Added support for SetOnEvent GUI, while deletion of controls happens frequently * Optimized some minor code parts * Solved a possible stack overflow issue Version 2022-12-06 * Added support to transparent GIF over window background. The type of GIF that necessitate erasure between frames. Version 2022-04-07 * Added double buffering for all GIF * Added ability to erase each frame before repainting, thru a new optional parameter. This is required when the frames do not cover the whole area, leaving a trace of the previous frame. * Added support for the usage of the Default keyword for optional parameters Version 2020-12-20 * Changed frame delays from 0 to a minimum delay to prevent CPU overload Version 2020-12-02 * Reuse empty slots left by the deletion of GIF controls * Corrected bugs Version 2020-12-01 * Added support to delete a GIF control Version 2020-11-29 * Corrected bug on unregister adlib function (thanks to PixelSearch) Included in the zip file 2 examples. One with multiple GIF. Second with transparent GIF over a window background. Cached GIF Animation.zip3 points
-
AutoIt v3.3.15.1 Beta View File 3.3.15.1 (10th May, 2020) (Beta) AutoIt: - Changed: PCRE regular expression engine updated to 8.41. - Added #3741: GUISetStyle() example to avoid blank title bar. - Fixed #2806: GUICtrlCreateIcon() doc when filename="". - Fixed #3580: FileSetAttrib() crashing on root folders. - Fixed #3636: Applied the SS_NOPREFIX style to the SplashTextOn dialog to treat an ampersand in the 'text' parameter character in stead of a hotkey mnemonic prefix indicator. - Fixed #3689: GUICtrlSetOnEvent ( controlID, "" ) wasn't disabling the previous set UDF and returned error=1. - Fixed #3707: GUISetOnEvent($GUI_EVENT_CLOSE, "") wasn't disabling the previous set UDF and returned error=1. - Fixed: GUIOnEventMode and TrayOnEventMode options had unnecessary slow downs. - Fixed: Workarounds added to alleviate slow downs on Windows 10 1809 and later (OS bug/design change). AutoItX: - Changed: AutoItX .NET assembly updated to .NET 4.0 / CLR 4. - Changed: AutoIt PowerShell CmdLets updated to .NET 4.0 / CLR 4. - Changed: Updated C++ example. - Fixed #3642: ControlTreeView example. Au3Check: - Fixed #2822: object('item')('item') syntax support. - Fixed #3560: parentheses around function reference. UDFs: - Changed: slight improvement when _DebugReport() display "error code:" different from 0. - Changed: _WinAPI_Reg*() doc and examples. - Changed: _SQLite 3.22.0.0 -> 3.28.0.0. - Added: Extras\AutoUpdateIt\AutoSQLiteUpdateIt.au3 script to download sqlite dll's used by _SQLite_Startup(). - Added #3149: _SQLite_GetTableData2D() simplified version of _SQLite_GetTable2d() returning just data. - Added: RegWrite() doc and example about #requireAdmin. - Added: $ARRAYDISPLAY_ROWPREFIX to change the prefix of the row numbering in _ArrayDisplay(). - Added: _Assert() use if needed _DebugReport(). - Added #3027: _WinAPI_RegEnumKey() return the lastWriteTime of the subkey in @extended. - Added: _WinAPI_RegCreateKey() and _WinAPI_RegOpenkey() can use $hKey as in RegRead(). - Added: _WinAPI_RegDeleteKey() new parameter $iSamDesired. - Added: $ARRAYDISPLAY_CHECKERROR for _ArrayDisplay() avoid display after _Array*() errors. - Added: _DebugArrayDisplay() write a _DebugReport() if @error set when called. - Added: _WinAPI_ShellQueryRecycleBin() example. - Added: $REG_ERROR_MORE_DATA for _WinAPI_RegQueryValue(). - Added: _DebugReportVar() support Array 3D. - Added: _GUICtrl*() using GUICtrlInternals.au3 (Internal maintenability). - Added #3753: _GUICtrlListView_SetImageList sanity check on $iType parameter. - Fixed #3605: _GUICtrlListView_SetBkImage() does not accept control ID. - Fixed: _GUICtrlEdit_GetCueBanner() and _GUICtrlEdit_ShowBalloonTip() using Unicode string. - Fixed: Use _WinAPI_GetString() instead of _WinAPI_WideCharToMultiByte() to handle Unicode. - Fixed #3618: $tagNMLVKEYDOWN, $tagNMTVKEYDOWN, $tagNMTCKEYDOWN structure alignment. - Fixed #3619: _WinAPI_LocalFree() doc. - Fixed #3243: _WinAPI_MoveFileEx() if $sNewFile = 0 and $MOVE_FILE_DELAY_UNTIL_REBOOT - Fixed #3264: _INetSmtpMail() bad $sFirst default value. - Fixed #3265: _INetSmtpMail() bad Bias calculation. - Fixed: _WinAPI_GetErrorMessage(), _WinAPI_GetLastErrorMessage() returning @error. - Fixed: _WinAPI_GUIDFromStringEx() return on error. - Fixed: _WinAPI_EnumProcessHandles() seting @extended if too many Handles. - Fixed #3626: _WinAPI_GetSaveFileName() example. - Fixed: _WinAPI_RegQueryValue() wrong return on success and does not return error $ERROR_MORE_DATA - Fixed #3628: _WinAPI_GetCaretPos() bad return. - Fixed #3632: _Net_Share_ShareCheck() 2nd parameter is a $sResourcePath. - Fixed: _ArrayInsert() range element comparison datatype mismatch. - Fixed #3637: _ArrayDisplay() error when Array is empty and Range parameter exists. - Fixed #3657: _GUICtrlListView_SimpleSort selected item when no selection. - Fixed #3687: Corrected HSL constant values for RGB-HSL-RGB conversion. - Fixed #3699: _ArrayMin, _ArrayxMinIndex, _ArrayMax and _ArrayMinIndex examples - Fixed #3708: _WinAPI_LoadCursor() and _WinAPI_GetIconInfo() must use $OCR_* instead of $IDC_* that are used in AutoIt Mouse builtin. - Fixed #3711: _WinAPI_EnumWindows() and _WinAPI_EnumWindowsPopup() examples. - Fixed #3713: missing $ENM_NONE definition. - Fixed #3716: _ArrayToClip() example. - Fixed #3714: _GUICtrlTreeView_Sort() crash with 1 element TreeView. - Fixed #2962: GUICtrlSetImage() on GUICtrlCreatePIC() with $SS_SUNKEN or WS_EX_DLGMODALFRAME - Fixed #3744: _Crypt_DestroyKey() does not return error on wrong key. - Fixed: $LANG_FRENCH value in _WinAPILangConstants.au3. - Fixed #3733: _FileListToArrayRec() sometimes hanging when ".." filename was returned causing an endless recursion. - Fixed #3737: _ArrayUnique() failed with a single element array when using $iBase parameter. - Fixed #3755: _ArrayInsert/Delete $vRange delimited string failing. - Fixed: _GUICtrlTreeview_*() running in X64 mode. Submitter Jon Submitted 05/09/2020 Category Beta3 points
-
Script becomes way slower after a msgbox - (Moved)
Professor_Bernd and 2 others reacted to Jon for a topic
Public beta uploaded.3 points -
I was inspired by a CSS example to create a procedural graphic without any shader or ray tracing technique. Here the result using GDI+ only: Blue Orb.au3 ;Inspired from https://codepen.io/bradleytaunt/details/VwvzKyb ;Coded by UEZ build 2020-05-07 #include <GDIPlus.au3> #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> If @OSBuild < 7600 Then Exit MsgBox(BitOR($MB_TOPMOST, $MB_ICONERROR), "ERROR", "This demo requires GDIPlus v1.1", 10) _GDIPlus_Startup() Global Const $iW = 1200, $iH = 700, $iSize_globe = 450 Global Const $hGUI = GUICreate("GDI+ Procedural Gfx / Blue Orb v1.20 by UEZ", $iW, $iH, -1, -1, $WS_POPUP, $WS_EX_TOPMOST) Global Const $hCanvas = _GDIPlus_GraphicsCreateFromHWND($hGUI) Global Const $hImage = _GDIPlus_BitmapCreateFromScan0($iW, $iH) Global Const $hGfx = _GDIPlus_ImageGetGraphicsContext($hImage) _GDIPlus_GraphicsSetSmoothingMode($hGfx, $GDIP_SMOOTHINGMODE_ANTIALIAS8X8) ;~ _GDIPlus_GraphicsSetCompositingQuality($hGfx, $GDIP_COMPOSITINGQUALITYHIGHQUALITY) _GDIPlus_GraphicsSetInterpolationMode($hGfx, $GDIP_INTERPOLATIONMODE_HIGHQUALITYBICUBIC) _GDIPlus_GraphicsSetPixelOffsetMode($hGfx, $GDIP_PIXELOFFSETMODE_HALF) ;draw background Global Const $hBrush_bg = _GDIPlus_LineBrushCreate($iW / 2, 0, $iW / 2, $iH / 2, 0xFF1E88E5, 0xFF1565C0, 2) _GDIPlus_LineBrushSetSigmaBlend ($hBrush_bg, 0.95, 1) ;create blurry edge _GDIPlus_GraphicsFillRect($hGfx, 0, 0, $iW, $iH, $hBrush_bg) ;draw blurred text Global Const $hImage_text = _GDIPlus_BitmapCreateFromScan0($iW, $iH / 2) Global Const $hGfx_text = _GDIPlus_ImageGetGraphicsContext($hImage_text) Global Const $hPath_text = _GDIPlus_PathCreate() Global Const $hFamily = _GDIPlus_FontFamilyCreate("Impact") Global Const $hStringFormat = _GDIPlus_StringFormatCreate() Global Const $hBrush_txt = _GDIPlus_LineBrushCreate($iW / 2, 0, $iW / 2, $iH / 2, 0xE0FFFFFF, 0xA01A237E) ;_GDIPlus_BrushCreateSolid(0xF02E86FB) _GDIPlus_LineBrushSetSigmaBlend($hBrush_txt, 0.66, 1) Global Const $hPen_txt = _GDIPlus_PenCreate(0x801A237E, 1) _GDIPlus_StringFormatSetAlign($hStringFormat, 1) _GDIPlus_StringFormatSetLineAlign($hStringFormat, 1) _GDIPlus_GraphicsSetSmoothingMode($hGfx_text, $GDIP_SMOOTHINGMODE_ANTIALIAS8X8) _GDIPlus_GraphicsSetTextRenderingHint($hGfx_text, $GDIP_TextRenderingHintAntialias) _GDIPlus_GraphicsSetPixelOffsetMode($hGfx_text, $GDIP_PIXELOFFSETMODE_HALF) _GDIPlus_GraphicsSetCompositingQuality($hGfx_text, $GDIP_COMPOSITINGQUALITYHIGHQUALITY) Global $tLayout = _GDIPlus_RectFCreate() $tLayout.width = $iW $tLayout.height = $iH / 2 $tLayout.y = -$iH * 0.05 _GDIPlus_PathAddString($hPath_text, "AutoIt rulez!", $tLayout, $hFamily, 0, $iW / 8, $hStringFormat) _GDIPlus_GraphicsFillPath($hGfx_text, $hPath_text, $hBrush_txt) _GDIPlus_GraphicsDrawPath($hGfx_text, $hPath_text, $hPen_txt) Global Const $hEffect_blur_text = _GDIPlus_EffectCreateBlur(20) _GDIPlus_BitmapApplyEffect($hImage_text, $hEffect_blur_text) _GDIPlus_GraphicsDrawImageRect($hGfx, $hImage_text, 0, 0, $iW, $iH / 2) ;draw shadow of the text Global Const $hBrush_txt_shadow = _GDIPlus_BrushCreateSolid(0x40000000) _GDIPlus_GraphicsClear($hGfx_text, 0) _GDIPlus_PathReset($hPath_text) $tLayout.width = $iW $tLayout.height = $iH / 2 $tLayout.y = 0 _GDIPlus_PathAddString($hPath_text, "AutoIt rulez!", $tLayout, $hFamily, 0, $iW / 8, $hStringFormat) _GDIPlus_GraphicsFillPath($hGfx_text, $hPath_text, $hBrush_txt_shadow) Global Const $hEffect_blur_text_shadow = _GDIPlus_EffectCreateBlur(60) _GDIPlus_BitmapApplyEffect($hImage_text, $hEffect_blur_text_shadow) _GDIPlus_GraphicsDrawImageRect($hGfx, $hImage_text, 0, $iH * 0.55, $iW, $iH / 8) ;draw shadow Global Const $iW_shadow1 = $iSize_globe * 0.85, $iH_shadow1 = $iSize_globe * 0.1, $iW_shadow2 = $iSize_globe * 0.60, _ $iW_shadow_Img = $iW_shadow1 * 2, $iH_shadowImg = $iH_shadow1 * 4 Global Const $hImage_shadow = _GDIPlus_BitmapCreateFromScan0($iW_shadow_Img, $iH_shadowImg) Global Const $hGfx_shadow = _GDIPlus_ImageGetGraphicsContext($hImage_shadow) _GDIPlus_GraphicsSetSmoothingMode($hGfx_shadow, $GDIP_SMOOTHINGMODE_ANTIALIAS8X8) Global Const $hBrush_shadow = _GDIPlus_BrushCreateSolid(0x66000000) _GDIPlus_GraphicsFillEllipse($hGfx_shadow, ($iW_shadow_Img - $iW_shadow1) / 2, ($iH_shadowImg / 4 + $iH_shadow1), $iW_shadow1, $iH_shadow1, $hBrush_shadow) _GDIPlus_BrushSetSolidColor($hBrush_shadow, 0xB3000000) _GDIPlus_GraphicsFillEllipse($hGfx_shadow, ($iW_shadow_Img - $iW_shadow2) / 2, ($iH_shadowImg / 4 + $iH_shadow1), $iW_shadow2, $iH_shadow1, $hBrush_shadow) Global Const $hEffect_blur_shadow = _GDIPlus_EffectCreateBlur(32) _GDIPlus_BitmapApplyEffect($hImage_shadow, $hEffect_blur_shadow) _GDIPlus_GraphicsDrawImageRect($hGfx, $hImage_shadow, ($iW - $iW_shadow_Img) / 2, $iH / 2 + $iH_shadow1 * 2.20, $iW_shadow_Img, $iH_shadowImg) ;draw globe Global Const $hPath_globe = _GDIPlus_PathCreate() _GDIPlus_PathAddEllipse($hPath_globe, ($iW - $iSize_globe) / 2, ($iH - $iSize_globe) / 2, $iSize_globe, $iSize_globe) Global Const $hLBrush_globe1 = _GDIPlus_LineBrushCreate($iW / 2, ($iH - $iSize_globe) / 2, $iW / 2, ($iH + $iSize_globe) / 2, 0, 0, 1) Global $aInterpolations[5][2] $aInterpolations[0][0] = 4 $aInterpolations[1][0] = 0xFFFFFFFF $aInterpolations[1][1] = 0 $aInterpolations[2][0] = 0xFFEEEEEE $aInterpolations[2][1] = 0.10 $aInterpolations[3][0] = 0xFF2E86FB $aInterpolations[3][1] = 0.50 $aInterpolations[4][0] = 0xFF1A237E $aInterpolations[4][1] = 1.0 _GDIPlus_LineBrushSetPresetBlend($hLBrush_globe1, $aInterpolations) _GDIPlus_GraphicsFillPath($hGfx, $hPath_globe, $hLBrush_globe1) Global Const $iSize_globe2 = $iSize_globe * 0.85, $iSize_globe2_Img = $iSize_globe2 * 1.5 Global Const $hImage_globe2 = _GDIPlus_BitmapCreateFromScan0($iSize_globe2_Img, $iSize_globe2_Img) Global Const $hGfx_globe2 = _GDIPlus_ImageGetGraphicsContext($hImage_globe2) Global Const $hBrush_globe2 = _GDIPlus_BrushCreateSolid(0x7F000000) ;draw shadow and blur it Global Const $px = ($iSize_globe2_Img - $iSize_globe2) / 2, $py = ($iSize_globe2_Img - $iSize_globe2) / 2 _GDIPlus_GraphicsFillEllipse($hGfx_globe2, $px, $py + ($iSize_globe - $iSize_globe2) * 0.25, $iSize_globe2, $iSize_globe2, $hBrush_globe2) Global Const $hEffect_blur_shadow2 = _GDIPlus_EffectCreateBlur(15) _GDIPlus_BitmapApplyEffect($hImage_globe2, $hEffect_blur_shadow2) ;draw 2nd smaller globe and blur it, too Global Const $hLBrush_globe2 = _GDIPlus_LineBrushCreate($iW / 2, $py, $iW / 2, $py + $iSize_globe2, 0, 0) Dim $aInterpolations[4][2] $aInterpolations[0][0] = 3 $aInterpolations[1][0] = 0xFFFFFFFF $aInterpolations[1][1] = 0 $aInterpolations[2][0] = 0xFF2E86FB $aInterpolations[2][1] = 0.60 $aInterpolations[3][0] = 0xFF283593 $aInterpolations[3][1] = 1.0 _GDIPlus_LineBrushSetPresetBlend($hLBrush_globe2, $aInterpolations) _GDIPlus_GraphicsFillEllipse($hGfx_globe2, $px, $py, $iSize_globe2, $iSize_globe2, $hLBrush_globe2) Global Const $hImage_globe2_blur = _Blur($hImage_globe2, $iSize_globe, $iSize_globe) ;windows gdi+ blur doesn't work properly _GDIPlus_GraphicsDrawImageRect($hGfx, $hImage_globe2_blur, ($iW - $iSize_globe2_Img) / 2 - ($iSize_globe - $iSize_globe2) / 8, ($iH - $iSize_globe2_Img) / 2, $iSize_globe2_Img, $iSize_globe2_Img) GUISetState() _GDIPlus_GraphicsDrawImageRect($hCanvas, $hImage, 0, 0, $iW, $iH) ;~ _GDIPlus_ImageSaveToFile($hImage, @ScriptDir & "\Blue Orb v1.20.png") ;clean-up ressources _GDIPlus_FontFamilyDispose($hFamily) _GDIPlus_StringFormatDispose($hStringFormat) _GDIPlus_EffectDispose($hEffect_blur_text) _GDIPlus_EffectDispose($hEffect_blur_text_shadow) _GDIPlus_EffectDispose($hEffect_blur_shadow) _GDIPlus_EffectDispose($hEffect_blur_shadow2) _GDIPlus_PathDispose($hPath_text) _GDIPlus_PathDispose($hPath_globe) _GDIPlus_PenDispose($hPen_txt) _GDIPlus_BrushDispose($hBrush_txt) _GDIPlus_BrushDispose($hBrush_txt_shadow) _GDIPlus_BrushDispose($hBrush_bg) _GDIPlus_BrushDispose($hLBrush_globe1) _GDIPlus_BrushDispose($hLBrush_globe2) _GDIPlus_BrushDispose($hBrush_globe2) _GDIPlus_ImageDispose($hImage) _GDIPlus_ImageDispose($hImage_text) _GDIPlus_ImageDispose($hImage_shadow) _GDIPlus_ImageDispose($hImage_globe2) _GDIPlus_ImageDispose($hImage_globe2_blur) _GDIPlus_GraphicsDispose($hCanvas) _GDIPlus_GraphicsDispose($hGfx_text) _GDIPlus_GraphicsDispose($hGfx_shadow) _GDIPlus_GraphicsDispose($hGfx_globe2) _GDIPlus_Shutdown() Do Until GUIGetMsg() = $GUI_EVENT_CLOSE GUIDelete($hGUI) Exit Func _Blur($hBitmap, $iW, $iH, $fScale = 0.0525, $dx1 = 0, $dy1 = 0, $dx2 = 0, $dy2 = 0, $qual = 6) ; by eukalyptus Local $hBmpSmall = _GDIPlus_BitmapCreateFromScan0($iW, $iH) Local $hGfxSmall = _GDIPlus_ImageGetGraphicsContext($hBmpSmall) _GDIPlus_GraphicsSetPixelOffsetMode($hGfxSmall, $GDIP_PIXELOFFSETMODE_HALF) Local $hBmpBig = _GDIPlus_BitmapCreateFromScan0($iW, $iH) Local $hGfxBig = _GDIPlus_ImageGetGraphicsContext($hBmpBig) _GDIPlus_GraphicsSetPixelOffsetMode($hGfxBig, $GDIP_PIXELOFFSETMODE_HALF) _GDIPlus_GraphicsScaleTransform($hGfxSmall, $fScale, $fScale) _GDIPlus_GraphicsSetInterpolationMode($hGfxSmall, $qual) _GDIPlus_GraphicsScaleTransform($hGfxBig, 1 / $fScale, 1 / $fScale) _GDIPlus_GraphicsSetInterpolationMode($hGfxBig, $qual) _GDIPlus_GraphicsDrawImageRect($hGfxSmall, $hBitmap, 0, $dx1, $iW, $iH + $dy1) _GDIPlus_GraphicsDrawImageRect($hGfxBig, $hBmpSmall, 0, $dx2, $iW, $iH + $dy2) _GDIPlus_BitmapDispose($hBmpSmall) _GDIPlus_GraphicsDispose($hGfxSmall) _GDIPlus_GraphicsDispose($hGfxBig) Return $hBmpBig EndFunc ;==>_Blur I hope you like it. Feel free to post your examples here, too.2 points
-
Hmmm no. .+ is greedy (will get all chars up to the last quote in the text) while .+? is lazy (will get all chars up to the next quote) (?U) reverses this, I personally never use it because it's confusing (not needed, really...) So this StringRegExp ($mystring, 'origin="(.+?)"', 1) will give you an array which contains 1 match only : myORIGIN , because there is one capturing group only You might also use $myarray = StringRegExp ($mystring, 'origin="([^"]+)', 1) to get "one or more non-quote characters right after the string origin=" Was it clear ?2 points
-
Control Viewer - AutoIt Window Info Tool
mythicalzxc reacted to Yashied for a topic
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.html1 point -
Version 2021.8.30.2
10,235 downloads
Use MouseClick() need: #RequireAdmin Dll is already integrated in UDF ! ; #INDEX# =============================================================== ; Title .........: ImageSearch ; AutoIt Version : 3.x ; Language ......: English ; Description ...: Check image Appears or Not and Return the position of an image on the desktop ; Author(s) .....: Dao Van Trong - TRONG.LIVE ; ======================================================================= ; #CURRENT# ============================================================= ; _ImageSearch ; _ImageSearch_Area ; _ImageSearch_Wait ; _ImageSearch_WaitArea ; ======================================================================== ;========================================================================= ; ; Author:...........: AutoIT VietNam : Dao Van Trong - TRONG.LIVE ; Description:......: Check image Appears or Not ; Find and return the position of an image on the desktop ; Syntax:........... _ImageSearch_Area, _ImageSearch ; Parameter(s):..... $_ImagePath: The image to locate on the desktop ; May be a list of image by delimited by "|" ; i.e: $_ImagePath = "image1.bmp|image2.bmp|image3.bmp" ; $P_x1 $P_y1: Position of 1st point ; $P_x2 $P_y2: Position of 2nd point - Default is last botton right of desktop ; $_Tolerance: 0 for no tolerance (0-255). Needed when colors of image differ from desktop. e.g GIF ; $_CenterPos: boolen. True will return $array[1] x $array[2] is center of image found. ; False will return top-left position ; Return Value(s):.. Return an array has 3 item ; On Success: $array[0] 1 ; On Failure: $array[0] 0 ; DLL not found or other error: $array[0] -1 ; $array[1] x $array[2]: position of image what found on desktop ; ; Note:............. Use _ImageSearch to search the entire desktop ; _ImageSearch_Area to specify a desktop region to search ; $_ImagePath with more item need more time appear on screen before function can detect. ; Decrease sleep time in the loop to detect faster. But less performance. I.e CPULoad increased ; ;======================================================================== EG 1: ;~ Opt("MustDeclareVars", 1) ;~ #AutoIt3Wrapper_UseX64=y ;~ #AutoIt3Wrapper_Change2CUI=y #RequireAdmin #include "_ImageSearch_UDF.au3" HotKeySet("{Esc}", "_Exit") ; Press ESC for exit Func _Exit() Exit 0 EndFunc ;==>_Exit Global Const $Ask_On_Found = 0 Global Const $Mouse_Move_On_Found = 1 Global Const $Mouse_Click_On_Found = 0 Global Const $iSleep_Time=500 Global $sCount = 0, $_Image_1 = @ScriptDir & "\example.bmp" ; First, use this function to create a file bmp, maybe a desktop icon for example') MsgBox(64 + 262144, 'ImageSearch', 'At first, create a file bmp,' & @CRLF & 'photos that will search on the screen!') _ImageSearch_Create_BMP($_Image_1) ConsoleWrite("! Search for images: " & $_Image_1 & @CRLF & '! Searching on the screen ...' & @CRLF) While 1 ToolTip('(Press ESC for EXIT) Searching ...', 1, 1) Sleep($iSleep_Time) $sCount += 1 Local $return = _ImageSearch($_Image_1) If $return[0] = 1 Then ConsoleWrite('- [' & $sCount & '] Image found:' & " X=" & $return[1] & " Y=" & $return[2] & @CRLF) If $Mouse_Move_On_Found Then MouseMove($return[1], $return[2]) Sleep($iSleep_Time) EndIf If $Mouse_Click_On_Found Then MouseClick("left", $return[1], $return[2]) ToolTip('(Press ESC for EXIT) - [' & $sCount & "] Image found:" & " X=" & $return[1] & " Y=" & $return[2], 1, 1) If $Ask_On_Found Then Local $ask = MsgBox(6 + 262144, 'Success [' & $sCount & ']', 'Image found:' & " X=" & $return[1] & " Y=" & $return[2]) If $ask = 2 Or $ask = 3 Or $ask = 5 Or $ask = 7 Then Exit ;No, Abort, Cancel, and Ignore If $ask = 10 Then _ImageSearch_Create_BMP($_Image_1) ; Continue ;Try Again EndIf EndIf Sleep(200) WEnd Video demo: [+] When any problem or error occurs, please make sure that:- Downloaded and used the latest version.- Set screen Screen Scale and layout = 100%- Installed display driver.- Tried turning off the antivirus- Full installation: Microsoft Visual C++ Redistributable 2005->2022 [+] You can download the AIO version of the Visual C++ Redistributable here: -> https://www.mediafire.com/file/0ak8dcj9mdn7nyq/VisualCppRedist_AIO_2005-2022_x86_x64_%5Btrong.live%5D.zip/file -> FOR Windows XP: https://www.mediafire.com/file/5m5lnr1kfg73tc9/VisualCppRedist_AIO_2005-2019_x86_XP_%5Btrong.live%5D.zip/file <!> Password for Extract: trong.live [+] The last full version of SCITE4AutoIT supports windows XP: https://www.autoitscript.com/autoit3/scite/download/archive/v19.1127.1402.0-SciTE4AutoIt3.exe1 point -
[New Release] - 06 April 2019 Added: Error-checking for sensible column numbers in the $aSortData array, with an additional error status. ------------------------------------------------------------------------------------------------------------------------ While answering a recent question about sorting a ListView on several columns, I developed this function to sort a 2D array on several columns and I though I might give it a wider audience. Here is the function: #include-once ;#AutoIt3Wrapper_Au3Check_Parameters=-d -w 1 -w 2 -w 3 -w- 4 -w 5 -w 6 -w- 7 ; #INCLUDES# ========================================================================================================= #include <Array.au3> ; =============================================================================================================================== ; #INDEX# ======================================================================================================================= ; Title .........: ArrayMultiColSort ; AutoIt Version : v3.3.8.1 or higher ; Language ......: English ; Description ...: Sorts 2D arrays on several columns ; Note ..........: ; Author(s) .....: Melba23 ; Remarks .......: ; =============================================================================================================================== ; #CURRENT# ===================================================================================================================== ; _ArrayMultiColSort : Sort 2D arrays on several columns ; =============================================================================================================================== ; #INTERNAL_USE_ONLY#================================================================================================= ; __AMCS_SortChunk : Sorts array section ; =============================================================================================================================== ; #FUNCTION# ==================================================================================================================== ; Name...........: _ArrayMultiColSort ; Description ...: Sort 2D arrays on several columns ; Syntax.........: _ArrayMultiColSort(ByRef $aArray, $aSortData[, $iStart = 0[, $iEnd = 0]]) ; Parameters ....: $aArray - The 2D array to be sorted ; $aSortData - 2D array holding details of the sort format ; Format: [Column to be sorted, Sort order] ; Sort order can be either numeric (0/1 = ascending/descending) or a ordered string of items ; Any elements not matched in string are left unsorted after all sorted elements ; $iStart - Element of array at which sort starts (default = 0) ; $iEnd - Element of array at which sort endd (default = 0 - converted to end of array) ; Requirement(s).: v3.3.8.1 or higher ; Return values .: Success: No error ; Failure: @error set as follows ; @error = 1 with @extended set as follows (all refer to $sIn_Date): ; 1 = Array to be sorted not 2D ; 2 = Sort data array not 2D ; 3 = More data rows in $aSortData than columns in $aArray ; 4 = Start beyond end of array ; 5 = Start beyond End ; @error = 2 with @extended set as follows: ; 1 = Invalid string parameter in $aSortData ; 2 = Invalid sort direction parameter in $aSortData ; 3 = Invalid column index in $aSortData ; Author ........: Melba23 ; Remarks .......: Columns can be sorted in any order ; Example .......; Yes ; =============================================================================================================================== Func _ArrayMultiColSort(ByRef $aArray, $aSortData, $iStart = 0, $iEnd = 0) ; Errorchecking ; 2D array to be sorted If UBound($aArray, 2) = 0 Then Return SetError(1, 1, "") EndIf ; 2D sort data If UBound($aSortData, 2) <> 2 Then Return SetError(1, 2, "") EndIf If UBound($aSortData) > UBound($aArray) Then Return SetError(1, 3) EndIf For $i = 0 To UBound($aSortData) - 1 If $aSortData[$i][0] < 0 Or $aSortData[$i][0] > UBound($aArray, 2) -1 Then Return SetError(2, 3, "") EndIf Next ; Start element If $iStart < 0 Then $iStart = 0 EndIf If $iStart >= UBound($aArray) - 1 Then Return SetError(1, 4, "") EndIf ; End element If $iEnd <= 0 Or $iEnd >= UBound($aArray) - 1 Then $iEnd = UBound($aArray) - 1 EndIf ; Sanity check If $iEnd <= $iStart Then Return SetError(1, 5, "") EndIf Local $iCurrCol, $iChunk_Start, $iMatchCol ; Sort first column __AMCS_SortChunk($aArray, $aSortData, 0, $aSortData[0][0], $iStart, $iEnd) If @error Then Return SetError(2, @extended, "") EndIf ; Now sort within other columns For $iSortData_Row = 1 To UBound($aSortData) - 1 ; Determine column to sort $iCurrCol = $aSortData[$iSortData_Row][0] ; Create arrays to hold data from previous columns Local $aBaseValue[$iSortData_Row] ; Set base values For $i = 0 To $iSortData_Row - 1 $aBaseValue[$i] = $aArray[$iStart][$aSortData[$i][0]] Next ; Set start of this chunk $iChunk_Start = $iStart ; Now work down through array For $iRow = $iStart + 1 To $iEnd ; Match each column For $k = 0 To $iSortData_Row - 1 $iMatchCol = $aSortData[$k][0] ; See if value in each has changed If $aArray[$iRow][$iMatchCol] <> $aBaseValue[$k] Then ; If so and row has advanced If $iChunk_Start < $iRow - 1 Then ; Sort this chunk __AMCS_SortChunk($aArray, $aSortData, $iSortData_Row, $iCurrCol, $iChunk_Start, $iRow - 1) If @error Then Return SetError(2, @extended, "") EndIf EndIf ; Set new base value $aBaseValue[$k] = $aArray[$iRow][$iMatchCol] ; Set new chunk start $iChunk_Start = $iRow EndIf Next Next ; Sort final section If $iChunk_Start < $iRow - 1 Then __AMCS_SortChunk($aArray, $aSortData, $iSortData_Row, $iCurrCol, $iChunk_Start, $iRow - 1) If @error Then Return SetError(2, @extended, "") EndIf EndIf Next EndFunc ;==>_ArrayMultiColSort ; #INTERNAL_USE_ONLY# =========================================================================================================== ; Name...........: __AMCS_SortChunk ; Description ...: Sorts array section ; Author ........: Melba23 ; Remarks .......: ; =============================================================================================================================== Func __AMCS_SortChunk(ByRef $aArray, $aSortData, $iRow, $iColumn, $iChunkStart, $iChunkEnd) Local $aSortOrder ; Set default sort direction Local $iSortDirn = 1 ; Need to prefix elements? If IsString($aSortData[$iRow][1]) Then ; Split elements $aSortOrder = StringSplit($aSortData[$iRow][1], ",") If @error Then Return SetError(1, 1, "") EndIf ; Add prefix to each element For $i = $iChunkStart To $iChunkEnd For $j = 1 To $aSortOrder[0] If $aArray[$i][$iColumn] = $aSortOrder[$j] Then $aArray[$i][$iColumn] = StringFormat("%02i-", $j) & $aArray[$i][$iColumn] ExitLoop EndIf Next ; Deal with anything that does not match If $j > $aSortOrder[0] Then $aArray[$i][$iColumn] = StringFormat("%02i-", $j) & $aArray[$i][$iColumn] EndIf Next Else Switch $aSortData[$iRow][1] Case 0, 1 ; Set required sort direction if no list If $aSortData[$iRow][1] Then $iSortDirn = -1 Else $iSortDirn = 1 EndIf Case Else Return SetError(1, 2, "") EndSwitch EndIf ; Sort the chunk Local $iSubMax = UBound($aArray, 2) - 1 __ArrayQuickSort2D($aArray, $iSortDirn, $iChunkStart, $iChunkEnd, $iColumn, $iSubMax) ; Remove any prefixes If IsString($aSortData[$iRow][1]) Then For $i = $iChunkStart To $iChunkEnd $aArray[$i][$iColumn] = StringTrimLeft($aArray[$i][$iColumn], 3) Next EndIf EndFunc ;==>__AMCS_SortChunk And here is an example to show it working: #include "ArrayMultiColSort.au3" #include <String.au3> ; Only used to fill array ; Create and display array Global $aArray[100][4] For $i = 0 To 99 $aArray[$i][0] = _StringRepeat(Chr(Random(65, 68, 1)), 5) $aArray[$i][1] = _StringRepeat(Chr(Random(74, 77, 1)), 5) $aArray[$i][2] = _StringRepeat(Chr(Random(80, 83, 1)), 5) $aArray[$i][3] = _StringRepeat(Chr(Random(87, 90, 1)), 5) Next _ArrayDisplay($aArray, "Unsorted") ; Copy arrays for separate examples below $aArray_1 = $aArray $aArray_2 = $aArray ; This sorts columns in ascending order - probably the most common requirement ; Sort requirement: ; Col 0 = Decending ; Col 1 = Ascending ; Col 2 = Required order of elements (note not alphabetic PQRS nor reverse SRQP) ; Col 3 = Ascending Global $aSortData[][] = [ _ [0, 1], _ [1, 0], _ [2, "SSSSS,QQQQQ,PPPPP,RRRRR"], _ [3, 0]] ; Sort and display array _ArrayMultiColSort($aArray_1, $aSortData) ; Display any errors encountered If @error Then ConsoleWrite("Oops: " & @error & " - " & @extended & @CRLF) _ArrayDisplay($aArray_1, "Sorted in order 0-1-2-3") ; But the UDF can sort columns in any order ; Sort requirement: ; Col 2 = Decending ; Col 0 = Ascending Global $aSortData[][] = [ _ [2, 1], _ [0, 0]] ; Sort and display array _ArrayMultiColSort($aArray_2, $aSortData) ; Display any errors encountered If @error Then ConsoleWrite("Oops: " & @error & " - " & @extended & @CRLF) _ArrayDisplay($aArray_2, "Sorted in order 2-0") And here are both in zip form: ArrayMultiColSort.zip As usual all comments welcome. M231 point
-
Use AutoIT to open a file in Microsoft TEAMS
seadoggie01 reacted to Nine for a topic
Hmmm, spoon-feeding taste so good !1 point -
If you look in the scite help file, under the AutoItWrapper topic, at the bottom of that topic is a link for a full list of the directives. Look at the AutoItWrapper_Res_... directives. There's one that says it changes the lang code in the app's resource information. ;** Target program Resource info #AutoIt3Wrapper_Res_Comment= ;Comment field #AutoIt3Wrapper_Res_CompanyName= ;Company field #AutoIt3Wrapper_Res_Description= ;Description field #AutoIt3Wrapper_Res_Fileversion= ;File Version #AutoIt3Wrapper_Res_FileVersion_AutoIncrement= ;(Y/N/P) AutoIncrement FileVersion. Default=N #AutoIt3Wrapper_Res_Fileversion_First_Increment=;(Y/N) AutoIncrement Y=Before; N=After compile. Default=N #AutoIt3Wrapper_Res_HiDpi= ;(Y/N) Compile for high DPI. Default=N #AutoIt3Wrapper_Res_ProductName= ;Product Name #AutoIt3Wrapper_Res_ProductVersion= ;Product Version #AutoIt3Wrapper_Res_Language= ;Resource Language code . Default 2057=English (United Kingdom) #AutoIt3Wrapper_Res_LegalCopyright= ;Copyright field #AutoIt3Wrapper_Res_LegalTrademarks= ;Trademark field #AutoIt3Wrapper_res_requestedExecutionLevel= ;asInvoker, highestAvailable, requireAdministrator or None (remove the trsutInfo section). Default is the setting from Aut2Exe (asInvoker) #AutoIt3Wrapper_res_Compatibility= ;Vista/Windows7/win7/win8/win81/win10 allowed separated by a comma (Default=Win10) #AutoIt3Wrapper_Res_Language=1033 ;<== Change to your lang code #AutoIt3Wrapper_Res_Description=Test Application example() Func example() MsgBox(0,"","Test") EndFunc1 point
-
Thank you again. This really helps my understanding! As I said, I've got a lot to learn. (I see that my profile even says I'm a 'Seeker'. It's like it knows me ...) (FWIW, I should have intuited that $GUI_EVENT_CLOSE is not a Windows message. That was kind of dense on my part.) I appreciate your insight. /John1 point
-
As I previously stated, it's a jQuery selector. The ">a" part performs the 2nd step I outlined above. If you wanted child input elements instead of links, then you would change it to ">input". See here for a quick "cheat" sheet. Obviously lots of other good info out there if you search for it. 😉 Here's the complete code to open the dropdown and click one of the available options -- $oIE.document.parentwindow.execScript('jQuery("div.dropdown.period-menu>a").click()') $oIE.document.parentwindow.execScript('jQuery("div.dropdown.period-menu>ul>li>a:contains('2019')").click()') I'm sure this could be done without jQuery, but I'll not be a participant in that journey. 😜1 point
-
Hi This is how i would do it: add this code somewhere before the while 1 dim $copyarray[1] ; copyarray, has to be pre-defined $copyarray[0]=-1 dim $clipboard[600] ; maximum clipboard items (for copy+paste) $clipboard[0]=-1 and replace the code for the button clicks, from your last post, with: Case $button_copy ; store more than 1 selected item $copyarray = _GUICtrlListView_GetSelectedIndices($LV, 1) $clipboard[0] = $copyarray[0] For $j = 1 To $copyarray[0] $clipboard[$j] = _GUICtrlListView_GetItemTextString($LV, $copyarray[$j]) Next ;~ for $j=1 to $clipboard[0] ;Debug info ;~ MsgBox (0,$j,$clipboard[$j]) ;~ Next Case $button_paste ; paste more than 1 item $var = _GUICtrlListView_GetSelectionMark($LV) For $j = 1 To $clipboard[0] $txt_selected = StringSplit($clipboard[$j], "|") _GUICtrlListView_InsertItem($LV, $txt_selected[1], $var + 1) For $i = 2 To $txt_selected[0] _GUICtrlListView_AddSubItem($LV, $var + 1, $txt_selected[$i], $i - 1) Next $var = $var + 1 Next _GUICtrlListView_ClickItem($ListView, $var, "left", False) EndSwitch1 point
-
Script becomes way slower after a msgbox - (Moved)
TheDcoder reacted to argumentum for a topic
@Nine, is better to wait until a stable release. Meanwhile use the current version. Can't rush the cook1 point -
_IsPressed and RequireAdmin
SkysLastChance reacted to Jos for a topic
This was fixed a while ago in the Full version of SciTE4Autoit3. 2-1-2019 *** Updated AutoIt3Wrapper v19.102.1901.0 (Jos) - 18.703.1808.1 renamed "#AutoIt3Wrapper_Au3Stripper_Stop_OnError" to "#AutoIt3Wrapper_Au3Stripper_OnError" with now as options S,C,F,Stop,Continue,ForceUse - 18.708.1148.1 Added #include <WinAPIFiles.au3> back in the included file list to ensure backward compatibility. - 18.708.1148.2 Added "Tidy_Stop_OnError" support to the AutoIt3Wrapper.INI file. Changed HiDPI settings for Win 10 compatibility. - 18.708.1148.4 Added logic to be able to display Console Output of script that have #RequireAdmin while SciTE runs at normal level. - 18.708.1148.5 Added support to allow to Stop Execution or Restart for scripts with #RequireAdmin while SciTE runs at normal level. Jos1 point -
Use AutoIT to open a file in Microsoft TEAMS
FrancescoDiMuro reacted to Danp2 for a topic
Good to know. Guess I need to review where I'm needlessly doing this conversion in the Webdriver UDF. 😀1 point -
I created this after about adding an entry to the desktop contextmenu with an icon. I therefore thought it would be useful to create for those who would like to add an entry, but wouldn't know where to begin. UDF: #include-once ; #AutoIt3Wrapper_Au3Check_Parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6 ; #INDEX# ======================================================================================================================= ; Title .........: _ContextMenu ; AutoIt Version : v3.2.12.1 or higher ; Language ......: English ; Description ...: Create an entry in the desktop contextmenu, with the program icon as well. ; Note ..........: Thanks to GEOSoft for the initial idea & LaCastiglione for the link on how to add an icon to the desktop contextmenu. ; Link: http://www.autoitscript.com/forum/topic/129677-need-an-answer-to-a-simple-problem/ ; Author(s) .....: guinness ; Remarks .......: Special thanks to KaFu for EnumRegKeys2Array() which I used as inspiration for enumerating the Registry Keys. ; Warning .......: This has been tested on Windows 7 only. ; =============================================================================================================================== ; #INCLUDES# ========================================================================================================= ; None ; #GLOBAL VARIABLES# ================================================================================================= ; None ; #CURRENT# ===================================================================================================================== ; _ContextMenu_Install: Creates an entry in the 'All Users/Current Users' registry for displaying a program entry in the desktop shell contextmenu. ; _ContextMenu_Uninstall: Deletes an entry in the 'All Users/Current Users' registry for displaying a program entry in the desktop shell contextmenu. ; =============================================================================================================================== ; #INTERNAL_USE_ONLY#============================================================================================================ ; __ContextMenu_RegistryGet ......; Retrieve an array of registry entries for a specific key. ; =============================================================================================================================== ; #FUNCTION# ========================================================================================================= ; Name...........: _ContextMenu_Install() ; Description ...: Creates an entry in the 'All Users/Current Users' registry for displaying a program entry in the desktop shell contextmenu. ; Syntax.........: _ContextMenu_Install($sText, [$sName = @ScriptName, [$sFilePath = @ScriptFullPath, [$sIconPath = @ScriptFullPath, [$iIcon = 0, [$iAllUsers = 0, [$iExtended = 0]]]]]]) ; Parameters ....: $sText - Text to be shown in the contextmenu. ; $sName - [Optional] Name of the program. [Default = Script name] ; $sFilePath - [Optional] Location of the program executable. [Default = Full script location] ; $sIconPath - [Optional] Location of the icon e.g. program executable or dll file. [Default = Full script location] ; $$iIcon - [Optional] Index of icon to be used. [Default = 0 - Main icon] ; $iAllUsers - [Optional] Add to Current Users (0) or All Users (1) [Default = 0 - Current user] ; $iExtended - [Optional] Show in the Extended contextmenu using Shift + Right click. [Default = 0 - Show in main contextmeu.] ; Requirement(s).: v3.2.12.1 or higher ; Return values .: Success - RegWrite() Return code. ; Failure - none ; Author ........: guinness ; Example........; Yes ;===================================================================================================================== Func _ContextMenu_Install($sText, $sName = @ScriptName, $sFilePath = @ScriptFullPath, $sIconPath = @ScriptFullPath, $iIcon = 0, $iAllUsers = 0, $iExtended = 0) Local $i64Bit = "", $sRegistryKey = "" If @OSArch = "X64" Then $i64Bit = "64" EndIf If $iAllUsers Then $sRegistryKey = "HKEY_LOCAL_MACHINE" & $i64Bit & "\SOFTWARE\Classes\Directory\Background\shell\" Else $sRegistryKey = "HKEY_CURRENT_USER" & $i64Bit & "\SOFTWARE\Classes\Directory\Background\shell\" EndIf $sName = StringLower(StringReplace($sName, ".exe", "")) If $sName = "" Or $sFilePath = "" Then Return SetError(1, 0, 0) EndIf _ContextMenu_Uninstall($sName, $iAllUsers) RegWrite($sRegistryKey & $sName, "", "REG_SZ", $sText) RegWrite($sRegistryKey & $sName, "Icon", "REG_EXPAND_SZ", $sIconPath & "," & $iIcon) RegWrite($sRegistryKey & $sName & "\command", "", "REG_SZ", $sFilePath) If $iExtended Then RegWrite($sRegistryKey & $sName, "Extended", "REG_SZ", "") EndIf Return SetError(@error, 0, @error) EndFunc ;==>_ContextMenu_Install ; #FUNCTION# ========================================================================================================= ; Name...........: _ContextMenu_Uninstall() ; Description ...: Deletes an entry in the 'All Users/Current Users' registry for displaying a program entry in the desktop shell contextmenu. ; Syntax.........: _ContextMenu_Uninstall([$sName = @ScriptName, [$iAllUsers = 0]]) ; Parameters ....: $sName - [Optional] Name of the Program [Default = Script name.] ; $iAllUsers - [Optional] Was it added to Current Users (0) or All Users (1). [Default = 0 - Current user] ; Requirement(s).: v3.2.12.1 or higher ; Return values .: Success - Returns 2D Array of registry entries. ; Failure - Returns 0 and sets @error to 1. ; Author ........: guinness ; Example........; Yes ;===================================================================================================================== Func _ContextMenu_Uninstall($sName = @ScriptName, $iAllUsers = 0) Local $aArray, $i64Bit = "", $sDelete, $sRegistryKey = "" If @OSArch = "X64" Then $i64Bit = "64" EndIf If $iAllUsers Then $sRegistryKey = "HKEY_LOCAL_MACHINE" & $i64Bit & "\SOFTWARE\Classes\Directory\Background\shell\" Else $sRegistryKey = "HKEY_CURRENT_USER" & $i64Bit & "\SOFTWARE\Classes\Directory\Background\shell\" EndIf $sName = StringLower(StringReplace($sName, ".exe", "")) If $sName = "" Then Return SetError(1, 0, 0) EndIf $aArray = __ContextMenu_RegistryGet($sRegistryKey) If $aArray[0][0] > 0 Then For $A = 1 To $aArray[0][0] If $aArray[$A][0] = $sName And $sDelete <> $aArray[$A][1] Then $sDelete = $aArray[$A][1] RegDelete($sDelete) EndIf Next EndIf Return $aArray EndFunc ;==>_ContextMenu_Uninstall ; #INTERNAL_USE_ONLY#============================================================================================================ Func __ContextMenu_RegistryGet($sRegistryKey) Local $aArray[1][5] = [[0, 5]], $iCount_1 = 0, $iCount_2 = 0, $iDimension, $iError = 0, $sRegistryKey_All, $sRegistryKey_Main, $sRegistryKey_Name, $sRegistryKey_Value While 1 If $iError Then ExitLoop EndIf $sRegistryKey_Main = RegEnumKey($sRegistryKey, $iCount_1 + 1) If @error Then $sRegistryKey_All = $sRegistryKey $iError = 1 Else $sRegistryKey_All = $sRegistryKey & $sRegistryKey_Main EndIf $iCount_2 = 0 While 1 $sRegistryKey_Name = RegEnumVal($sRegistryKey_All, $iCount_2 + 1) If @error Then ExitLoop EndIf If ($aArray[0][0] + 1) >= $iDimension Then $iDimension = ($aArray[0][0] + 1) * 2 ReDim $aArray[$iDimension][$aArray[0][1]] EndIf $sRegistryKey_Value = RegRead($sRegistryKey_All, $sRegistryKey_Name) $aArray[$aArray[0][0] + 1][0] = $sRegistryKey_Main $aArray[$aArray[0][0] + 1][1] = $sRegistryKey_All $aArray[$aArray[0][0] + 1][2] = $sRegistryKey & $sRegistryKey_Main & "\" & $sRegistryKey_Name $aArray[$aArray[0][0] + 1][3] = $sRegistryKey_Name $aArray[$aArray[0][0] + 1][4] = $sRegistryKey_Value $aArray[0][0] += 1 $iCount_2 += 1 WEnd $iCount_1 += 1 WEnd ReDim $aArray[$aArray[0][0] + 1][$aArray[0][1]] Return $aArray EndFunc ;==>__ContextMenu_RegistryGetExample 1: #include "_ContextMenu.au3" _Main() Func _Main() _ContextMenu_Install("Start ContextMenu") ; Add the running EXE to the desktop contextmenu. Sleep(10000) _ContextMenu_Uninstall() ; Remove the running EXE from the desktop contextmenu. EndFunc ;==>_MainAll of the above has been included in a ZIP file. ContextMenu.zip Warning: This has been tested on Windows 7 only.1 point
-
i just read the rules aout coding for "certain purposes"
JLogan3o13 reacted to Livingbro for a topic
post cancelled, didnt know if i can delete this0 points