Leaderboard
Popular Content
Showing content with the highest reputation on 08/05/2019 in all areas
-
The AutoItObject team is proud to announce that the first version of our AutoItObject UDF is complete and ready to use. The project page is located at [currently missing] Please, report bugs and any other issues at our [currently missing], and not here. An overview of all the functions can be found in the online documentation [currently missing] or in the offline .chm documentation file which is included with the [currently missing]. If Origo has problems providing the download, the current version will be mirrored here The UDF requires the current AutoIt version v3.3.4.0! AutoItObject 1.2.8.2.exe AutoItObject 1.2.8.2.zip Please, leave your comments and experiences here. Regards, - trancexx - ProgAndy - monoceres - Kip Our work is published under the Artistic License 2.0 A copy of the FAQ to answer your most urgent questions right away: (can also be found at the online documentation: Some helper-functions: When using the Wrapper, this are some simple methods to get a return value from the resulting array. ; #FUNCTION# ==================================================================================================================== ; Name...........: _AIOResult ; Description ...: Returns the return value of the Call to a WraperObject function ; Syntax.........: _AIOResult(Const $aResult [, $vError=0] ) ; Parameters ....: $aResult - the resulting array ; $vError - [optional] value to be returned if result is no array (default: 0) ; Return values .: Success - Returnvalue ($aResult[0]) ; Failure - $vError, @error set to 1 ; Author ........: Prog@ndy ; Modified.......: ; Remarks .......: ; Related .......: ; Link ..........; ; Example .......; ; =============================================================================================================================== Func _AIOResult(Const $aResult, $vError=0) ; Author: Prog@ndy If IsArray($aResult) Then Return $aResult[0] Return SetError(1,0,$vError) EndFunc ; #FUNCTION# ==================================================================================================================== ; Name...........: _AIOParam ; Description ...: Returns the parameter value of the Call to a WraperObject function ; Syntax.........: _AIOParam(Const $aResult, $iParam, $vError=0) ; Parameters ....: $aResult - the resulting array ; $iParam - The parameterindex to return (0: result, 1: first parameter, 2: 2nd parameter, ...) ; $vError - [optional] value to be returned if result is no array (default: 0) ; Return values .: Success - Parameter value ; Failure - $vError, @error set to 1 ; Author ........: Prog@ndy ; Modified.......: ; Remarks .......: ; Related .......: ; Link ..........; ; Example .......; ; =============================================================================================================================== Func _AIOParam(Const $aResult, $iParam, $vError=0) ; Author: Prog@ndy If UBound($aResult)-1 < $iParam Then Return SetError(1,0,$vError) Return SetExtended($aResult[0], $aResult[$iParam]) EndFunc1 point
-
As the WebDriver UDF - Help & Support thread has grown too big, I started a new one. The prior thread can be found here.1 point
-
Application deployment
Earthshine reacted to Tof006 for a topic
Really, thanks a lot. I'll test this first time tomorrow and let you know how this is going. It's what I needed to try writing a script that could work. I'll handle the french text1 point -
Application deployment
Tof006 reacted to Earthshine for a topic
something like this, but this is only dealing with that ok button, you can make it press all the buttons in the setup, you just define the button text and hotkey. as I stated, I don't know French but they should have similar meaning I believe #AutoIt3Wrapper_Compression=3 #AutoIt3Wrapper_UseUpx=y #AutoIt3Wrapper_Res_requestedExecutionLevel=requireAdministrator #AutoIt3Wrapper_Add_Constants=n #AutoIt3Wrapper_AU3Check_Parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6 -w 7 #EndRegion ;**** Directives created by AutoIt3Wrapper_GUI **** #RequireAdmin #include <MsgBoxConstants.au3> #include <WindowsConstants.au3> #include 'log4a.au3' #include 'WaitForControls.au3' Const $TD_BTN_NEXT = '&Next >' Const $TD_BTN_INSTALL = '&Install' Const $TD_BTN_INSTALL2 = 'Install' Const $TD_BTN_FINISH = '&Finish' Const $TD_BTN_CANCEL = 'Cancel' Const $TD_BTN_IAGREE = "I &accept the terms in the license agreement" Const $TD_BTN_ALTFINISH = '&Finish' Const $TD_BTN_ALLOW_ACCESS = '&Allow access' Const $TD_BTN_REMOVE = '&Remove' Const $TD_BTN_YES = '&Yes' Const $TD_BTN_OK = 'OK' Const $TD_BTN_TYPICAL = '&Typical' Const $TD_EDIT_DATA = '99999' Const $TD_TREE_NAME = 'Tree1' Const $text = "Put your official text you are looking for here...." Const $stdClass = '[Class:#32770]' Const $button1 = "[CLASS:Button; INSTANCE:1]" #Region ;**** Logging This sections sets up logging. If you compile it, it creates a nice text log file with the script name and a .log at the end. **** ; Enable logging and don't write to stderr _log4a_SetEnable() ; Write to stderr, set min level to warn, customize message format _log4a_SetErrorStream() _log4a_SetCompiledOutput($LOG4A_OUTPUT_FILE) _log4a_SetMinLevel($LOG4A_LEVEL_DEBUG) ; If @compiled Then _log4a_SetMinLevel($LOG4A_LEVEL_WARN) ; Change the min level if the script is compiled _log4a_SetFormat("${date} | ${host} | ${level} | ${message}") #EndRegion ;**** Logging **** Func Install() _log4a_Info('Begin Install()') _checkClickCtrl($stdClass, $text, $button1, $TD_BTN_OK, 0) _log4a_Info('End Install()') EndFunc ;==>Install Install()1 point -
OMG, so many bugs in just a few lines of code 😥1 point
-
Application deployment
Earthshine reacted to JLogan3o13 for a topic
@Tof006 Look at the AutoIt Window Info Tool, in the same directory where you installed AutoIt. Grab the cross-hair symbol and hover over the button/controls you want to click. This should give you information about the control. Then you can look at the Control* functions in the helpfile to help you click/send the info you need.1 point -
Nope, It normally only touches the #AutoIt3_Wrapper directives, but this one was added when we moved away from distributing compiled scripts and I needed a way to simply way to update the displayed script version when running for the source. Jos1 point
-
Two strings or arrays, match whole words
prodesigner reacted to jchd for a topic
Regexp: #include <Array.au3> Global $group1 = "sunny|weather|all|day" Global $group2 = "sun|sunny|moon|day|night" Global $aResult = StringRegExp($group1, "\b(?:" & $group2 & ")\b", 3) MsgBox($MB_SYSTEMMODAL, "", _ArrayToString($aResult, ", "))1 point -
You are a bit overcomplicating things. I suggest (untested): #include <FileConstants.au3> $hInfile = FileOpen(@ScriptDir & "\test.txt") $hOutfile = FileOpen(@ScriptDir & "\test.html", $FO_OVERWRITE) FileWriteLine($hOutFile, "<html><Body><table>") While 1 $sInLine = FileReadLine($hInfile) If @error = -1 Then ExitLoop ; EOF has been reached FileWriteLine($hOutfile, "<tr><td>" & $sInline & "</td></tr>") WEnd FileWriteLine($hOutFile, "</table></Body></html>") FileClose(@ScriptDir & "\test.txt") FileClose(@ScriptDir & "\test.html")1 point
-
From the remarks section of the help file entry for _FileWriteToLine --1 point
-
Two strings or arrays, match whole words
prodesigner reacted to Nine for a topic
Good old way : Global $group1 = StringSplit ("sunny|weather|all|day","|"), $Result = "" Global $group2 = StringSplit ("sun|sunny|moon|day|night", "|") For $i = 0 to UBound ($group1)-1 for $j = 0 to UBound ($group2)-1 If $group1[$i] = $group2[$j] Then $Result &= $group1[$i] & ", " ContinueLoop 2 EndIf Next Next MsgBox($MB_SYSTEMMODAL, "", StringTrimRight ($Result,2))1 point -
Try this baby #include <Array.au3> #include <AutoItConstants.au3> #include <File.au3> Global $Lines _FileReadToArray("ORIGINAL.txt", $Lines, $FRTA_NOCOUNT) Global $oDict = ObjCreate("Scripting.Dictionary") Local $Total = UBound($Lines), $LastRound = 0, $FirstTwoChar For $i = 0 To $Total - 1 ;Extract the first two characters of the current line $FirstTwoChar = StringInStr(' <>?"|:\/', StringMid($Lines[$i], 1, 1)) ? "_" : StringMid($Lines[$i], 1, 1) $FirstTwoChar &= StringInStr(' <>?"|:\/', StringMid($Lines[$i], 2, 1)) ? "_" : StringMid($Lines[$i], 2, 1) ;Add the first two characters as a key in the dictionary with its value. If Not $oDict.Exists($FirstTwoChar) Then $oDict.Add($FirstTwoChar, $Lines[$i] & @CRLF) Else ;Add the current line to the dict. $oDict.Item($FirstTwoChar) = $oDict.Item($FirstTwoChar) & $Lines[$i] & @CRLF EndIf ;Show progress on the screen If Not Mod($i, 100) Then $Percent = $i / $Total * 100 If Round($Percent) <> $LastRound Then ToolTip('...' & Round($Percent) & "%", 0, 5) $LastRound = Round($Percent) EndIf EndIf Next ;Save each item as text file DirCreate("result") For $Key In $oDict FileWrite("result\" & $Key & ".txt", $oDict.Item ($Key)) Next Not fully tested but I believe it is quite close of what you are looking for...1 point
-
Hi, this should work (untested): MsgBox(0, "Version", FileGetVersion(@ScriptFullPath)) I don’t think that your variable $VERSION will be updated through compilation. Regards, Simpel1 point
-
I did not understand very well, would it be something like that? #include <GuiListView.au3> #include <GUIConstantsEx.au3> #include <ListViewConstants.au3> #include <WindowsConstants.au3> #Region ### START Koda GUI section ### Form= $Form1 = GUICreate("Form1", 215, 206, 344, 147) $ListView1 = GUICtrlCreateListView("test|test2", 16, 24, 162, 126, BitOR($LVS_NOCOLUMNHEADER, $LVS_SHOWSELALWAYS, $LVS_SINGLESEL)) _GUICtrlListView_SetExtendedListViewStyle($ListView1, $LVS_EX_GRIDLINES) GUISetState(@SW_SHOW) #EndRegion ### END Koda GUI section ### While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit EndSwitch WEnd1 point
-
Use the function _WinHttpSimpleFormFill to submit your login information and capture the returned data in a variable. This data should be the html of the initial page post login.1 point
-
An OS can only exploit the available hardware potential. You would need an x128 CPU + supporting RAM, and other hardware underneath first. And the speed bottleneck is not so much address space (exabytes should be sufficient for a few decades) but memory bandwidth (bus). Some informative links are here and here.1 point
-
Advanced Math UDF
robertocm reacted to scintilla4evr for a topic
I started writing this UDF a while ago, so I decided to share it here. This is an UDF full of advanced mathematical functions. It allows to work with primes, create number sequences, interpolate, calculate values of functions like Riemann zeta. Full list of functions: Changelog: Download1 point -
RunningStats calculates running (moving) statistics: Standard Deviation, Variance, and Mean . The single function _RunningStats(), queries, clears, restores, or adds to the running statistics. Example.au3 adds 7 samples of data to running statistics and displays the results using _ArrayDisplay(). Example-Persistent-Storage.au3 adds the first 6 samples to the running statistics and stores the results in an INI file. The data is read from the INI file and restored to the running statistics. The 7th sample is added and the results displayed, matching the results from Example.au3. Credits: John D. Cook for his article "Accurately computing running variance" at http://www.johndcook.com/blog/standard_deviation/ RunningStats.zip1 point
-
Operator XOR XNOR
pixelsearch reacted to AdamUL for a topic
Try this with the Boolean Algebra equation for XOR. ConsoleWrite("XOR Truth Table" & @LF) ConsoleWrite("_XOR(False, False) = " & _XOR(False, False) & @LF) ConsoleWrite("_XOR(False, True) = " & _XOR(False, True) & @LF) ConsoleWrite("_XOR(True, False) = " & _XOR(True, False) & @LF) ConsoleWrite("_XOR(True, True) = " & _XOR(True, True) & @LF & @LF) ConsoleWrite("XNOR Truth Table" & @LF) ConsoleWrite("_XNOR(False, False) = " & _XNOR(False, False) & @LF) ConsoleWrite("_XNOR(False, True) = " & _XNOR(False, True) & @LF) ConsoleWrite("_XNOR(True, False) = " & _XNOR(True, False) & @LF) ConsoleWrite("_XNOR(True, True) = " & _XNOR(True, True) & @LF) Func _XOR($A, $B) ;~ Return ($A And (Not $B)) Or ((Not $A) And $B) Return ($A Or $B) And (Not ($A And $B)) EndFunc Func _XNOR($A, $B) Return Not _XOR($A, $B) ;~ Return ($A And $B) Or ((Not $A) And (Not $B)) EndFunc Adam1 point -
Statistic Functions
robertocm reacted to mikemike37 for a topic
For anyone finding thsi topic at a later date, heres the solution I came up with. Its all in one function because it doesnt need to keep calculating the same stuff over and over if you need all of the stats. Of course, if you have need only for certain bits, hacking away at it can make it less bloated. Inputs: $YValues - array containing Y values of dataset $XValues - array containing X values of dataset Returns: RegStat[0] = Mean of Y RegStat[1] = Mean of X RegStat[2] = Slope of Best Fit (Linear Regression) RegStat[3] = Intercept of Best Fit (Linear Regression) RegStat[4] = Average Difference from Best Fit Line - NOTE: this is not the STEYX statistic I mentioned in my earlier post, this is a bit different. ; ---- RegStats - Regression Statistics Function ---- ; returns several statistics based on two datasets, stored in arrays. ; ; NOTE: use 0-based arrays. ; ; Inputs: ; $YValues - array containing Y values of dataset ; $XValues - array containing X values of dataset ; ; Returns: ; RegStat[0] = Mean of Y ; RegStat[1] = Mean of X ; RegStat[2] = Slope of Best Fit (Linear Regression) ; RegStat[3] = Intercept of Best Fit (Linear Regression) ; RegStat[4] = Average Difference from Best Fit Line ; ; Errors: ; 1 - array had fewer than 2 entries ; 2 - YValues and XValues were of different array lengths func RegStats($YValues, $XValues) ; COUNT (N) Local $Count = UBound($YValues) if $Count < 2 Then Return SetError(1,0,0) Local $CountX = UBound($XValues) If $Count <> $CountX Then Return SetError(2,0,0) ; SUMS Local $SumY Local $SumYSq Local $SumX Local $SumXSq Local $SumXY For $i = 0 to $Count - 1 $SumX = $SumX + $XValues[$i] $SumY = $SumY + $YValues[$i] $SumYSq = $SumYSq + $YValues[$i] ^ 2 $SumXSq = $SumXSq + $XValues[$i] ^ 2 $SumXY = $SumXY + $XValues[$i] * $YValues[$i] Next ; MEAN Local $MeanY = $SumY / $Count Local $MeanX = $SumX / $Count ; SLOPE (Y on X) Local $Slope = ($SumXY - $SumX * $SumY / $Count) / ($SumXSq - $SumX ^ 2 / $Count) ; INTERCEPT (Y on X) Local $Intercept = $MeanY - $MeanX * $Slope ; SUM DIFFERENCE FROM LINE Local $SumDifference For $i = 0 to $Count - 1 $SumDifference = $SumDifference + (($YValues[$i] - ($Slope * $XValues[$i] + $Intercept)) ^ 2) ^ 0.5 Next ; AVERAGE DIFFERENCE FROM LINE Local $AverageDifference = $SumDifference / $Count ; RETURN VALUES Dim $RegAnalyseArray[5] $RegAnalyseArray[0] = $MeanY $RegAnalyseArray[1] = $MeanX $RegAnalyseArray[2] = $Slope $RegAnalyseArray[3] = $Intercept $RegAnalyseArray[4] = $AverageDifference return $RegAnalyseArray EndFunc Or, if you don't need the X values (I don't I just thought I'd script them while I was at it... the next one assumes X values are 1, 2, 3, 4... ; ---- RegStatsY - Regression Statistics Function ---- ; returns several statistics based on onedatasets, stored in an array. ; the other dataset is assumed to be 1, 2, 3, 4, 5... ; ; NOTE: use 0-based arrays. ; ; Inputs: ; $YValues - array containing Y values of dataset ; ; Returns: ; RegStatsY[0] = Mean of Y ; RegStatsY[1] = Mean of X ; RegStatsY[2] = Slope of Best Fit (Linear Regression) ; RegStatsY[3] = Intercept of Best Fit (Linear Regression) ; RegStatsY[4] = Average Difference from Best Fit Line ; ; Errors: ; 1 - array had fewer than 2 entries func RegStatsYBAD($YValues) ; COUNT (N) Local $Count = UBound($YValues) if $Count < 2 Then Return SetError(1,0,0) dim $XValues[$Count] for $i = 0 to $Count - 1 $XValues[$i] = $i next ; SUMS Local $SumY Local $SumYSq Local $SumX Local $SumXSq Local $SumXY For $i = 0 to $Count - 1 $SumX = $SumX + $XValues[$i] $SumY = $SumY + $YValues[$i] $SumYSq = $SumYSq + $YValues[$i] ^ 2 $SumXSq = $SumXSq + $XValues[$i] ^ 2 $SumXY = $SumXY + $XValues[$i] * $YValues[$i] Next ; MEAN Local $MeanY = $SumY / $Count Local $MeanX = $SumX / $Count ; SLOPE (Y on X) Local $Slope = ($SumXY - $SumX * $SumY / $Count) / ($SumXSq - $SumX ^ 2 / $Count) ; INTERCEPT (Y on X) Local $Intercept = $MeanY - $MeanX * $Slope ; SUM DIFFERENCE FROM LINE Local $SumDifference For $i = 0 to $Count - 1 $SumDifference = $SumDifference + (($YValues[$i] - ($Slope * $XValues[$i] + $Intercept)) ^ 2) ^ 0.5 Next ; AVERAGE DIFFERENCE FROM LINE Local $AverageDifference = $SumDifference / $Count ; RETURN VALUES Dim $RegAnalyseArray[5] $RegAnalyseArray[0] = $MeanY $RegAnalyseArray[1] = $MeanX $RegAnalyseArray[2] = $Slope $RegAnalyseArray[3] = $Intercept $RegAnalyseArray[4] = $AverageDifference return $RegAnalyseArray EndFunc and finally, some example code to test them: Dim $TestDataX[12] $TestDataX[0] = 94 $TestDataX[1] = 65 $TestDataX[2] = 88 $TestDataX[3] = 83 $TestDataX[4] = 92 $TestDataX[5] = 50 $TestDataX[6] = 67 $TestDataX[7] = 100 $TestDataX[8] = 100 $TestDataX[9] = 73 $TestDataX[10] = 90 $TestDataX[11] = 83 Dim $TestDataY[12] $TestDataY[0] = 89 $TestDataY[1] = 52 $TestDataY[2] = 57 $TestDataY[3] = 78 $TestDataY[4] = 76 $TestDataY[5] = 30 $TestDataY[6] = 67 $TestDataY[7] = 96 $TestDataY[8] = 74 $TestDataY[9] = 65 $TestDataY[10] = 87 $TestDataY[11] = 78 $Stats = RegStats($TestDataY, $TestDataX) Local $str = "" $str = $str & "Mean of X is " & $Stats[0] & @CRLF $str = $str & "Mean of Y is " & $Stats[1] & @CRLF $str = $str & "Slope of Linear Best Fit is " & $Stats[2] & @CRLF $str = $str & "Intercept of Best Fit is " & $Stats[3] & @CRLF $str = $str & "Average Difference from Best Fit is " & $Stats[4] msgbox(0,"",$str) Should I also post this to the snippets section? I'm happy for anybody to use it.1 point