Leaderboard
Popular Content
Showing content with the highest reputation on 10/24/2021 in all areas
-
The .NET IntPtr type is useful for copying data in the form of memory blocks between managed .NET code and unmanaged AutoIt code. An advantage of using this technique is that the data copying isn't subject to internal AutoIt COM conversions. This means that even copying large memory blocks can be done very fast. A disadvantage is that such memory blocks can only be handled through DllStructs in AutoIt, unless the memory blocks can be used directly eg. if they represent image data. Another technique for passing data between AutoIt and C#/VB.NET is demonstrated in Using C# and VB Code. With this technique, variables and arrays are exchanged through comparable COM data types. Eg. passing an AutoIt array to .NET as a safearray of variants. On the AutoIt side the safearray of variants is created through internal AutoIt COM conversions. On the .NET side data is received as an array of objects. Although the COM conversions are performed by internal AutoIt functions as compiled C/C++ code, the conversions take some time for large arrays. Since AutoIt arrays are limited to 2^24 = 16,777,216 elements, this is the maximum amount of data that can be passed at one time. DotNetAll.au3 UDFCommon to the two techniques is that they are both based on DotNetAll.au3 UDF (contained in the 7z-file below). The DotNetAll.au3 UDF is by far the easiest way to execute compiled and multi-threaded code in AutoIt through C# or VB.NET code, thereby managing bottlenecks in the AutoIt code. With this new IntPtr data copying technique, it's possible to handle more bottlenecks than can be handled with the existing COM data passing technique. The benefits of the DotNetAll.au3 UDF are: The .NET source code can be easily written in SciTE without the need for a specific development tool The .NET code is compiled and executed directly in your AutoIt script, where you apply the code If the AutoIt script is run in SciTE with F5, .NET error messages appear in the console The .NET code can be easily distributed in the form of source files (text files) You avoid the registration/unregistration tyranny of .NET assembly Dll files Although DotNetAll.au3 UDF contains a lot of code, it's a complete UDF in the way that you can concentrate on the main functions. There's no need to go through all the details of the code. There are two main functions in the UDF. A function for loading C#/VB.NET code and a function for creating an object based on the C#/VB.NET class. In AutoIt, the functions are used as follows: Local $oNetCode = DotNet_LoadVBcode( FileRead( "Example01.vb" ), "System.dll" ) ; Load VB.NET code Local $oNetCode = DotNet_LoadCScode( FileRead( "Example02.cs" ), "System.dll" ) ; Load C# code Local $oTestClass = DotNet_CreateObject( $oNetCode, "TestClass" ) ; Create object Then just call the object methods and get/set the object properties. This is demonstrated in the examples below. ExamplesThe examples can be found in the Examples folder. All examples use the DotNetAll.au3 UDF, which is located in the Includes folder. It's the only file in Includes. Only the Introductory examples demonstrates C# code. Since VB.NET code is most easily accessible with an AutoIt background, the rest of the examples are shown only as VB.NET code. Note that in all examples, all memory allocation and all data copying is performed exclusively in the .NET code. Run the examples with F5 in SciTE. Memory Access Violation error The Introductory examples and Performance measurements all caused a Memory Access Violation error and a consequent crash in the first version of the examples when executed on Windows 10 as 64 bit code. This is because the IntPtr data type isn't handled correctly in AutoIt on Windows 10 as 64 bit code. This applies to all AutoIt versions including the current beta. The usual workaround is to return the IntPtr as a string. This error occurs when IntPtr is a void memory pointer. However, the error does not occur if IntPtr refers to a memory block that represents a valid handle or HWnd memory block. This is because a handle and HWnd pointer by Microsoft definition is a 4 byte pointer in both 32 and 64 bit code. In 64 bit code, the 4 most significant bytes are therefore all zeros. Thus, there are no errors in the Image manipulation examples. The function definition and return lines therefore looks like this in the published version in the 7z-file of the Introductory examples and Performance measurements (VB.NET code): Public Function Test() As String ... Return pnt.ToString() And look like this in Image manipulation examples (VB.NET code): Public Function Test() As IntPtr ... Return hBitmap Introductory examplesWith the IntPtr technique, part of the code is based on the .NET Marshal Class. The introductory examples in \1) Examples\ demonstrate how to apply this class. Example01.au3 and Example01.vb show how to copy a memory block of 16 bytes from VB.NET to AutoIt: #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\DotNetAll.au3" Example() Func Example() ; Load .NET code, create object, execute method Local $oNetCode = DotNet_LoadVBcode( FileRead( "Example01.vb" ), "System.dll" ) Local $oTestClass = DotNet_CreateObject( $oNetCode, "TestClass" ) Local $pPtr = $oTestClass.Test() ; View data as a DllStruct of Bytes Local $tBytes = DllStructCreate( "byte[16]", $pPtr ) ; Display data For $i = 1 To 16 ConsoleWrite( StringFormat( "$tBytes[%2s]", $i ) & StringFormat( " = %3s", DllStructGetData( $tBytes, 1, $i ) ) & @CRLF ) Next EndFunc Imports System Imports System.Runtime.InteropServices Class TestClass Public Function Test() As String 'Create and fill aArray with values 97 - 112 Dim aArray(15) As Byte For i As Integer = 0 To 15 aArray(i) = i + 97 Next 'Allocate memory in unmanaged AutoIt code Dim size As Integer = Marshal.SizeOf( aArray(0) ) * aArray.Length Dim pnt As IntPtr = Marshal.AllocHGlobal( size ) 'Copy from VB.NET to AutoIt 'Copy data to unmanaged memory Marshal.Copy( aArray, 0, pnt, aArray.Length ) 'Return memory pointer to AutoIt Return pnt.ToString() End Function End Class Example02.cs is a C# version of the same code: using System; using System.Runtime.InteropServices; class TestClass { public String Test() { // Create and fill aArray with values 97 - 112 byte[] aArray = new byte[16]; for( int i = 0; i < 16; i++ ) { aArray[i] = (byte)(i+97); } // (byte) => cast to byte // Allocate memory in unmanaged AutoIt code int size = Marshal.SizeOf( aArray[0] ) * aArray.Length; IntPtr pnt = Marshal.AllocHGlobal( size ); // Copy from C# to AutoIt // Copy data to unmanaged memory Marshal.Copy( aArray, 0, pnt, aArray.Length ); // Return memory pointer to AutoIt return pnt.ToString(); } } The code in Example02.au3 is the same as the code in Example01.au3. Example03.au3, Example03.vb and Example04.cs show how to copy a memory block of 16 bytes from AutoIt to VB.NET/C#. Performance measurementsExample01.au3 in \2) Runtimes\ calls the same Example() function 4 times: #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\DotNetAll.au3" Example( 1000000, True ) ; 1,000,000 Example( 1000000 ) ; 1,000,000 Example( 16777216 ) ; 16,777,216 = 2^24 Example( 100000000 ) ; 100,000,000 Func Example( $iInts, $bDisplay = False ) ; Load .NET code, create object Local $oNetCode = DotNet_LoadVBcode( FileRead( "Example01.vb" ), "System.dll" ) Local $oTestClass = DotNet_CreateObject( $oNetCode, "TestClass" ) ; Pass number of integers to VB.NET code $oTestClass.Test0( $iInts ) ; Create and fill VB.NET integer aArray with $iInts elements ; Allocate memory through managed VB.NET code Local $pPtr = $oTestClass.Test1() ; Copy $iInts integers from .NET aArray to AutoIt Local $hTimer = TimerInit() $oTestClass.Test2() ConsoleWrite( @CRLF & "Time to copy " & StringRegExpReplace( $iInts, "(\d{1,3}(?=(\d{3})+\z)|\d{3}(?=\d))", "\1" & "," ) & _ " integers from .NET aArray to AutoIt" & ( $bDisplay ? " = " : " = " ) & TimerDiff( $hTimer ) & @CRLF ) $hTimer = 0 ; View aArray data as a DllStruct of Bytes Local $tUints = DllStructCreate( "uint[" & $iInts & "]", $pPtr ) ; Display data If $bDisplay Then For $i = $iInts/2 To $iInts/2+16 ConsoleWrite( "$tUints[" & $i & "]" & " = " & DllStructGetData( $tUints, 1, $i+1 ) & @CRLF ) Next ConsoleWrite( @CRLF ) EndIf ; Copy $iInts integers from AutoIt to .NET aArray2 $hTimer = TimerInit() $oTestClass.Test3() ConsoleWrite( "Time to copy " & StringRegExpReplace( $iInts, "(\d{1,3}(?=(\d{3})+\z)|\d{3}(?=\d))", "\1" & "," ) & _ " integers from AutoIt to .NET aArray2 = " & TimerDiff( $hTimer ) & @CRLF ) $hTimer = 0 ; Display aArray2 data If $bDisplay Then $oTestClass.Test4() If $iInts <= 16777216 And Not $bDisplay Then Local $aArray2 ; Pass $iInts integers from .NET aArray2 to AutoIt $aArray2 ; .NET aArray2 is returned from a method directly into AutoIt $aArray2 ; In this way aArray2 is passed as a safearray of integers through default marshalling ; Internal AutoIt COM conversions of the safearray converts it to a native AutoIt array $hTimer = TimerInit() $aArray2 = $oTestClass.Test5() ConsoleWrite( @CRLF & "Time to pass " & StringRegExpReplace( $iInts, "(\d{1,3}(?=(\d{3})+\z)|\d{3}(?=\d))", "\1" & "," ) & _ " integers from .NET aArray to AutoIt $aArray2 = " & TimerDiff( $hTimer ) & @CRLF ) $hTimer = 0 ; Pass $iInts integers from AutoIt $aArray2 to .NET aArray3 ; AutoIt $aArray2 is passed as a function parameter directly into .NET aArray3 ; Internal AutoIt COM conversions pass $aArray2 as a safearray of variants with variant type integer ; The safearray of variants is passed to .NET through default marshalling as an array of objects with object type integer $hTimer = TimerInit() $oTestClass.Test6( $aArray2 ) ConsoleWrite( "Time to pass " & StringRegExpReplace( $iInts, "(\d{1,3}(?=(\d{3})+\z)|\d{3}(?=\d))", "\1" & "," ) & _ " variants from AutoIt $aArray2 to .NET aArray3 = " & TimerDiff( $hTimer ) & @CRLF ) $hTimer = 0 EndIf ConsoleWrite( @CRLF ) EndFunc Imports System Imports System.Runtime.InteropServices Class TestClass 'Globals in class Dim pnt As IntPtr Dim iInts As Integer Dim aArray() As Integer Dim aArray2() As Integer Public Sub Test0( iElements As Integer ) 'Get number of integers iInts = iElements ReDim aArray( iInts-1 ) ReDim aArray2( iInts-1 ) End Sub Public Function Test1() As String 'Create and fill integer aArray with iInts elements For i As Integer = 0 To iInts-1 aArray(i) = i Next 'Allocate memory in unmanaged AutoIt code Dim size As Integer = Marshal.SizeOf( aArray(0) ) * aArray.Length pnt = Marshal.AllocHGlobal( size ) 'Return memory pointer to AutoIt Return pnt.ToString() End Function Public Sub Test2() 'Copy iInts integers from .NET aArray to AutoIt Marshal.Copy( aArray, 0, pnt, aArray.Length ) End Sub Public Sub Test3() 'Copy iInts integers from AutoIt to .NET aArray2 Marshal.Copy( pnt, aArray2, 0, iInts ) End Sub Public Sub Test4() 'Display aArray2 data For i As Integer = iInts/2 To iInts/2+15 Console.WriteLine( "aArray2({0}) = {1}", i, aArray2(i) ) Next End Sub Public Function Test5() As Integer() 'Pass iInts integers from .NET aArray2 to AutoIt Return aArray2 End Function Public Sub Test6( aArray3 As Object() ) 'Pass iInts variants from AutoIt to .NET aArray3 Dim iLength As Integer = aArray3.Length 'Console.WriteLine( "iLength = {0}", iLength ) End Sub End Class In the first example, time measurements are made and a few data are printed in the console. In the other 3 examples, only time measurements are performed. The text box below is console output for these 3 examples. The "copy" lines are time measurements for the new IntPtr data copying technique. The "pass" lines are time measurements for the old COM data passing technique. Time to copy 1,000,000 integers from .NET aArray to AutoIt = 1.72992070180921 Time to copy 1,000,000 integers from AutoIt to .NET aArray2 = 1.72077794345564 Time to pass 1,000,000 integers from .NET aArray to AutoIt $aArray2 = 45.4910409279733 Time to pass 1,000,000 variants from AutoIt $aArray2 to .NET aArray3 = 218.360099451047 Time to copy 16,777,216 integers from .NET aArray to AutoIt = 19.8287034959137 Time to copy 16,777,216 integers from AutoIt to .NET aArray2 = 23.0162015219091 Time to pass 16,777,216 integers from .NET aArray to AutoIt $aArray2 = 743.615722663014 Time to pass 16,777,216 variants from AutoIt $aArray2 to .NET aArray3 = 4165.03925567973 Time to copy 100,000,000 integers from .NET aArray to AutoIt = 118.826768001676 Time to copy 100,000,000 integers from AutoIt to .NET aArray2 = 115.565850855568 The results clearly show that the new copying technique is much faster than the old passing technique. In particular, passing arrays from AutoIt to .NET is slow with the old technique. With the new technique, very large amounts of data can be copied. The reason for the slow passing of AutoIt arrays to .NET is that AutoIt arrays can only be passed as safearrays of variants. And passing variants is time consuming. Not at least due to internal AutoIt COM conversions which perform a by value copy of all AutoIt array elements into variant structures in the safearray. Image manipulationExample01.au3 and Example01.vb in \3) Images\ shows how to load an image in VB.NET and display the image in AutoIt: #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 <GDIPlus.au3> #include <GUIConstantsEx.au3> #include "..\..\Includes\DotNetAll.au3" Example() Func Example() ; Load .NET code, create object, execute method Local $oNetCode = DotNet_LoadVBcode( FileRead( "Example01.vb" ), "System.dll | System.Drawing.dll" ) Local $oTestClass = DotNet_CreateObject( $oNetCode, "TestClass" ) Local $pBitmap = $oTestClass.Test() ; Create GUI Local $hGui = GUICreate( "GDI+ Through .NET", 240, 164 ) GUISetState( @SW_SHOW ) ; Initialize GDI+ _GDIPlus_Startup() ; Draw bitmap to GUI Local $hBitmap = _GDIPlus_BitmapCreateFromHBITMAP( $pBitmap ) Local $hGraphic = _GDIPlus_GraphicsCreateFromHWND( $hGui ) _GDIPlus_GraphicsDrawImage( $hGraphic, $hBitmap, 0, 0 ) ; Clean up resources _GDIPlus_GraphicsDispose( $hGraphic ) _GDIPlus_BitmapDispose( $hBitmap ) _WinAPI_DeleteObject( $pBitmap ) ; Shut down GDI+ _GDIPlus_Shutdown() ; Loop Do Until GUIGetMsg() = $GUI_EVENT_CLOSE EndFunc Imports System Imports System.Drawing Class TestClass Public Function Test() As IntPtr 'Create a bitmap Dim bmp As New Bitmap( "Test.bmp" ) 'Create a GDI bitmap Dim hBitmap As IntPtr = bmp.GetHbitmap() 'Return GDI bitmap Return hBitmap End Function End Class Note that at the bottom of Example01.vb, the GDI bitmap pointer (hBitmap) is passed directly from VB.NET to AutoIt without a copy of the corresponding memory block. This is because the memory layout for a GDI bitmap memory block is the same in .NET and AutoIt. The same GDI bitmap memory block can without any further be used in both .NET and AutoIt. Without data copying, the code is very fast. Example02.au3 (same as Example01.au3) and Example02.vb is an example of real image manipulation. However, simple image manipulation. It's the same image as above, which is a 24 bpp (bits per pixel) image. 8 bits or 1 byte is used per RGB color. In the example, all the red bytes are set to the value 255 so that the whole image gets a red expression. Imports System Imports System.Drawing Imports System.Drawing.Imaging Imports System.Runtime.InteropServices Class TestClass Public Function Test() As IntPtr 'Create bitmap Dim bmp As New Bitmap( "Test.bmp" ) 'Lock the bits in the bitmap Dim rect As New Rectangle( 0, 0, bmp.Width, bmp.Height ) Dim bmpData As BitmapData = bmp.LockBits( rect, ImageLockMode.ReadWrite, bmp.PixelFormat ) 'Get the address of the first line Dim ptr As IntPtr = bmpData.Scan0 'Declare an array to hold the bytes of the bitmap 'This code is specific to a bitmap with 24 bits per pixel (bpp) Dim iBytes As Integer = Math.Abs( bmpData.Stride ) * bmp.Height Dim aRGBValues(iBytes-1) As Byte 'Copy the RGB values into the array Marshal.Copy( ptr, aRGBValues, 0, iBytes ) 'Set every third value to 255, a 24bpp image will look red For i As Integer = 2 To aRGBValues.Length - 1 Step 3 aRGBValues(i) = 255 Next 'Copy the RGB values back to the bitmap Marshal.Copy( aRGBValues, 0, ptr, iBytes ) 'Unlock the bits bmp.UnlockBits( bmpData ) 'Create GDI bitmap Dim hBitmap As IntPtr = bmp.GetHbitmap() 'Return GDI bitmap Return hBitmap End Function End Class Posts below Post 2 and the following posts is a discussion of the possibilities of executing PowerShell commands and scripts directly in AutoIt, and returning PowerShell output back to AutoIt. This is possible through C# code that acts as a host to execute PowerShell commands and scripts. C# Pointers demonstrates the use of pointers to performance optimize C# code. Use of structures to transfer data between AutoIt and .NET. Struct arrays in .NET code 7z-fileThe 7z-file contains source code for UDFs and examples. You need AutoIt 3.3.12 or later. Tested on Windows 7 and Windows 10. Comments are welcome. Let me know if there are any issues. DotNetIntPtr.7z6 points
-
Place the Notepad ++ in the AutoIt3 folder Just replace the files in your Notepad++. The path must be "AutoIt3Notepad++" NotepadPlus.7z (v6.5.3 Ru, 4.9 Mb) shortcuts.xml, Contains commands: F5 - Start File (Alt + F5 - Setting) F6 - Start Script (ConsoleWrite) (Ctrl + F6 - Setting) Alt + F - Jump to function as a SciTE Alt+X - AutoIt3Wrapper (Ctrl + F6 - ConsoleWrite) Alt + Z - Tidy.exe %1 /refc /reel /bdir=C:AutoIt3BackUp Alt+i - Au3Info.exe Alt + R - ToolsRegExpRegExp.exe Alt + F1 (F2, F3) - HELP_AutoIt3.au3 Alt+F6 - Converter AU3 to BBcode Alt + F8 - list_var_funk.au3 Alt + Shift + A - txt2au3 Alt + G - JumpRegCMD Alt+Shift+D - Remove spaces Alt + K - Strip Comments Alt + L - Debugger Alt + F - JumpFunc Alt + N - CreateNewFile Alt + O - OpenToExplorer Alt + F7 - Renaming variables Ctrl + F7 - Include_Helper Ctrl + F9 - panel_function Ctrl + F12 - JumpToString Ctrl + 1 (2 ,3 ,4 ,5) - Set the color of the selected Ctrl + Shift + 1 (2 ,3 ,4 ,5) - Remove the color of the selected Ctrl + Shift + 0 - Remove the color of all selected langs.xml Added registered functions, operators and keywords themes AutoIt_Def.xml AutoIt+Zenburn.xml autoit.xml, batch.xml (for example enter "ms" and press "Enter") XBrackets.dll - sets closing brackets (disabled by default) NppExec.dll - Ctrl + F6 - for ConsoleWrite FunctionList.dll - List of functions NppSnippets.dll ScrollPastEOFUni.dll >JumpToString (Notepad++) >Include_Helper >Renaming variables >Debugger1 point
-
@CoffeeJoe your best source of information about SQLite is the official webpage. SQLite differs from most other modern RDBMS in that it's an embedded engine contrary to client-server designs: you link your application with the source and compile the whole cake, or build you app and use a DLL as we do with AutoIt. SQLite is by far the most prevalent RDBMS ever, is used by many embedded devices like routers, smart TVs, GPSes, your smartphone (many instances there), your PC (Windows 10 now comes with one SQLite DLL, your navigator(s) use it, your car is full of it, etc. None of these devices use a client-server design. Just like many websites use it with great success. That means that there are several basic points you need to be aware of. Think of SQLite in this context as a hyper-powerful fopen()/fread()/fwrite()/fclose() combination with a huge lot of goodies. SQLite tries to follow most of Postgress SQL features, yet keeping in mind the "lite" suffix.1 point
-
@Danyfirex You're 100% right. SUPER easy! Thanks. Instructions for anyone who searches for this in the future: 1) Activate Webhook by clicking on 'Connectors' in any chat channel.. Add Extension called "Webhooks", copy webhook value. 2) Paste into powershell either direct/via autoit after replacing the "URI" value with your webhook value, hit enter and success: 3) Visit link below for full details / better explanation https://petri.com/how-to-send-a-microsoft-teams-message-using-powershell-7 $JSONBody = [PSCustomObject][Ordered]@{ "@type" = "MessageCard" "@context" = "http://schema.org/extensions" "summary" = "Incoming Alert Test Message!" "themeColor" = '0078D7' "title" = "Incoming Alert Test Message!" "text" = "There was an alert and we should act on it." } $TeamMessageBody = ConvertTo-Json $JSONBody -Depth 100 $parameters = @{ "URI" = 'https://outlook.office.com/webhook/{GUID}@{GUID}/IncomingWebhook/{GUID}/{GUID}' "Method" = 'POST' "Body" = $TeamMessageBody "ContentType" = 'application/json' } Invoke-RestMethod @paramete rs | Out-Null1 point
-
Those aren't buttons. They are actually links (A elements) that are coded to appear as buttons. The xref I posted was correct for the webpage you previously listed. If this isn't valid for other pages, then you can add additional criteria, like this -- $sElement = _WD_FindElement($sSession, $_WD_LOCATOR_ByXPath, "//a[@type='button' and contains(text(),'Download') and contains(text(),'Subtitle')]")1 point
-
In that case, I would suggest doing it like this instead -- $sElement = _WD_FindElement($sSession, $_WD_LOCATOR_ByXPath, "//a[@type='button']") _WD_ElementAction($sSession, $sElement, "click")1 point
-
SQLite itself is a C library, the core of the RDBMS, while system.data.sqlite is an ADO.NET provider for SQLite. The former is due to Dr. Richard Hipp and maintained by SQLite dev team and the latter originates from Robert Simpson and is now maintained by Joe Mistachkin, a member of the team. The .NET wrapper follows the core SQLite development with a delay since eventual new SQLite APIs demand new code and anyway extra testing is required beyond the huge SQLite testing harnesses, see https://www.sqlite.org/testing.html system.data.sqlite comes as source code or a number of precompiled bundles, some offering both the legacy C and .NET interfaces (see https://system.data.sqlite.org/index.html/doc/trunk/www/downloads.wiki). That's why our AutoIt code or any C code can invoke either sqlite.dll or system.data.sqlite.dll transparently.1 point
-
Have you tried using _WD_LinkClickByText? _WD_LinkClickByText($sSession, "Download English Subtitle")1 point
-
Hi @Lion66 I am back, It took me longer than I expected. Seeing how it was hard to use the UDF, I managed to make a version that is almost as easy to use as in python There is a new implementation using COM. It is almost as easy as python to use Download and extract opencv-4.5.4-vc14_vc15.exe into a folder Download and extract autoit-opencv-4.5.4-com-v1.0.0-rc.0.7z into a folder Here is the rewrite. You will have to adjust the roi. I read everything as gray scale because I had errors otherwise. Probably not using the correct images. #Region ;**** Directives created by AutoIt3Wrapper_GUI **** #AutoIt3Wrapper_UseX64=y #EndRegion ;**** Directives created by AutoIt3Wrapper_GUI **** #include "..\autoit-opencv-com\udf\opencv_udf_utils.au3" _OpenCV_Open_And_Register(_OpenCV_FindDLL("opencv_world4*", "opencv-4.*\opencv"), _OpenCV_FindDLL("autoit_opencv_com4*")) Local $cv = _OpenCV_get() If IsObj($cv) Then $img1 = $cv.imread(_OpenCV_FindFile("samples\data\lena.jpg"), $CV_IMREAD_GRAYSCALE) $img2 = $cv.imread(_OpenCV_FindFile("samples\data\lena.jpg"), $CV_IMREAD_GRAYSCALE) $brows = $img1.rows $bcols = $img1.cols $rows = $img2.rows $cols = $img2.cols $channels = $img2.channels() ; A Rect is [x, y, width, height] ; img.rows == img.height ; img.cols == img.width ; Ниже я изменил roi, чтобы картинка выводилась посередине, а не в левом верхнем углу Local $rect[4] = [0 , 0, $bcols, $brows] $roi = ObjCreate("OpenCV.cv.Mat").create($img1, $rect) $img2gray = $img2; $cv.cvtColor($img2, $CV_COLOR_BGR2GRAY) $cv.threshold($img2gray, 10, 255, $CV_THRESH_BINARY) $mask = $cv.extended[1] $mask_inv = $cv.bitwise_not($mask) $img1_bg = $cv.bitwise_and($roi, $roi, $mask_inv) $img2_fg = $cv.bitwise_and($img2, $img2, $mask) $dst = $cv.add($img1_bg, $img2_fg) $dst.copyTo($roi) $cv.imshow('res.png', $img1) $cv.waitKey() EndIf _OpenCV_Unregister_And_Close()1 point
-
You can use an encrypted SQLite database by using a version of system.data.sqlite.dll <= 1.0.112.0 as more recent releases drop the encryption layer. Alternatively you can use any release of sqlite.dll and place the database on an encrypted volume/directory. Then access protection and password management is pushed back to the OS, making your life simpler as you noted. There are many advantages from using such a database: o) zero installation or maintenance required o) everything can be embedded inside your application o) the RDBMS engine gives you ACID properties for free o) it's powerful, fast and secure o) you can easily refactor your design, should your needs evolve over time o) it's portable accross any platform o) it's very well documented o) ...1 point
-
Send Message in Microsoft Teams
SkysLastChance reacted to Danyfirex for a topic
Probably the easier way is to use PowerShell Module because to write it from raw AutoIt you will probably need HTTP request knowledge. Saludos1 point