Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 02/26/2023 in all areas

  1. Try this : #include <WinAPISys.au3> #include <WinAPIProc.au3> #include <WinAPIConstants.au3> #include <Misc.au3> #include <Array.au3> Global $hHook Example() Func Example() Local $hProc = DllCallbackRegister(CbtHookProc, "int", "int;int;int") $hHook = _WinAPI_SetWindowsHookEx($WH_CBT, DllCallbackGetPtr($hProc), 0, _WinAPI_GetCurrentThreadId()) Local $aFont = _ChooseFont("Arial", 8) _ArrayDisplay($aFont) _WinAPI_UnhookWindowsHookEx($hHook) DllCallbackFree($hProc) EndFunc ;==>Example2 Func CbtHookProc($nCode, $wParam, $lParam) Local $hWnd = HWnd($wParam) If $hWnd = WinGetHandle("Police") And $nCode = 5 Then ; "Police" = french title for ChooseFont // 5=HCBT_ACTIVATE ControlHide($hWnd, "", "SysLink1") ControlHide($hWnd, "", "Static7") ControlHide($hWnd, "", "ComboBox5") EndIf Return _WinAPI_CallNextHookEx($hHook, $nCode, $wParam, $lParam) EndFunc ;==>CbtHookProc
    3 points
  2. ioa747

    GhostGui

    GhostGui - masks the window and makes it darker on this example put in the same directory GhostGui.au3 and AutoItHelp.au3 then run the _AutoItHelp.au3 press F1 to activate the help. With ALT + mouse wheel scroll you can adjust GhostGui.au3 ; https://www.autoitscript.com/forum/topic/209769-ghostgui/ ;------------------------------------------------------------------------------ ; Title...........: GhostGui.au3 ; Description.....: masks the window and makes it darker with ALT + mouse wheel scroll ; ALT key in Line 199 ;------------------------------------------------------------------------------ #AutoIt3Wrapper_Au3Check_Parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6 -w 7 #NoTrayIcon #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> #include <Misc.au3> #include <WinAPISys.au3> #include <WinAPIConstants.au3> Global $GToolstate = 0, $GToolTimer Global $iParams $iParams = $CmdLine[0] If Not $iParams Then MsgBox(0, "* This is an example...", "This means that you have run the" & @CRLF & @CRLF _ & " --> " & @ScriptName & " <-- " & @CRLF & @CRLF _ & "without command line parameters." & @CRLF _ & "and for this reason go to test mode." & @CRLF & @CRLF _ & "First select the windows you want to act" & @CRLF _ & "and then press OK." & @CRLF _ & "Act with ALT key + WHEEL UP/DOWN") Global $iParams[4] = [3, '[ACTIVE]', 0x000000, 125] ;GhostGUI($HosthWnd, $BackColor = 0x000000, $Transparency = 125) Else $iParams = $CmdLine EndIf If _Singleton($iParams[1], 1) = 0 Then Exit ; to avoid running it multiple times! ;Mouse hook ;--------------------------------------------------------------------------- Global $mX, $mY, $mEvent Global $hDLL = DllOpen("user32.dll") Global $hHook, $hStub_KeyProc, $hmod, $tmpTrack, $WheelTrack = 0 $hStub_KeyProc = DllCallbackRegister("_KeyProc", "long", "int;wparam;lparam") $hmod = _WinAPI_GetModuleHandle(0) $hHook = _WinAPI_SetWindowsHookEx($WH_MOUSE_LL, DllCallbackGetPtr($hStub_KeyProc), $hmod) ;---------------------------------------------------------------------------------------- Global $hGhostGUI, $hWnd GhostGUI($iParams[1], $iParams[2], $iParams[3]) ;call GhostGUI($HosthWnd, $BackColor = 0x000000, $Transparency = 125) GoToExit() ;---------------------------------------------------------------------------------------- Func GoToExit() ; exit & Cleanup Cleanup() Exit EndFunc ;==>GoToExit ;---------------------------------------------------------------------------------------- Func Cleanup() ; Cleanup dll callback _WinAPI_UnhookWindowsHookEx($hHook) DllCallbackFree($hStub_KeyProc) EndFunc ;==>Cleanup ;---------------------------------------------------------------------------------------- Func ScripExit() If WinActive($hWnd) Then GoToExit() EndFunc ;==>ScripExit ;---------------------------------------------------------------------------------------- Func GhostGUI($HosthWnd, $BackColor = 0x000000, $Transparency = 125) $hWnd = WinWait($HosthWnd) $hGhostGUI = GUICreate('GhostGUI', 200, 200, -200, -200, $WS_POPUP, $WS_EX_TOOLWINDOW + $WS_EX_TRANSPARENT, $hWnd) GUISetBkColor($BackColor) WinSetTrans($hGhostGUI, '', $Transparency) $WheelTrack = $Transparency Local $HWPos0, $HWPos[4] ; [0]=X [1]=Y [2]=Width [3]=Height $GToolTimer = TimerInit() HotKeySet("{ESC}", "ScripExit") ; Display the GUI. GUISetState(@SW_SHOW, $hGhostGUI) WinActivate($hWnd) Local $gtooltiptmptxt = "press ESC to terminate." & @CRLF & "Act with ALT key + WHEEL UP/DOWN" ;******************************************* While 1 If $GToolstate = 0 Then ToolTip("Transparency " & $WheelTrack & @CRLF & $gtooltiptmptxt _ , MouseGetPos(0), MouseGetPos(1) + 32, "info", 1) If TimerDiff($GToolTimer) > 4000 Then $GToolstate = 2 $gtooltiptmptxt = "" ToolTip("") EndIf EndIf Switch GUIGetMsg() Case $GUI_EVENT_CLOSE ExitLoop EndSwitch If WinExists($hWnd) Then $HWPos0 = WinGetPos($hWnd) $HWPos[0] = $HWPos0[0] + 7 $HWPos[1] = $HWPos0[1] $HWPos[2] = $HWPos0[2] - 14 $HWPos[3] = $HWPos0[3] - 7 WinMove($hGhostGUI, "", $HWPos[0], $HWPos[1], $HWPos[2], $HWPos[3]) Else ExitLoop EndIf MouseAct() Sleep(100) WEnd ;******************************************* ; Delete the previous GUI and all controls. GUIDelete($hGhostGUI) EndFunc ;==>GhostGUI ;---------------------------------------------------------------------------------------- Func _KeyProc($nCode, $wParam, $lParam) ; callback function mouse hook Local $tKEYHOOKS, $X, $Y, $tmp, $Delta If $nCode < 0 Then Return _WinAPI_CallNextHookEx($hHook, $nCode, $wParam, $lParam) $tKEYHOOKS = DllStructCreate($tagKBDLLHOOKSTRUCT, $lParam) $X = DllStructGetData($tKEYHOOKS, "vkCode") $Y = DllStructGetData($tKEYHOOKS, "scanCode") Switch $wParam Case $WM_MOUSEWHEEL $Delta = BitShift(DllStructGetData($tKEYHOOKS, "flags"), 16) If $Delta > 0 Then $tmp = 'WHEEL_UP' Else $tmp = 'WHEEL_DOWN' EndIf $tmp &= ' (' & $Delta & ')' Case Else $tmp = "" $mEvent = "" $mX = $X $mY = $Y Return _WinAPI_CallNextHookEx($hHook, $nCode, $wParam, $lParam) EndSwitch $mEvent = $tmp ; Return _WinAPI_CallNextHookEx($hHook, $nCode, $wParam, $lParam) EndFunc ;==>_KeyProc ;---------------------------------------------------------------------------------------- Func GetMouseMsg() ; Mouse Msg Local $mMsg Local $sMax = 255 If $mEvent = "" Then ElseIf $mEvent = "WHEEL_UP (120)" Then ;ConsoleWrite("$mEvent = " & $mEvent & @CRLF) $mEvent = "" $mMsg = "WHEEL_UP" $WheelTrack -= 5 $GToolstate = 0 $GToolTimer = TimerInit() ElseIf $mEvent = "WHEEL_DOWN (-120)" Then ;ConsoleWrite("$mEvent = " & $mEvent & @CRLF) $mEvent = "" $mMsg = "WHEEL_DOWN" $WheelTrack += 5 $GToolstate = 0 $GToolTimer = TimerInit() Else ;nothing ConsoleWrite("$mEvent = " & $mEvent & @CRLF) $mEvent = "" $mMsg = "" EndIf If $WheelTrack > $sMax Then $WheelTrack = $sMax ElseIf $WheelTrack < 0 Then $WheelTrack = 0 EndIf Return $mMsg EndFunc ;==>GetMouseMsg ;---------------------------------------------------------------------------------------- Func MouseAct() If _IsPressed("12", $hDLL) Then ;12 ALT key While _IsPressed("12", $hDLL) ;While CTRL key GetMouseMsg() ;ConsoleWrite("- $WheelTrack=" & $WheelTrack & @CRLF) If $tmpTrack <> $WheelTrack Then WinSetTrans($hGhostGUI, '', $WheelTrack) $tmpTrack = $WheelTrack EndIf Sleep(100) WEnd EndIf EndFunc ;==>MouseAct _AutoItHelp.au3 as example ;https://www.autoitscript.com/forum/topic/209769-ghostgui/ ;------------------------------------------------------------------------------ ; Title...........: _AutoItHelp.au3 ; Description.....: Example to test the GhostGui() ;------------------------------------------------------------------------------ #AutoIt3Wrapper_Au3Check_Parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6 -w 7 #include <Misc.au3> Global $hWnd = WinWait("[TITLE:AutoIt Help; CLASS:HH Parent]") GhostGui() ;************************************************ While WinActive($hWnd) ; Loop While win exits. Sleep(100) WEnd ;************************************************ Exit ;---------------------------------------------------------------------------------------- Func GhostGui() Local $FilePath = @ScriptDir & "\GhostGui.au3" Local $Param = '"[TITLE:AutoIt Help; CLASS:HH Parent]" "0x000000" "50"' _RunScript($FilePath, $Param) EndFunc ;==>GhostGui ;---------------------------------------------------------------------------------------- Func _RunScript($FilePath, $Param = "") Run(FileGetShortName(@AutoItExe) & " " & FileGetShortName($FilePath) & " " & $Param) EndFunc ;==>_RunScript since i did i want to share it Please, leave your comments and experiences here. Thank you !
    2 points
  3. ioa747

    GhostGui

    you are right i tried it and it didn't look right on win10 while on my primary screen(in clone mode) 1920X1080 when I tested it with Scala 100 125 and 150 it played correctly when i turn extended mode primary screen 1920X1080 and secondary 3840 x 2160 is 300% in primary screen is ok regardless of scaling , but in secondary elsewhere the window and elsewhere the mask Sorry for the inconvenience Again thank you very much however, i changed tactics. If you want to try it, I wish I made it I updated the original post again
    2 points
  4. Overview The example is named AutoIt and Python Integration. Integration here means data integration, where data e.g. arrays are passed back and forth between AutoIt and Python scripts. The technique is based on ROT objects registered in the Running Object Table (ROT). Relevant threads IRunningObjectTable AutoIt and Perl Integration AutoIt and VBScript Integration (middle of post) Execute VBScript method in AutoIt First post Running Object Table (ROT) A summary of the technique Two AutoIt Scripts Which data types can be passed? AutoIt and Python Integration Python Installation AutoIt and Python Simple examples Prime Numbers Python calculation of prime numbers and passing data to AutoIt Also prime number calculation with AutoIt and VB.NET code Runtimes Speed comparison of AutoIt, Python and VB.NET code Based on the prime number calculations above Python and VBScript Pass array between Python and VBScript 7z-file Running Object Table (ROT) The Running Object Table (ROT) is a system global table where objects can register themselves. This makes the objects available in processes other than the process in which the objects are created. These processes can be implemented in different programming languages. A ROT object is typically used to exchange data between the processes. An object is registered in the ROT through the IRunningObjectTable interface. A script that registers an object in the ROT is referred to as a server. A ROT object is usually available in the table as long as the server is running. IRunningObjectTable.au3 must be included in the server script. A script that uses an object in the ROT is referred to as a client. A client connects to a ROT object through functions such as GetObject(), GetActiveObject(), and the like. Therefore, a client doesn't depend on IRunningObjectTable.au3. A client and a server can exchange data through the ROT object. But two clients can also exchange data through a common server. Since IRunningObjectTable.au3 is an AutoIt include file, it's easy to create the server as an AutoIt script. As the data transfer takes place using COM objects, only COM compatible data can be transferred. If sender and receiver scripts are coded in different languages, then data exchange also depends on the data types being represented in both languages. Most script languages support simple data types such as integers, floats and strings as well as advanced data types such as arrays and dictionary objects. An advantage of using ROT objects is that internal data types of e.g. array elements are preserved during a data transfer. Below is demonstrated data exchange between AutoIt and Python. Eg. how to pass an array from AutoIt to Python, perform calculations with functions in the NumPy package, and return the results to AutoIt. But first there is a test on passing data between two AutoIt scripts. Two AutoIt ScriptsWhich data types can be exchanged through a ROT object between two AutoIt scripts running in two different processes? Examples in Examples\AutoItAutoIt\ folder. These are slight variations of the VarGetType() example in the help file. Server.au3: #AutoIt3Wrapper_Au3Check_Parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6 -w 7 #AutoIt3Wrapper_UseX64=Y Opt( "MustDeclareVars", 1 ) #include <GUIConstantsEx.au3> #include "..\..\Includes\IRunningObjectTable.au3" Server() Func Server() ; Create a default ROT-object (Dictionary object) ; The script that creates the ROT object is the server ; The ROT object is available while the server is running Local $sDataTransferObject = "DataTransferObject", $oDict $oDict = ROT_CreateDefaultObject( $sDataTransferObject, 0 ) ; 0 -> Non-unique ; AutoIt data types Local $aArray[2] = [ 1, "Example" ] Local $mMap[] Local $dBinary = Binary( "0x00204060" ) Local $bBoolean = False Local $pPtr = Ptr( -1 ) Local $hWnd = WinGetHandle( AutoItWinGetTitle() ) Local $iInt = 1 Local $fFloat = 2.0 Local $oObject = ObjCreate( "Scripting.Dictionary" ) Local $sString = "Some text" Local $tStruct = DllStructCreate( "wchar[256]" ) Local $vKeyword = Default Local $fuFunc = ConsoleWrite Local $fuUserFunc = Test ; Add data to $oDict $oDict.Item( "$aArray" ) = $aArray $oDict.Item( "$mMap" ) = $mMap $oDict.Item( "$dBinary" ) = $dBinary $oDict.Item( "$bBoolean" ) = $bBoolean $oDict.Item( "$pPtr" ) = $pPtr $oDict.Item( "$hWnd" ) = $hWnd $oDict.Item( "$iInt" ) = $iInt $oDict.Item( "$fFloat" ) = $fFloat $oDict.Item( "$oObject" ) = $oObject $oDict.Item( "$sString" ) = $sString $oDict.Item( "$tStruct" ) = $tStruct $oDict.Item( "$vKeyword" ) = $vKeyword $oDict.Item( "$fuFunc" ) = $fuFunc $oDict.Item( "$fuUserFunc" ) = $fuUserFunc ; Create server GUI Local $hGui = GUICreate( "Server", 200, 70, 200, 50 ) ; Show GUI GUISetState() MsgBox( 0, "Variable Types on Server", _ "$aArray : " & @TAB & @TAB & VarGetType( $aArray ) & " variable type" & @CRLF & _ "$mMap : " & @TAB & @TAB & VarGetType( $mMap ) & " variable type" & @CRLF & _ "$dBinary : " & @TAB & VarGetType( $dBinary ) & " variable type" & @CRLF & _ "$bBoolean : " & @TAB & VarGetType( $bBoolean ) & " variable type" & @CRLF & _ "$pPtr : " & @TAB & @TAB & VarGetType( $pPtr ) & " variable type" & @CRLF & _ "$hWnd : " & @TAB & @TAB & VarGetType( $hWnd ) & " variable type" & @CRLF & _ "$iInt : " & @TAB & @TAB & VarGetType( $iInt ) & " variable type" & @CRLF & _ "$fFloat : " & @TAB & @TAB & VarGetType( $fFloat ) & " variable type" & @CRLF & _ "$oObject : " & @TAB & VarGetType( $oObject ) & " variable type" & @CRLF & _ "$sString : " & @TAB & VarGetType( $sString ) & " variable type" & @CRLF & _ "$tStruct : " & @TAB & VarGetType( $tStruct ) & " variable type" & @CRLF & _ "$vKeyword : " & @TAB & VarGetType( $vKeyword ) & " variable type" & @CRLF & _ "$fuFunc : " & @TAB & VarGetType( $fuFunc ) & " variable type" & @CRLF & _ "$fuUserFunc : " & @TAB & VarGetType( $fuUserFunc ) & " variable type" ) ; Loop While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE ExitLoop EndSwitch WEnd GUIDelete( $hGui ) EndFunc Func Test() EndFunc Run the script by double clicking. MsgBox output: Variable Types on Server $aArray : Array variable type $mMap : Map variable type $dBinary : Binary variable type $bBoolean : Bool variable type $pPtr : Ptr variable type $hWnd : Ptr variable type $iInt : Int32 variable type $fFloat : Double variable type $oObject : Object variable type $sString : String variable type $tStruct : DLLStruct variable type $vKeyword : Keyword variable type $fuFunc : Function variable type $fuUserFunc : UserFunction variable type Just leave the MsgBox running. Client.au3: #AutoIt3Wrapper_Au3Check_Parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6 -w 7 #AutoIt3Wrapper_UseX64=Y Opt( "MustDeclareVars", 1 ) #include <GUIConstantsEx.au3> ; IRunningObjectTable.au3 UDF ; not needed in the client. Client() Func Client() ; Error monitoring. This will trap all COM errors while alive. Local $oErrorHandler = ObjEvent( "AutoIt.Error", "COMerror" ) ; Get default ROT-object (Dict obj) Local $oDict = ObjGet( "DataTransferObject" ) Local $aArray = $oDict.Item( "$aArray" ), $aArrayErr = @error Local $mMap = $oDict.Item( "$mMap" ), $mMapErr = @error Local $dBinary = $oDict.Item( "$dBinary" ), $dBinaryErr = @error Local $bBoolean = $oDict.Item( "$bBoolean" ), $bBooleanErr = @error Local $pPtr = $oDict.Item( "$pPtr" ), $pPtrErr = @error Local $hWnd = $oDict.Item( "$hWnd" ), $hWndErr = @error Local $iInt = $oDict.Item( "$iInt" ), $iIntErr = @error Local $fFloat = $oDict.Item( "$fFloat" ), $fFloatErr = @error Local $oObject = $oDict.Item( "$oObject" ), $oObjectErr = @error Local $sString = $oDict.Item( "$sString" ), $sStringErr = @error Local $tStruct = $oDict.Item( "$tStruct" ), $tStructErr = @error Local $vKeyword = $oDict.Item( "$vKeyword" ), $vKeywordErr = @error Local $fuFunc = $oDict.Item( "$fuFunc" ), $fuFuncErr = @error Local $fuUserFunc = $oDict.Item( "$fuUserFunc" ), $fuUserFuncErr = @error ConsoleWrite( "Variable Types on Client" & @CRLF ) ConsoleWrite( "$aArray : " & ( $aArrayErr ? "@error = " & $aArrayErr : VarGetType( $aArray ) & " variable type" ) & @CRLF ) ConsoleWrite( "$mMap : " & ( $mMapErr ? "@error = " & $mMapErr : VarGetType( $mMap ) & " variable type" ) & @CRLF ) ConsoleWrite( "$dBinary : " & ( $dBinaryErr ? "@error = " & $dBinaryErr : VarGetType( $dBinary ) & " variable type" ) & @CRLF ) ConsoleWrite( "$bBoolean : " & ( $bBooleanErr ? "@error = " & $bBooleanErr : VarGetType( $bBoolean ) & " variable type" ) & @CRLF ) ConsoleWrite( "$pPtr : " & ( $pPtrErr ? "@error = " & $pPtrErr : VarGetType( $pPtr ) & " variable type" ) & @CRLF ) ConsoleWrite( "$hWnd : " & ( $hWndErr ? "@error = " & $hWndErr : VarGetType( $hWnd ) & " variable type" ) & @CRLF ) ConsoleWrite( "$iInt : " & ( $iIntErr ? "@error = " & $iIntErr : VarGetType( $iInt ) & " variable type" ) & @CRLF ) ConsoleWrite( "$fFloat : " & ( $fFloatErr ? "@error = " & $fFloatErr : VarGetType( $fFloat ) & " variable type" ) & @CRLF ) ConsoleWrite( "$oObject : " & ( $oObjectErr ? "@error = " & $oObjectErr : VarGetType( $oObject ) & " variable type" ) & @CRLF ) ConsoleWrite( "$sString : " & ( $sStringErr ? "@error = " & $sStringErr : VarGetType( $sString ) & " variable type" ) & @CRLF ) ConsoleWrite( "$tStruct : " & ( $tStructErr ? "@error = " & $tStructErr : VarGetType( $tStruct ) & " variable type" ) & @CRLF ) ConsoleWrite( "$vKeyword : " & ( $vKeywordErr ? "@error = " & $vKeywordErr : VarGetType( $vKeyword ) & " variable type" ) & @CRLF ) ConsoleWrite( "$fuFunc : " & ( $fuFuncErr ? "@error = " & $fuFuncErr : VarGetType( $fuFunc ) & " variable type" ) & @CRLF ) ConsoleWrite( "$fuUserFunc : " & ( $fuUserFuncErr ? "@error = " & $fuUserFuncErr : VarGetType( $fuUserFunc ) & " variable type" ) & @CRLF ) ConsoleWrite( @CRLF & "@error = -2147221163 = 0x80040155" & @CRLF & " Interface not registered" & @CRLF ) #forceref $oErrorHandler EndFunc Func COMerror() EndFunc Run the script in SciTE with F5. The object event message handler, $oErrorHandler, is used to set an error code in @error. Console output: Variable Types on Client $aArray : Array variable type $mMap : @error = -2147221163 $dBinary : Binary variable type $bBoolean : Bool variable type $pPtr : Int32 variable type $hWnd : Int32 variable type $iInt : Int32 variable type $fFloat : Double variable type $oObject : Object variable type $sString : String variable type $tStruct : @error = -2147221163 $vKeyword : Keyword variable type $fuFunc : @error = -2147221163 $fuUserFunc : @error = -2147221163 @error = -2147221163 = 0x80040155 Interface not registered There are 3 COM incompatible data types that all fail with error code 0x80040155, Interface not registered: Map, DllStruct and Function. An inspection of these data types with code in InspectVariable.au3 from Accessing AutoIt Variables gives this result: InspectVariable.txt: $mMap Type = Map ptr = 0x009B5FF8 ($pVariant) vt = 0x0024 (VT_RECORD, pointer to record object) data = 0x00000000 $tStruct Type = DLLStruct ptr = 0x009E3C08 ($pVariant) vt = 0x0024 (VT_RECORD, pointer to record object) data = 0x00000000 $fuFunc Type = Function ptr = 0x009E3C98 ($pVariant) vt = 0x0024 (VT_RECORD, pointer to record object) data = 0x00000000 $fuUserFunc Type = UserFunction ptr = 0x009E3C98 ($pVariant) vt = 0x0024 (VT_RECORD, pointer to record object) data = 0x00000000 In all cases the variant data type is VT_RECORD used for user defined types (UDTs) and the data field, which should be a pointer to the IRecordInfo interface, is a NULL pointer. It's thus not possible to obtain more information about these data types. At least not through the techniques in Accessing AutoIt Variables. The bottom line seems to be that the data types are coded through COM incompatible custom implementations in the AutoIt internal C/C++ code. AutoIt and Python Integration The rather elusive code box at top of this post nevertheless indicates how to access a ROT object in Python through the GetObject() function. This allows data to be exchanged between AutoIt and Python. But first Python must be installed. Python InstallationPython 3.8.0 is the latest version that can be installed on Windows 7. To avoid spending too much time on installation, it's easiest to just download the Windows x86-64 executable installer (python-3.8.0-amd64.exe) at bottom of the page and install Python from there. Make sure that the path to the Python installation folder is added to environment variables. Necessary for AutoIt commands like Run and RunWait to find Python.exe without specifying the full path, which can be different from one PC to another. Upgrade PIP package manager: C:\>py -m pip install --upgrade pip Install PyWin32 package to access the Windows API C:\>py -m pip install --upgrade pywin32 Install NumPy package with support for arrays and matrices C:\>py -m pip install --upgrade numpy AutoIt and PythonExamples\AutoItPython\ contains 3 small AutoIt scripts and 2 Python scripts for a simple demonstration of passing arrays back and forth between AutoIt and Python. Open a command prompt and run the 5 scripts in a similar way: C:\>d: D:\>cd D:\...\Examples\AutoItPython D:\...\Examples\AutoItPython>subst z: . D:\...\Examples\AutoItPython>z: Z:\>"0) Server.au3" Z:\>"1) AutoIt send.au3" Z:\>"2) Python rec.py" (123, 456.789, 'String') 123 <class 'int'> 456.789 <class 'float'> String <class 'str'> ((1, 2, 3, 4), (5, 6, 7, 8), (9, 10, 11, 12)) (1, 2, 3, 4) Z:\>"3) Python send.py" Z:\>"4) AutoIt rec.au3" Z:\>d: D:\...\Examples\AutoItPython>subst z: /d It should be enough to press 0+Tab to execute "0) Server.au3". Correspondingly for the other scripts. 0) Server.au3: #AutoIt3Wrapper_Au3Check_Parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6 -w 7 #AutoIt3Wrapper_UseX64=Y Opt( "MustDeclareVars", 1 ) #include <GUIConstantsEx.au3> #include "IRunningObjectTable.au3" Server() Func Server() ; Create a default ROT-object (Dictionary object) ; The script that creates the ROT object is the server ; The ROT object is available while the server is running Local $sDataTransferObject = "DataTransferObject" ROT_CreateDefaultObject( $sDataTransferObject, 0 ) ; 0 -> Non-unique ; Create server GUI Local $hGui = GUICreate( "Server", 200, 70, 200, 50 ) ; Show GUI GUISetState() ; Loop While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE ExitLoop EndSwitch WEnd GUIDelete( $hGui ) EndFunc 1) AutoIt send.au3: #AutoIt3Wrapper_Au3Check_Parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6 -w 7 #AutoIt3Wrapper_UseX64=Y Opt( "MustDeclareVars", 1 ) Example() Func Example() ; Get default ROT-object (Dictionary object) Local $oDict = ObjGet( "DataTransferObject" ) ; Add 1d array to $oDict Local $aArray1 = [ 123, 456.789, "String" ] $oDict.Item( "aArray1" ) = $aArray1 ; Add 2d array to $oDict ; In AutoIt and Python, rows and columns are swapped ; The AutoIt array below will result in the following Python array ; aArray = [ [ 1, 2, 3, 4 ], [ 5, 6, 7, 8 ], [ 9, 10, 11, 12 ] ] Local $aArray2 = [ _ [ 1, 5, 9 ], _ [ 2, 6, 10 ], _ [ 3, 7, 11 ], _ [ 4, 8, 12 ] ] $oDict.Item( "aArray2" ) = $aArray2 EndFunc 2) Python rec.py: import win32com.client import numpy as np # Get default ROT-object (Dictionary object) oDict = win32com.client.GetObject( "DataTransferObject" ) # Get 1d AutoIt array as List aArray1 = oDict( "aArray1" ) print( aArray1 ) print( "" ) # Print data types for item in aArray1: print( "{}\t{}".format( item, type( item ) ) ) print( "" ) # Get 2d array as NumPy array np.aArray2 = oDict( "aArray2" ) print( np.aArray2 ) print( np.aArray2[0] ) These are the _ArrayDisplay's created by 4) AutoIt rec.au3: Prime NumbersExamples\Prime numbers\1) Scripts\ contains scripts to calculate prime numbers using AutoIt, Python and VB.NET. Run au3-scripts in SciTE with F5. pyPrimes.au3: #AutoIt3Wrapper_Au3Check_Parameters=-d -w- 1 -w 2 -w 3 -w 4 -w 5 -w 6 -w 7 #AutoIt3Wrapper_UseX64=Y Opt( "MustDeclareVars", 1 ) #include "..\..\..\Includes\IRunningObjectTable.au3" #include "..\..\..\Includes\DataDisplay\Functions\ArrayDisplayEx\ArrayDisplayEx.au3" #include "..\..\..\Includes\DataDisplay\Functions\ArrayDisplayEx\ArrayDisplayEx_ColumnFormats.au3" ; Create a default ROT-object (Dictionary object) ; The script that creates the ROT object is the server ; The ROT object is available while the server is running Global $sDataTransferObject = "DataTransferObject" Global $oDict = ROT_CreateDefaultObject( $sDataTransferObject, 0 ) ; 0 -> Non-unique Example( 100 ) Example( 1000 ) Example( 10000 ) Func Example( $nPrimes ) Local $aAlignment = [ [ 0, "C" ], [ 1, "R" ] ] Local $aColWidthMin = [ [ 0, 65 ], [ 1, 80 ] ] Local $aColFormats = [ 0, "Int1000Sep", "," ] ; DATA SOURCE column index Local $aFeatures = [ [ "ColAlign", $aAlignment ], _ [ "ColWidthMin", $aColWidthMin ], _ [ "ColFormats", $aColFormats ], _ [ "1dColumns", 10 ] ] RunWait( "Python.exe pyPrimes.py " & """" & $nPrimes & """", "", @SW_HIDE ) Local $aPrimes = $oDict.Item( "aPrimes" ) _ArrayDisplayEx( $aPrimes, "Prime numbers", "#|Primes", 0, $aFeatures ) EndFunc pyPrimes.py: import sys import math as ma import numpy as np import win32com.client # Get default ROT-object (Dictionary object) oDict = win32com.client.GetObject( "DataTransferObject" ) def CalcPrimes( nPrimes ): # Define NumPy array to store prime numbers aPrimes = np.zeros( shape = ( nPrimes, ), dtype = np.int32 ) # Store first prime iPrime = 2 iPrimes = 0 aPrimes[iPrimes] = iPrime iPrimes += 1 iPrime += 1 # Calculate primes while iPrimes < nPrimes: i = 1 iMaxFactor = ma.ceil(ma.sqrt(iPrime)) while i < iPrimes and aPrimes[i] <= iMaxFactor: if ma.fmod( iPrime, aPrimes[i] ) == 0: i = iPrimes i += 1 if i < iPrimes + 1: aPrimes[iPrimes] = iPrime iPrimes += 1 iPrime += 2 oDict[ "aPrimes" ] = aPrimes CalcPrimes( int( sys.argv[1] ) ) RuntimesExamples\Prime numbers\2) Runtimes\ is a speed comparison of the 3 prime number calculations performed with the techniques in Runtimes and Speed Comparisons. Run Primes.au3 in SciTE with F5. Primes.txt: Calculation of Prime Numbers Calculation of Prime Numbers AutoIt vs Python vs VB.NET AutoIt vs Python vs VB.NET Code executed as 64-bit code Code executed as 64-bit code ================================== ================================== 100 prime numbers 100 prime numbers ---------------------------------- ---------------------------------- AutoIt calculation: 7.1752 AutoIt calculation: 1.8151 Python calculation: 339.0743 Python calculation: 312.9130 VB.NET calculation: 0.1008 VB.NET calculation: 0.0481 500 prime numbers 500 prime numbers ---------------------------------- ---------------------------------- AutoIt calculation: 16.3156 AutoIt calculation: 14.9084 Python calculation: 317.8483 Python calculation: 314.0434 VB.NET calculation: 0.1665 VB.NET calculation: 0.1207 1,000 prime numbers 1,000 prime numbers ---------------------------------- ---------------------------------- AutoIt calculation: 38.2239 AutoIt calculation: 40.0983 Python calculation: 345.3165 Python calculation: 318.2725 VB.NET calculation: 0.5128 VB.NET calculation: 0.2229 2,000 prime numbers 2,000 prime numbers ---------------------------------- ---------------------------------- AutoIt calculation: 108.7436 AutoIt calculation: 102.3103 Python calculation: 357.4340 Python calculation: 353.0137 VB.NET calculation: 0.7696 VB.NET calculation: 0.4523 5,000 prime numbers 5,000 prime numbers ---------------------------------- ---------------------------------- AutoIt calculation: 351.2818 AutoIt calculation: 355.7042 Python calculation: 418.0871 Python calculation: 404.9797 VB.NET calculation: 1.6748 VB.NET calculation: 1.3370 10,000 prime numbers 10,000 prime numbers ---------------------------------- ---------------------------------- AutoIt calculation: 919.5793 AutoIt calculation: 928.2449 Python calculation: 602.1903 Python calculation: 553.9019 VB.NET calculation: 3.9493 VB.NET calculation: 3.1382 20,000 prime numbers 20,000 prime numbers ---------------------------------- ---------------------------------- AutoIt calculation: 2365.4960 AutoIt calculation: 2378.4718 Python calculation: 1161.5604 Python calculation: 991.8602 VB.NET calculation: 9.8814 VB.NET calculation: 8.0775 50,000 prime numbers 50,000 prime numbers ---------------------------------- ---------------------------------- AutoIt calculation: 8748.3280 AutoIt calculation: 8598.7165 Python calculation: 3422.4653 Python calculation: 2717.4886 VB.NET calculation: 33.1839 VB.NET calculation: 27.4017 100,000 prime numbers 100,000 prime numbers ---------------------------------- ---------------------------------- AutoIt calculation: 22959.9331 AutoIt calculation: 22686.7254 Python calculation: 8589.2150 Python calculation: 6701.6450 VB.NET calculation: 83.8414 VB.NET calculation: 69.6644 250,000 prime numbers 250,000 prime numbers ---------------------------------- ---------------------------------- AutoIt calculation: >10000.0000 AutoIt calculation: >10000.0000 Python calculation: 30198.3188 Python calculation: 23837.4175 VB.NET calculation: 293.9497 VB.NET calculation: 235.9579 500,000 prime numbers 500,000 prime numbers ---------------------------------- ---------------------------------- AutoIt calculation: >10000.0000 AutoIt calculation: >10000.0000 Python calculation: >10000.0000 Python calculation: >10000.0000 VB.NET calculation: 765.3462 VB.NET calculation: 600.5832 750,000 prime numbers 750,000 prime numbers ---------------------------------- ---------------------------------- AutoIt calculation: >10000.0000 AutoIt calculation: >10000.0000 Python calculation: >10000.0000 Python calculation: >10000.0000 VB.NET calculation: 1346.5033 VB.NET calculation: 1051.7918 1,000,000 prime numbers 1,000,000 prime numbers ---------------------------------- ---------------------------------- AutoIt calculation: >10000.0000 AutoIt calculation: >10000.0000 Python calculation: >10000.0000 Python calculation: >10000.0000 VB.NET calculation: 2011.5523 VB.NET calculation: 1567.1886 2,500,000 prime numbers 2,500,000 prime numbers ---------------------------------- ---------------------------------- AutoIt calculation: >10000.0000 AutoIt calculation: >10000.0000 Python calculation: >10000.0000 Python calculation: >10000.0000 VB.NET calculation: 7297.9896 VB.NET calculation: 5667.4302 5,000,000 prime numbers 5,000,000 prime numbers ---------------------------------- ---------------------------------- AutoIt calculation: >10000.0000 AutoIt calculation: >10000.0000 Python calculation: >10000.0000 Python calculation: >10000.0000 VB.NET calculation: 19501.3542 VB.NET calculation: 15133.7115 10,000,000 prime numbers 10,000,000 prime numbers ---------------------------------- ---------------------------------- AutoIt calculation: >10000.0000 AutoIt calculation: >10000.0000 Python calculation: >10000.0000 Python calculation: >10000.0000 VB.NET calculation: >10000.0000 VB.NET calculation: >10000.0000 16,000,000 prime numbers 16,000,000 prime numbers ---------------------------------- ---------------------------------- AutoIt calculation: >10000.0000 AutoIt calculation: >10000.0000 Python calculation: >10000.0000 Python calculation: >10000.0000 VB.NET calculation: >10000.0000 VB.NET calculation: >10000.0000 The measurements in the left column are carried out on a Windows 7, medium, 6½ year old PC. The measurements on the right on a Windows 10, medium (high end), 1½ year old PC. A comparison of AutoIt and Python code shows that AutoIt performs best for a small number of prime numbers. This is due to an overhead when passing data from Python to AutoIt. When calculating about 7,500 prime numbers and higher, Python code becomes faster than AutoIt code. Up to about 3 times faster in these measurements. This is probably due to differences in AutoIt and Python code interpreters. The performance optimization when using real compiled VB.NET code is quite clear. Up to 100 and 300 times faster than Python and AutoIt code respectively. Both Python and VB.NET code perform about 25% better on newer hardware. AutoIt code shows the same performance on old and new hardware. The lack of optimization can probably only be attributed to the Windows 10 operating system. Python and VBScriptExamples\PythonVBScript\ shows the exchange of array data between Python and VBScript through a ROT object created by an AutoIt server. Note the simplicity of the code. Open a command prompt and run the 5 scripts in a similar way: C:\>d: D:\>cd D:\...\Examples\PythonVBScript D:\...\Examples\PythonVBScript>subst z: . D:\...\Examples\PythonVBScript>z: Z:\>"0) Server.au3" Z:\>"1) Python send.py" Z:\>"2) VBScript rec.vbs" Z:\>"3) VBScript send.vbs" Z:\>"4) Python rec.py" (123, 456.789, 'String') 123 <class 'int'> 456.789 <class 'float'> String <class 'str'> Z:\> Z:\>d: D:\...\Examples\PythonVBScript>subst z: /d 1) Python send.py: import win32com.client # Get default ROT-object (Dictionary object) oDict = win32com.client.GetObject( "DataTransferObject" ) # Add 1d List to oDict aArray1 = [ 123, 456.789, "String" ] oDict[ "aArray1" ] = aArray1 2) VBScript rec.vbs: 'Get default ROT-object (Dictionary object) Set oDict = GetObject( "DataTransferObject" ) aArray1 = oDict( "aArray1" ) MsgBox( "aArray1(0) = " & aArray1(0) & vbTab & vbTab & "Variant type = " & VarType( aArray1(0) ) & " (vbLong)" & vbCrLf & _ "aArray1(1) = " & aArray1(1) & vbTab & "Variant type = " & VarType( aArray1(1) ) & " (vbDouble)" & vbCrLf & _ "aArray1(2) = " & aArray1(2) & vbTab & vbTab & "Variant type = " & VarType( aArray1(2) ) & " (vbString)" & vbCrLf ) This is the MsgBox created by 2) VBScript rec.vbs: 7z-file The 7z-file contains source code for UDFs and examples You need AutoIt 3.3.16.1 or later. Tested on Windows 7 and Windows 10. Comments are welcome. Let me know if there are any issues. AutoItPython.7z
    2 points
  5. smbape

    OpenCV v4 UDF

    Hi @malcev The environment variable is intended to override the embeded manifest. It is not needed for scripting languages, but for compiled languages. That being said, I kept it just in case. For example, to use registration-free COM at compile time for opencv and mediapipe, the manifest used for activation context must have all the dependencies. Since each of the libraries has its own manifest, environment varaibles are a way to reduce the complexity of specifying a manifest per library. The following manisfest was put in a file <?xml version="1.0" encoding="UTF-8" standalone="yes"?> <assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0"> <assemblyIdentity type="win32" name="mediapipe.sxs" version="0.3.0.0" /> <dependency> <dependentAssembly> <assemblyIdentity type="win32" name="autoit_opencv_com470.sxs" version="2.3.1.0" /> </dependentAssembly> </dependency> <dependency> <dependentAssembly> <assemblyIdentity type="win32" name="autoit_mediapipe_com-0.9.1-470.sxs" version="0.3.0.0" /> </dependentAssembly> </dependency> </assembly> and the environment variables point to that file, like in this c# example https://github.com/smbape/node-autoit-mediapipe-com/blob/main/autoit-mediapipe-com/test/test.cs#L242
    2 points
  6. [New Version] - 27 Jan 22 New: The GUIScrollbar_Ex UDF now recognises Win-D and taskbar desktop clearance commands and runs the correct minimize/restore code automatically. The previous UDF _Minimize and _Restore commands have been superceded by a single _EventMonitor function which runs in the script idle loop. This is a script-breaking change, but I hope that the additional functionality is worth the small effort it will take to alter your scripts. New UDFs, examples in zip file below. Previous changes: Changelog.txt Are you bemused by scrollbars? > Do you find them too difficult to use? > Then you need the GUIScrollbars_Ex UDF! Just download the zip at the end of the post and run this short script with the UDF in the same folder. No tricky calculations, no complicated functions to master - just easy to use, accurate scrollbars with one command! [size=5]#include <guiconstantsex.au3> #include "GUIScrollbars_Ex.au3" ; Create GUI with red background $hGUI = GUICreate("Test", 500, 500) GUISetBkColor(0xFF0000, $hGUI) ; Create a 1000x1000 green label GUICtrlCreateLabel("", 0, 0, 1000, 1000) GUICtrlSetBkColor(-1, 0x00FF00) GUISetState() ; Generate scrollbars - Yes, this is all you need to do!!!!!!!!!!!!!!!!!!!! _GUIScrollbars_Generate($hGUI, 1000, 1000) While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE Exit EndSwitch WEnd[/size] Try it today and see how easy it is! I have been trying for some time to understand how scrollbars work and how to get them closely to match the area I want to display. After much research and headscratching I have come up with 2 UDFs which I hope will be of use to others. Apologies for the length of this post, but scrollbars are complex beasts and as I did this mainly for the less experienced user I want to make sure that they understand what is going on. The 2 UDFs are: GUIScrollbars_Ex.au3 - This gives you scrollbars sized to your GUI in one simple command - with no other includes or commands needed. The UDF is designed for those who would not normally use scrollbars because the whole process looks too complicated. It also includes a command to enable you to scroll page by page, thus making it easy to scroll to anywhere on the GUI with only simple calulations based on the values you used to create the GUIs. [New] Ability to have recalculated scrollbars on resizeable GUIs. GUIScrollbars_Size.au3 - This calculates the Page and Max numbers for the user to feed into the _GUIScrollbar_SetScrollInfoPage/Max commands. The UDF is aimed at the more experienced user and is particularly useful when you have a GUI with a dynamic scroll size (i.e. adding or subtracting controls to the scrollable area as the script runs). First, a short tutorial for those who are interested in how the scrollbars affect your GUI and what it is that the UDFs calculate: All the files mentioned here are in a downloadable zip file at the end of the post. GUIScrollbars_Size.au3 As mentioned previously, the GUIScrollbars_Size.au3 UDF is aimed at the more experienced user who wants to use the full range of _GUIScrollbar comands, but would like a quick way of getting the required Page and Max values. It uses no other include files so you will need to include GUIScrollbars.au3 yourself, as well as the necessary GUIRegisterMsg and procedures for WM_VSCROLL and WM_HSCROLL. The syntax is simple - the size of the scrollable GUI and either the handle of the GUI you have created to hold the scrollbars or the size of the one you are going to create. It returns a 6-element array including the Page and Max values for the scrollbars and factors to compensate for the "shrinkage" of the GUI if you had already drawn some controls and wished to add others. Of interest, the returned Max value is biased not to clip the edges of the GUI - reducing it by 1 makes a tighter fit but can lead to some clipping. (If that does not make sense, please see the tutorial above for more details) The Size_Example_1 script to show the UDF in action - the "Pass Size" button shows the effect of creating the scrollbars BEFORE the controls, the "Pass Handle" button shows what happens if the scrollbars are created AFTER the controls. If you do not understand why there is a difference - go and read the tutorial above ! You will need to have the GUIScrollbar_Size.au3 UDF in the same folder. Where this UDF really helps is if you have a scrollable GUI of variable size - if the number of controls varies with user selections for example. All you need to do is to rerun the UDF with the new size of the scrollable GUI and it produces a new Max value for you to use. The Size_Example_2 script shows how the function enables you to dynamically size your scrollbars depending on the number of controls required. As before it requires the GUIScrollbar_Size.au3 UDF in the same folder. -------- Now the "simple" GUIScrollbars_Ex.au3 (which is actually the more complex internally as you would expect). This UDF is intended to be the single point of call for creating scrollbars on a GUI - it will automatically add the GUIScrollbars UDF and the WM_VSCROLL and WM_HSCROLL GUIRegisterMsg commands and procedures to your script - so you need no commands other than those within the UDF itself. These commands are _GUIScrollbars_Generate and _GUIScrollbars_Scroll_Page. As you might expect, _GUIScrollbars_Generate generates scrollbars for your GUI. It is usually called AFTER you have added all the controls and all you need to use it is the GUI handle and the size of the underlying GUI you want to scroll. If you so wish, you can also decide to generate the scrollbars BEFORE the controls on the scrollable GUI, and you can choose if you want to risk not quite reaching the edge of the GUI when the scrollbars are at the maximum position. So a basic call could be as simple as: _GUIScrollbars_Generate ($hGUI, 1000, 1000) which would put scrollbars on the $hGUI window allowing a 1000x1000 underlying GUI to be displayed. _GUIScrollbars_Scroll_Page lets you scroll a page at a time. If your GUI was 200 pixels wide, you would have 1000/200 = 5 pages to scroll before reaching the edge - no need to know what the actual Page and Max values are, just use this simple division based on the number you use to draw the GUIs. So: _GUIScrollbars_Scroll_Page ($hGUI, 3) would scroll to the third page - it would display the area between 400 and 600 pixels of the full 1000 pixel width. If you ask for a page over the maximum available, you just scroll to the maximum position - asking for page 1 resets you to the origin. Ex_Example_1 shows the UDF working. You can decide whether to have both or just one scrollbar, whether to create the scrollbars before or after the controls, and whether you want the maximum scroll to be tight to the edge or leave a border. Just select the options you want - the script selects a random width and height for both the scrollbar GUI and the underlying GUI - and press the "Scroll" button to show a single page scroll down and/or right followed by a scroll to the bottom right corner of the GUI. There are labels to let you see the size of the GUI and the accuracy of the page scrolls (please read the tutorial above to understand why these are almost certainly inaccurate). The script requires the GUIScrollbars_Ex.au3 UDF in the same folder. Ex_Example_2 is a really simple example to show how easy generating scrollbars can now become! As you can see - no other includes, no GUIRegisterMsg commands, no WM_H/VSCROLL procedure functions. Just accurate scrolling and proportional thumb sizes. Ex_Example_3 shows the automatic calculation of control positions. Ex_Example_4 shows how to initiate the cursor keys to scroll the GUI as well. [New] Ex_Example_5 shows how to use the new _GUIScrollbarsEx_Resizer function. I hope these 2 UDFs are useful to AutoIt users - I certainly find them so. Here is a zip file with the UDFs and examples: Scrollbars.zip My grateful thanks to the authors of the GUIScrollbars and WinAPI UDFs for their code, some of which I have plundered. And as always I welcome constructive criticism and/or effusive congratulations. M23
    1 point
  7. Yep, @pixelsearch is right. It is exactly what I am talking about. But I understand you @argumentum. It is not mandatory if you only have a single that popup in your script (like in my example and yours). But you need to specify which window you want to hide controls from if you have multiple windows. Just to make sure you do not create a false hide. Anyway, my intention was to provide robust code to @ahha. After that he can do what he wants.
    1 point
  8. Nine

    Hack of _ChooseFont()possible?

    @argumentum @ahha The reason I have added the title of the _ChooseFont window is that it is highly possible that, for a given script, many popups like this could be shown. You do not want to hide by error controls in other windows and create a bug not easily solvable.
    1 point
  9. Dan_555

    GhostGui

    Actually it does not fix the problem. With the addition the 100% scaling is not ok, but it is ok with 125%. Without the addition the 100% scaling is ok, but not with 125%. (haven't tested the higher scaling.) p.s. i have a dual monitor setup. so whenever a cloned screen is on (im playing on the xbox on the other monitor), the scaling setting is set to go to 125. The smaller monitor is the primary monitor in that case, so the scaling is always 125%. In extended mode, the primary monitor is 125% and secondary is 100% ...
    1 point
  10. A good list of available GUI creators can be found here:
    1 point
  11. I guess you could use it as a prototyping tool and then just base your designs off of that. I find it easier just to learn how to do it. How hard can it be to come up with a user interface? The back end of the application is the meat and potatoes. The gui is just window dressing. I will say in my experience as a developer I’ve seen tons of horrible graphical user interfaces
    1 point
  12. @argumentum- Done. And thanks again @Nine
    1 point
  13. @Nineand @argumentumThanks so much, a perfect answer. Exactly what I wanted. Giving solution to argumentum because I did not know about "Police" in French and I don't know how to credit you both.
    1 point
  14. smbape

    OpenCV v4 UDF

    I thought about it, but there are cases where the current activation context changes and that's because the activation contexts are per thread. When a callback registered with DllCallbackRegister is called, the activation context changes. Therefore, creating objects (in a c++ method or in autoit) will no longer work since the current activation context is not the one that contains the information about the COM objects. There is also the case where different activation contexts are needed for different objects. For example if you use opencv and mediapipe at the same time. To handle such a case, the manifest used for activation must have all dependencies, i.e. opencv and mediapipe. But this is not enough, because the use in callbacks will not work. From Microsoft about Isolating Components Activating before creating an object (_OpenCV_ObjCreate) or before calling a method/property (c++ GetTypeInfo/GetIDsOfNames/Invoke) ensures that the library objects always work. Deactivating the context ensures that the library does not perturb the the environment of the hosting application.
    1 point
  15. $nCode = 5 is sufficient, I don't see a need to match the title in my testing.
    1 point
  16. Yes my extension does have an option you can apply in your user or workspace settings named autoit3.userDefinedLibraries It does however not affect the registry value, that the AutoIt3 runtime uses to resolve included files from user included folders. and for 3 reasons. As always, it breaks web compatibility. It breaks the any OS supported promise. It needs some hacky nodejs specific JavaScript code to even be able to read from the windows registry (more info here) You can see the configuration options available for my extension if you open the extension store page in vscode and look under the Feature Contributions tab: True, but it is not something i currently am planing to pursue currently. But if it ends up being a repeat request from users, i will be forced to look into it i guess
    1 point
  17. Nice. Is there a way to specify a "user include folder" ala SciTE Config so that the extension can locate the include files without needing to supply the full path? Perhaps this functionality is already in VSCode and I need to spend more time with it to better learn its settings. Just opened my first issue. 😉 Ideally, we could have a single extension that was able to identify when it was running in a browser and adjust accordingly.
    1 point
  18. This is implemented without the use of a command by the document link provider feature like so: As you can see, hover will give you the path information and a simple ctrl+click is all that is needed for opening the file I don't mind this feature, for people expecting to work on AutoIt3, the way they always have What my extension eventually will support is a almost 1 to 1 implementation of the DocBlock in languages like JavaScript (jsdoc) and PHP (phpdoc). But this feature is good for anyone who prefer the standard, so if you want it, it is a welcome addition This one is a no go for 2 reasons: The limitation of the web extension support prevents spawning processes from a file path, so the chm links would only be displayed in the editor as information, and a manual copy/paste would be required to find the file on disk. I'm trying to push for a better in editor code documentation experience with the not yet implemented DocBlocks and online documentation for found in the same place as the hosted code, for documentation that needs more than in code documentation can offer. If the second reason sounds like something you consider bad or wrong, i am happy to discuss it further Alright looking forward to your help, making a better product It's more of a problem with the webpack and typescript transpiling. It is being transpiled as a in browser script (webworker to be precise), so node enviroment modules and functions are either not available, or is poly-filled with a browser alternative implementation. As a result, the compile command won't let me transpile without changing the target runtime enviroment to node, resulting in the code crashing when running in a web context, even if i pretended like it could via my package.json file. A compromise some make is a extension with partial features available in web browsers, but i can't find much documentation for a working example with this and also feel like it would result in more and more features being excluded from the web extension runtime, not ideal in my opinion
    1 point
  19. Yes, if you name a variable as a function parameter or Local the same name as a Global variable, the function will use your Local version instead, and will not access/update/change/whatever to the Global variable. The Global variable basically will not exist while that function runs. I recommend that you check out this page: https://www.autoitscript.com/wiki/Best_coding_practices It has some naming tips for variables, such as $g_iSomeVar for a Global variable, and $iSomeVar for the local version. Your change of $xfile works, but what is x? Does it have any meaning? If it works for you, great, otherwise going along with a standard is a good idea, if you can (IMO).
    1 point
  20. Hi @SOLVE-SMART Many thanks! This will help me a lot, for knowing what to focus on 😃 Hi @Danp2 Great question! I will absolutely need to document a road map soon, to better prioritize features, and help people see what's to come! My goal so far, have been to have the "common" features available, that most other language extensions provide, like: Syntax checking Function/variable declaration lookup Information on hover for functions, variables, macro's, etc... Basic type checking (both in function calls and with operator usage) DocBlock support Reference lookup Proper working call signature information General intellisense (undefined varaibles, unreachable code) But the list above is only for this extension. I have MANY plans for the AutoIt3 language Originally i intended to have the debugger in this extension, but i could not find a way to do that without removing web extension runtime support. Reluctantly it was moved to it's own extension, to have it both ways. 😩 I always welcome suggestions and pull requests, but looking at the pull requests opened on https://github.com/loganch/AutoIt-VSCode/ I am not sure i see many currently applying to my extension (i might just not yet know/understand some issues you might have found in my extension already ) I think i need to explicitly say that importantly this extension does not use regular expressions to parse AutoIt3. Instead a generated parser is being used, based on a grammar file in the pegjs/peggyjs language/syntax. Whilst i agree the supported grammar syntax resembles regex a lot, it is an important difference to keep in mind
    1 point
  21. https://github.com/MicrosoftEdge/WebView2Announcements/issues/61
    1 point
  22. eukalyptus

    BigNum UDF

    UDF to perform calculations with big numbers _BigNum_Parse _BigNum_Add _BigNum_Sub _BigNum_Mul _BigNum_Div _BigNum_Pow _BigNum_SQRT _BigNum_n_Root _BigNum_Mod _BigNum_Round _BigNum_Compare EDIT: updated BigNum.au3 BigNum_example.au3 #include "BigNum.au3" $X = "10000000000000000000" $Y = "0.000000000000000001" MsgBox(0, "Addition", $X & " + " & $Y & " = " & _BigNum_Add($X, $Y)) $X = "-10000000000000000000" $Y = "10000000000000000000" MsgBox(0, "Subtraction", $X & " - " & $Y & " = " & _BigNum_Sub($X, $Y)) $X = "10000000000000000001" $Y = "-0.0000001" MsgBox(0, "Multiplication", $X & " x " & $Y & " = " & _BigNum_Mul($X, $Y)) $X = "10000000000000000000" $Y = "3" MsgBox(0, "Division, 10 Decimalplaces", $X & " / " & $Y & " = " & _BigNum_Div($X, $Y, 10)) MsgBox(0, "Division & Modulo", $X & " / " & $Y & " = " & _BigNum_Div($X, $Y) & @CRLF & "Mod: " & _BigNum_Mod($X, $Y))
    1 point
×
×
  • Create New...