Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 10/01/2021 in all areas

  1. Jon

    Using AutoItX from C# / .Net

    The following files are provided to allow .NET use: AutoItX3.Assembly.dll - The .NET Assembly for using AutoItX.AutoItX3.Assembly.xml - The Visual Studio Intellisense help file for the .NET Assembly.AutoItX3.dll - The main AutoItX DLL (x86)AutoItX3_x64.dll - The main AutoItX DLL (x64)Using the Assembly from VB/C# within in Visual Studio is very easy: Add a reference to AutoItX3.Assembly.dll to your projectAdd a using AutoIt; statement in the files you want to use AutoIt functionsWrite code like this C# example:using AutoIt; ... // Wow, this is C#! AutoItX.Run("notepad.exe"); AutoItX.WinWaitActive("Untitled"); AutoItX.Send("I'm in notepad"); IntPtr winHandle = AutoItX.WinGetHandle("Untitled"); AutoItX.WinKill(winHandle);Distribute your final executable with the files AutoItX3.Assembly.dll, AutoItX3.dll, AutoItX3_x64.dll.
    1 point
  2. Thank you for your attention and the answers provided. My problem was solved by increasing the timeout of the command $CommandTimeout = _SQL_CommandTimeout(-1,1200)
    1 point
  3. error code 5 is "Access denied". Where is the #RequireAdmin line in you code ??? Please, add it and retry
    1 point
  4. Hi, The Devs were discussing this a while ago and came up with two possible workarounds for the standard AutoIt include functions to prevent this scenario. Here are the options for _NowCalc: Func _NowCalc_Atomic() Local $tStamp = _Date_Time_GetLocalTime() Return DllStructGetData($tStamp, "Year") & "/" & _ StringFormat("%02s", DllStructGetData($tStamp, "Month")) & "/" & _ StringFormat("%02s", DllStructGetData($tStamp, "Day")) & " " & _ StringFormat("%02s", DllStructGetData($tStamp, "Hour")) & ":" & _ StringFormat("%02s", DllStructGetData($tStamp, "Minute")) & ":" & _ StringFormat("%02s", DllStructGetData($tStamp, "Second")) EndFunc ;==>_NowCalc_Atomic Func _NowCalc_Check() Local $sRet, $sCheck Do $sCheck = @SEC $sRet = @YEAR & "/" & @MON & "/" & @MDAY & " " & @HOUR & ":" & @MIN & ":" & @SEC Until @SEC = $sCheck Return $sRet EndFunc ;==>_NowCalc_Check The first of these options will be incorporated for all such functions in the next AutoIt release - and please, please do not ask me when that will be! M23
    1 point
  5. Sample code creation through Detail info listview page The Detail info listview page is also the default listview page. This makes sample code creation easy and fast. But not all code can be created this way. In many cases, there is a need to use the Sample code main menu. Sample code is created by selecting one or more rows in a single listview group. Right-click a selected row and click Create sample code. The code is displayed in the listview code page. Click Create sample code in the picture above to generate this code: ; --- Find window/control --- ConsoleWrite( "--- Find window/control ---" & @CRLF ) Local $pCondition0 $oUIAutomation.CreatePropertyCondition( $UIA_ClassNamePropertyId, "Notepad", $pCondition0 ) If Not $pCondition0 Then Return ConsoleWrite( "$pCondition0 ERR" & @CRLF ) ConsoleWrite( "$pCondition0 OK" & @CRLF ) Local $pWindow, $oWindow $oDesktop.FindFirst( $TreeScope_Descendants, $pCondition0, $pWindow ) $oWindow = ObjCreateInterface( $pWindow, $sIID_IUIAutomationElement, $dtagIUIAutomationElement ) If Not IsObj( $oWindow ) Then Return ConsoleWrite( "$oWindow ERR" & @CRLF ) ConsoleWrite( "$oWindow OK" & @CRLF ) Click the selected treeview item in the left pane window to return to the detail information and add more sample code. Or paste the code into the code editor. Create sample code also copies the code to clipboard. Only selected rows that specifically belongs to the listview group in which a row is right-clicked are included in sample code. The only exception to this are the groups "Element Properties (identification)" and "Element Properties (session unique)". For these two groups, selected rows from both groups are included in sample code. This makes it possible to use session unique properties in window identification: Click Create sample code in the picture to generate this code: ; --- Find window/control --- ConsoleWrite( "--- Find window/control ---" & @CRLF ) Local $pCondition0, $pCondition1, $pAndCondition1 $oUIAutomation.CreatePropertyCondition( $UIA_ClassNamePropertyId, "Notepad", $pCondition0 ) $oUIAutomation.CreatePropertyCondition( $UIA_NativeWindowHandlePropertyId, 0x0000000000050314, $pCondition1 ) $oUIAutomation.CreateAndCondition( $pCondition0, $pCondition1, $pAndCondition1 ) If Not $pAndCondition1 Then Return ConsoleWrite( "$pAndCondition1 ERR" & @CRLF ) ConsoleWrite( "$pAndCondition1 OK" & @CRLF ) Local $pWindow, $oWindow $oDesktop.FindFirst( $TreeScope_Descendants, $pAndCondition1, $pWindow ) $oWindow = ObjCreateInterface( $pWindow, $sIID_IUIAutomationElement, $dtagIUIAutomationElement ) If Not IsObj( $oWindow ) Then Return ConsoleWrite( "$oWindow ERR" & @CRLF ) ConsoleWrite( "$oWindow OK" & @CRLF ) See Automating Notepad with sample code - step by step and Automating Notepad with sample code - all at once for examples of creating sample code.
    1 point
  6. The following script ignores all "touched" cells in column A: #include <Excel.au3> ; XlDirection enumeration: https://msdn.microsoft.com/en-us/library/office/ff820880.aspxGlobal $oExcel = _Excel_Open() Global $xlup = -4162 Global $oExcel = _Excel_Open() Global $oWorkbook = _Excel_BookOpen($oExcel, "C:\temp\Test.xlsx") Global $iRow = $oWorkbook.ActiveSheet.Range("A65536").End($xlup).Row MsgBox(0, "", $iRow)
    1 point
×
×
  • Create New...