Recently Browsing 0 members
No registered users viewing this page.
I was looking for a way to use the CLR functions to check a SQL 2016 database state, but I've been unable to find an example that I can get to work. Any help would be appreciated. Here's what I have, which always errors when I try to set the connection string and I'm not sure why. Thanks!
#include ".\Includes\CLR.au3" #include ".\Includes\CLR Constants.au3" JustATest() Func JustATest() Local $oAssembly = _CLR_LoadLibrary("System.Data") ConsoleWrite("$oAssembly: " & IsObj($oAssembly) & @CRLF) Local $oSQLConn = _CLR_CreateObject($oAssembly, "System.Data.SqlClient.SqlConnection") ConsoleWrite("$oSQLConn: " & IsObj($oSQLConn) & @CRLF) $oSQLConn.ConnectionString = "Server=serverip;Database=dbname;UID=user;PWD=aaaa;" $oSQLConn.Open EndFunc Edit: I am using ptrex's CLR UDF from here:
WHAT : is .NET Common Language Runtime (CLR) Framework
The Common Language Runtime (CLR) is a an Execution Environment . Common Language Runtime (CLR)'s main tasks are to convert the .NET Managed Code to native code, manage running code like a Virtual Machine, and also controls the interaction with the Operating System.
As part of Microsoft's .NET Framework, the Common Language Runtime (CLR) is managing the execution of programs written in any of several supported languages. Allowing them to share common object-oriented classes written in any of the languages.
HOW : To access the CLR environment you need to create an Appdomain Object - _CLR_GetDefaultDomain()
An AppDomain provides an isolated region in which code runs inside of an existing process.
Application domains provide an isolation boundary for security, reliability, and versioning, and for unloading assemblies. Application domains are typically created by runtime hosts, which are responsible for bootstrapping the common language runtime before an application is run.
WHEN : Would you use CLR Runtime Hosts
1. To access .NET Class Libraries :
System System.Collections System.Data System.Drawing System.IO System.Text System.Threading System.Timers System.Web System.Web.Services System.Windows.Forms System.Xml 2. Accessing custom build .Net Assemblies :
Some Examples (but there are a ton out there)
AutoItX3 - The .NET Assembly for using AutoItX JSonToXML libr. XMLRPC Libr. .NETPDF libr. .NETOCR Libr WInSCP Libr. ... 3. To Compile .Net Code into an Assembly
4. To Run C# or VB.net Code
5. To Mix AU3 and .Net functionality in your Application
WHERE : To find documentation about CLR
First of all you can find a lot on MSDN and here : Post 4 & Post 6
EXAMPLES : Multiple examples included in Zip !!
Example : “System.Text.UTF8Encoding”
Example : “System.IO.FileInfo”
Example : “System.Windows.Forms”
Example : AutoItX3 Custom .NET Assembly AutoItX
Example : Compile Code C# and Code VB
Example : Compile Code C# at Runtime
WHO : Created the CLR.au3 UDF
All credits go to : Danyfirex / Larsj / Trancexx / Junkew
TO DO : The library is still Work in Process …
(Some of the GUI Controls are not yet working as expected...)
Anyone is free to participate in contributing to get the bugs resolved and to expand the CLR.au3 functionality ...
DOWNLOADS : (Last updated)
- added CLR Constants.au3 - Danyfirex
- Global Constants added (Magic numbers)
- added .NET CLR CreateObject vs ObjCreate Example.au3 - Junkew
• 2 approaches give the same result (only valid for COM Visible Assembly)
• Includes a function that shows you which Assembly Classes are COM Visible
- added .Net Conventional COM Objects Examples - ptrex
- added .NET CLR CreateComInstanceFrom Example - Danyfirex
- You can use it for Regfree COM Assembly Access
- System.Activator has 4 methods :
• CreateComInstanceFrom : Used to create instances of COM objects.
• CreateInstanceFrom : Used to create a reference to an object from a particular assembly and type name.
• GetObject : Used when marshaling objects.
• CreateInstance : Used to create local or remote instances of an object.
- added .NET Access SafeArrays Using AccVarsUtilities Example - LarsJ
- added SafeArray Utilities functions in Includes - LarsJ
- added .NET Access Native MSCorLib Classes - System - ptrex
Multiple System Class Examples :
- added Third Party Assembly Access - ptrex
• WinSCP : https://winscp.net/eng/download.php
• IonicZip : http://dotnetzip.codeplex.com/
- added more Examples using PowerShell GUI Assembly Access - ptrex
• GUI Ribbon .NET Assembly using CLR Library
• GUI Report Designer .NET Assembly using CLR Library
• GUI SSRS Reporting .NET Assembly using CLR Library
.NET CLR Framework for AutoIT.pdf
hello sirs, please i created a tool witch get the focused control in a window and play a audio file linked with this controls
e.g buttons, checkBoxes, radios, comboboxes, and others
i know that their is a function that give us the control focus but it return the classNN
i want to get the class name to use it with a switch and
because their are more than class e.g button tbutton timagebutton tnewButton...
please can any one help me to get the class name not the classnn
thanks in advance
Hello my friends
Can we create a single context menu on more than one item?
For example, a context menu includes standardized options on more than one control, such as buttons or check boxes
to Create a context menu on one item am using this function
GUICtrlCreateContextMenu ($ HWND)
How to link it with more than one element please?
or if we can't do that, please give me a solution
so i tried to add an context menus to all the controls but the script will be long, for that if their are any solutions i hope to give it to me
thanks in advanced
Is there a (simple) way to make your script using a picture-control to resize the gui?
This would be useful for a transparant pop-up window with a custom made theme using picture controls:
$Form = GUICreate('', 301, 173, 5, 5, $WS_POPUP, BitOR($WS_EX_LAYERED, $WS_EX_TOPMOST)) GUICtrlCreatePic(@scriptdir & "\resize_win.bmp", 0, 73, 20, 51) ; some api call or code telling the os to use this picture as a resize border GUICtrlSetResizing(-1, $GUI_DOCKLEFT+$GUI_DOCKTOP+$GUI_DOCKBOTTOM+$GUI_DOCKWIDTH+$GUI_DOCKHEIGHT) GUISetState(@SW_SHOW) While True if GUIGetMsg() = $GUI_EVENT_CLOSE then Exit WEnd
EDIT: to make it more clear what i wanna do, if you go with the mouse arrow over the border of a re-sizable window the arrow changes to a "resize" arrow, you click and drag the border and then the window size adjusts to the mouse position until you release the mouse button.
I want my picture control to be used the same way as the resize border to resize my window.