Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 11/29/2024 in all areas

  1. 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
  2. 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
    1 point
  3. 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.
    1 point
  4. ioa747

    FileSelectFolder Issues

    Func _MoveSourceAudioData($g_SetName) ; ----------------------------------------------- #include <MsgBoxConstants.au3> ; ----------------------------------------------- Opt("MustDeclareVars", 1) ; ----------------------------------------------- Global $g_SetName = "" ; ----------------------------------------------- _BrowseForFolder() ; ----------------------------------------------- Func _BrowseForFolder() While 1 $g_SetName = FileSelectFolder("Please select a valid Type_#\Set_Name folder...", "F:\Audio\") Local $iFileExists = FileExists($g_SetName & "\wav") ; ----------------------------------------------- ;If @error Then <<<<THIS CAN BE REMOVED! ; MsgBox($MB_TOPMOST, "", "No valid Type_#\Set_Name folder was selected." & @CRLF & "Please select a valid Type_#\Set_Name folder") ; ContinueLoop ;EndIf ; ----------------------------------------------- Local $_aGetType = StringSplit($g_SetName, "\") ; ----------------------------------------------- #CS before: Select Case $_aGetType[0] < 3 MsgBox($MB_TOPMOST, "NOTICE!", "You must select a valid Type_#\Set_Name folder...") ContinueLoop Case $_aGetType[3] = "Type_1" ConsoleWrite("" & $_aGetType[3] & @CRLF) If $iFileExists Then MsgBox($MB_SYSTEMMODAL, "", "The file exists....continue...") _MoveSourceAudioData($g_SetName) ExitLoop EndIf Case $_aGetType[3] = "Type_2" ConsoleWrite("" & $_aGetType[3] & @CRLF) If $iFileExists Then MsgBox($MB_SYSTEMMODAL, "", "The file exists....continue...") _MoveSourceAudioData($g_SetName) ExitLoop EndIf ;Case Else <<<<THIS CAN BE REMOVED! ; MsgBox($MB_TOPMOST, "NOTICE!", "You must to select a valid Type_#\Set_Name folder...") ; ContinueLoop EndSelect #CE If $_aGetType[0] < 3 Then MsgBox($MB_TOPMOST, "NOTICE!", "You must select a valid Type_#\Set_Name folder...") ContinueLoop EndIf If $_aGetType[3] = "Type_1" Or $_aGetType[3] = "Type_2" Then ConsoleWrite("" & $_aGetType[3] & @CRLF) If $iFileExists Then MsgBox($MB_SYSTEMMODAL, "", "The file exists....continue...") _MoveSourceAudioData() ExitLoop EndIf EndIf WEnd EndFunc ;==>_BrowseForFolder ; ----------------------------------------------- Func _MoveSourceAudioData() MsgBox($MB_TOPMOST, "NOTICE!", "Made it to _MoveSourceAudioData...with..." & $g_SetName & "\wav") ; ⚠ & "\wav" is missing ?? EndFunc ;==>_MoveSourceAudioData ; -----------------------------------------------
    1 point
  5. ioa747

    FileSelectFolder Issues

    with which _BrowseForFolder() made a script run by itself as I did above so I can test it Edit: As I mentioned above, this can be replaced with ; ----------------------------------------------- ; GLOBAL FUNCTIONS Func _MoveSourceAudioData($g_SetName) FileMove($g_sSourceAudioPath & "\*.*", $g_SetName, $FC_OVERWRITE) $g_SetNameWave = $g_SetName EndFunc ;==>_MoveSourceAudioData ; -----------------------------------------------
    1 point
  6. Hi everybody I just uploaded the new version 2.5r (11 nov 2024) of the script, download from 1st post. Changes of 2 last versions are : 11 nov 2024 : added a function _ViewSubArrays() in the generated code: this is useful if the user checked Mode 4 which "returns an array of arrays containing global matches including the full match." In this case the function _ViewSubArrays() will display the content of all internal sub-arrays, each internal 1D sub-array becoming 1 row in a 2D array. Thanks to taurus905 for the suggestion, not forgetting jchd who indicated that the internal sub-arrays could have have a different number of rows, depending on the pattern. Changed version from "2.5q" to "2.5r" 10 feb 2024 : check length of 'Personal' Tab before exiting the script : refuse to leave if > 64KB (see notes in script, part Case $GUI_EVENT_CLOSE, $btnClose) Related : Edit Control $ebPersonal got an 'unlimited' text size to bypass the 30.000 characters by default. Changed version from "2.5p" to "2.5q" (version 2.5q wasn't uploaded on the Forum) Thanks @taurus905 for suggesting to display the internal arrays in Mode 4 A thought to @mikell (who sadly is not with us anymore) he insisted that I change this explanative line from the context menu... "\G beginning of string, then where previous match ended" To... "\G beginning of string, or end of the previous match" It's done buddy, I didn't forget
    1 point
  7. The GUI looks like shown in the picture: It contains a main menu, a treeview in left pane that lists UI Automation elements, a listview in right pane that displays detail information for the selected element, and a splitterbar to adjust the width of the two panes. Detect element The "Detect element" main menu is used to detect elements under the mouse with function keys F1 - F4. See How to topics number 2. Left pane The left pane is a treeview that initially lists open programs and windows. Generally, the left pane shows UI Automation elements represented as treeview items. Right pane The right pane is a listview that displays detail information for the selected treeview element. The information is grouped into different types of information. Only the relevant information for each type is displayed. Invalid elements When a window is closed the elements in UIASpy becomes invalid. But the elements are not deleted in UIASpy and can still be handled and selected in the treeview. Detail information for an element that was calculated before the window was closed can still be seen in the listview. In this way it's possible for UIASpy to show information for eg. a context menu that is closed as soon as it loses focus. Listview features Listview features Help system With completion of the Help system, a lot of information has been moved from this post and other posts into the Help system. Sample code creation Sample code creation is implemented through the UI element Detail info listview page and through the Sample code main menu. Sample code creates code snippets based on data in one or more selected rows in the Detail info listview page or based on the clicked Sample code menu item. UI Automation code is largely based on COM interface objects and thus on the function ObjCreateInterface(), which is one of the advanced functions in AutoIt. The main purpose of Sample code functionality is to eliminate the complexity of ObjCreateInterface(). Sample code creation either through the Detail info listview page or through the Sample code main menu can create all the interface objects required in UI Automation code. Another purpose is of course to make it easier and faster to implement code for simple automation tasks. Through Sample code creation, you can more or less create all code in a simple automation task: Create UI Automation initial code Create condition and find application window Create condition and find control in window Get information about windows and controls Create pattern objects to perform actions Get information related to pattern objects Perform actions with pattern object methods Add a Sleep() statement if necessary Note that the UI element used in sample code is named after the selected element in the treeview. Also note that both the Sample code menu items and the sections in the Detail info listview page are placed in approximately the order they are used in a simple automation task. Sample code creation through Detail info listview page Sample code creation through Sample code main menu Supported applications Most browsers including Google Chrome To be able to spy on web content in Google Chrome it's necessary to enable accessibility by entering chrome://accessibility/ in the address bar of a new tab item, and then check the five check boxes that are located in a column in upper left corner down along the left edge. Then the accessibility tab can be closed again. It's a global setting that applies to all open and new tabs until Chrome is closed. Without accessibility enabled you are only able to investigate the outer elements of Chrome but not web content. Internet Explorer Microsoft Edge Mozilla Firefox Most Microsoft applications and applications developed with Microsoft software including Classic Windows applications based on the standard control library Modern Universal Windows Platform apps like the Windows 10 Calculator Programs implemented through .NET Framework eg. Windows Forms applications Most applications provided by major development companies Automation issues Automation issues How to topics If UI Automation or the UIASpy tool is new to you, then you should read the How to topics. Examples Examples that demonstrates the features of UIASpy: Automating Notepad. Very detailed example. Automating Notepad - Windows XP Examples about Sample code creation: Automating Notepad with Sample code - step by step Automating Notepad with Sample code - all at once Chrome - Clicking an extension. Compact summary example. Click Save As... issue in Notepad examples: Using Expand() instead of Invoke() Updates Windows 8, Windows 8.1 and Windows 10 updates Threads UI Automation UDFs contains all include files. In Using UI Automation Code in AutoIt you can find and download examples and read information about using UIA code. UI Automation Events is about implementing event handlers and includes GUIs to detect events. IUIAutomation MS framework automate chrome, FF, IE, .... created by junkew August 2013 is the first AutoIt thread on UIA code. Zip-file The zip contains source files for UIASpy GUI. Note that UI Automation UDFs must be installed in the Includes folder. You need AutoIt 3.3.12 or later. Tested on Windows XP, Windows 7 and Windows 10. Comments are welcome. Let me know if there are any issues. UIASpy.7z
    1 point
  8. This example is about using Microsoft UI Automation APIs in AutoIt. Ie. it's about using interfaces, objects, methods, properties and constants as they are defined directly by Microsoft. In AutoIt, the definitions are contained in CUIAutomation2.au3 by junkew. The definitions are copied from corresponding C/C++ header files and customized the AutoIt language. This example is not about the functions in UIAWrappers.au3 by junkew. The purpose of the example is to show how to use Microsoft UI Automation APIs directly without any intermediate AutoIt functions. A major advantage of this approach is that the Microsoft documentation directly can be used as AutoIt documentation. Other major advantages are that there is no need for documenting and maintaining a set of intermediate AutoIt functions. Without intermediate AutoIt functions the code will be very fast. All Microsoft functions can be used this way eg. functions for event handling. New interfaces, objects, methods, properties and constants can easily be added simply by adding the definitions to CUIAutomation2.au3. Is this approach difficult? Not at all as the examples will show. The example is inspired by this comment of mLipok. Including documentation and pictures, even a simple Notepad automation can be somewhat comprehensive. Therefore a new example. First post will be a list of examples. The examples themselves are reviewed in the following posts. In all examples UIASpy is used to get element information. Topics Using UIASpy UIASpy thread Automating Notepad. Very detailed example. Automating Notepad with Sample code - step by step Automating Notepad with Sample code - all at once Automating Notepad - Windows XP Automating Notepad - Classic Click Save As... issue Automating Notepad context menu. Event handler example. Chrome - Clicking an extension. Compact summary example. Other spy tools Using Microsoft Inspect.exe simplespy.au3 by junkew How to topics If UI Automation or the UIASpy tool is new to you, then you should start reading the How to topics Various topics Console and terminal windows Console application (3 posts) Terminal program (several posts) Examples Patterns (actions) Code snippets Real examples UIA updates UIA events Threads UI Automation UDFs contains all include files. UIASpy - UI Automation Spy Tool is a GUI tool that provides information about windows and controls and their interconnection and provides functionality to generate sample code. UIASpy is essential for creating UI Automation code. UI Automation Events is about implementing event handlers and includes GUIs to detect events. IUIAutomation MS framework automate chrome, FF, IE, .... created by junkew August 2013 is the first AutoIt thread on UIA code. Zip-file The zip contains source files for all examples. Note that UI Automation UDFs must be installed in the Includes folder. You need AutoIt 3.3.12 or later. Tested on Windows XP, Windows 7 and Windows 10. Comments and questions about using UIA code are welcome. Let me know if there are any issues. Questions about the functions in UIAWrappers.au3 should be asked in junkew's thread. UIAExamples.7z
    1 point
×
×
  • Create New...