ur Posted May 26, 2017 Share Posted May 26, 2017 Is there anyway to create an assembly for AutoIT so that I can use that in Powershell or Dotnet supported languages like c#. Like I want to use the functionality of _ArrayDisplay of AutoIT in C# by creating a assmbly/library and using that in the target language. Link to comment Share on other sites More sharing options...
junkew Posted May 26, 2017 Share Posted May 26, 2017 Not sure what you want but this comes close But then you start in AutoIt FAQ 31 How to click some elements, FAQ 40 Test automation with AutoIt, Multithreading CLR .NET Powershell CMDLets Link to comment Share on other sites More sharing options...
ur Posted May 26, 2017 Author Share Posted May 26, 2017 How to create a library in AutoIT so that we can use this dll or library in other programming languages. Link to comment Share on other sites More sharing options...
TheDcoder Posted May 26, 2017 Share Posted May 26, 2017 It is not possible to create a Dynamic Link Library since AutoIt is interpreted, not compiled to machine code EasyCodeIt - A cross-platform AutoIt implementation - Fund the development! (GitHub will double your donations for a limited time) DcodingTheWeb Forum - Follow for updates and Join for discussion Link to comment Share on other sites More sharing options...
anthonyjr2 Posted May 26, 2017 Share Posted May 26, 2017 If you want to use AutoIt in C#/.NET you can at least use this: UHJvZmVzc2lvbmFsIENvbXB1dGVyZXI= Link to comment Share on other sites More sharing options...
junkew Posted May 26, 2017 Share Posted May 26, 2017 With CLR.AU3 as given earlier there is an example: .NET GUI Form Controls & Events 2.au3 that shows how to catch events sent from the C# class So the approach could be 1. Build an exe with AutoIt which hosts the clr (by using clr.au3) and has the needed udf's of AutoIt in it 2. The C# assembly that is loaded by step 1 communicates with c# assembly / exe from step 3 3. The C# exe you made yourself So although its not a dll created in step 1 in step 3 you could also start the exe of step 1 that was build with AutoIt3. Its an area nobody has been investigating but with WCF https://msdn.microsoft.com/en-us/library/ms731184.aspx @Danyfirex is in this area the most knowledgable person I feel. Maybe he can add his thought on this. FAQ 31 How to click some elements, FAQ 40 Test automation with AutoIt, Multithreading CLR .NET Powershell CMDLets Link to comment Share on other sites More sharing options...
Danyfirex Posted May 26, 2017 Share Posted May 26, 2017 I'm really no interested in this kind of stuff. ( But maybe I read later) I would prefer don't spend so much time doing that. You probably want to do something easier to avoid a lot of variable type casting. Some suggestions. 1. Build your _arrayDisplay In each lenguage you want to use (I think would no be hard using PowerShell r C#) 2. Create a Commandline tool where you can pass maybe a file path with your data written from your PS or C# app and parse/show with arraydisplay. Saludos Danysys.com AutoIt... UDFs: VirusTotal API 2.0 UDF - libZPlay UDF - Apps: Guitar Tab Tester - VirusTotal Hash Checker Examples: Text-to-Speech ISpVoice Interface - Get installed applications - Enable/Disable Network connection PrintHookProc - WINTRUST - Mute Microphone Level - Get Connected NetWorks - Create NetWork Connection ShortCut Link to comment Share on other sites More sharing options...
junkew Posted May 27, 2017 Share Posted May 27, 2017 With AutoIt object I remember they registered to the running object table and as such AutoIt could act as a com server. I would classify that in the area advanced++ topics and probably not the right solution to your problem FAQ 31 How to click some elements, FAQ 40 Test automation with AutoIt, Multithreading CLR .NET Powershell CMDLets Link to comment Share on other sites More sharing options...
LarsJ Posted May 28, 2017 Share Posted May 28, 2017 (edited) Here is some simple code for a start. You can find it all in the zip below. Run CSharpArrayDisplay.au3 or CSharpArrayDisplayEx.au3 from SciTE. expandcollapse popup;#AutoIt3Wrapper_UseX64=y #include <Array.au3> #include <WinAPI.au3> #include <WinAPIDlg.au3> #include "Includes\CLR.au3" ArrayDisplay() Func ArrayDisplay() Local $sFile = _WinAPI_OpenFileDlg( "Open C# source file", @WorkingDir, "C# source file (*.cs)", 1, "", "", BitOR( $OFN_PATHMUSTEXIST, $OFN_FILEMUSTEXIST, $OFN_HIDEREADONLY ) ) If @error Then Return ConsoleWrite( "Open file ERR" & @CRLF ) ConsoleWrite( "Open file OK" & @CRLF ) ; Get .NET Dll-references Local $aSrcArray, $aSplit, $sReferences = "System.dll" $aSrcArray = FileReadToArray( $sFile ) For $i = 0 To UBound( $aSrcArray ) - 1 If StringInStr( $aSrcArray[$i], "using " ) = 1 Then $aSplit = StringSplit( $aSrcArray[$i], "using ", 3 ) ; 3 = $STR_ENTIRESPLIT + $STR_NOCOUNT $aSplit = StringSplit( $aSplit[1], ";", 2 ) $aSplit[0] = StringStripWS( $aSplit[0], 7 ) ; 7 = $STR_STRIPLEADING + $STR_STRIPTRAILING + $STR_STRIPSPACES If $aSplit[0] = "System" Then ContinueLoop $sReferences &= " | " & $aSplit[0] & ".dll" ElseIf $aSrcArray[$i] = "class ArrayDisplayClass" Then ExitLoop EndIf Next If $i = UBound( $aSrcArray ) Then Return ConsoleWrite( "ArrayDisplayClass ERR" & @CRLF ) ConsoleWrite( "ArrayDisplayClass OK" & @CRLF ) Local $oAssembly, $oArrayDisplayClass, $aArray $oAssembly = _CLR_CompileCSharp( FileRead( $sFile ), $sReferences ) If Not IsObj( $oAssembly ) Then Return ConsoleWrite( "$oAssembly ERR" & @CRLF ) ConsoleWrite( "$oAssembly OK" & @CRLF ) $oAssembly.CreateInstance( "ArrayDisplayClass", $oArrayDisplayClass ) If Not IsObj( $oArrayDisplayClass ) Then Return ConsoleWrite( "$oArrayDisplayClass ERR" & @CRLF ) ConsoleWrite( "$oArrayDisplayClass OK" & @CRLF ) $aArray = $oArrayDisplayClass.ArrayDisplay() _ArrayDisplay( $aArray, "", "", 8 ) EndFunc This is your own original C# code where you want to display an array. Note that the original source file is the a-version. Eg. IntArray-a.cs: using System; class MyClass { public void MyMethod() { int[] MyArray = new [] { 1, 2, 3 }; } } To display the array with _ArrayDisplay or _ArrayDisplayEx you have to add a few lines of code to the original source. Here the code is added to IntArray.cs: using System; class ArrayDisplayClass { public int[] array; public int[] ArrayDisplay() { MyMethod(); return array; } public void MyMethod() { int[] MyArray = new [] { 1, 2, 3 }; array = MyArray; } } You can find a handful of examples in the zip file. DisplayCSarray.7z Edited May 28, 2017 by LarsJ Danyfirex 1 Controls, File Explorer, ROT objects, UI Automation, Windows Message MonitorCompiled code: Accessing AutoIt variables, DotNet.au3 UDF, Using C# and VB codeShell menus: The Context menu, The Favorites menu. Shell related: Control Panel, System Image ListsGraphics related: Rubik's Cube, OpenGL without external libraries, Navigating in an image, Non-rectangular selectionsListView controls: Colors and fonts, Multi-line header, Multi-line items, Checkboxes and icons, Incremental searchListView controls: Virtual ListViews, Editing cells, Data display functions Link to comment Share on other sites More sharing options...
junkew Posted June 14, 2017 Share Posted June 14, 2017 And as wonderfull reference LarsJ gave https://www.autoitscript.com/forum/topic/188907-pass-the-value-of-checked-box-from-autoit-to-vbscript/#comment-1357209 Danyfirex 1 FAQ 31 How to click some elements, FAQ 40 Test automation with AutoIt, Multithreading CLR .NET Powershell CMDLets Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now