Leaderboard
Popular Content
Showing content with the highest reputation on 03/03/2019 in all areas
-
1 point
-
....you do not need to complicate it any further because it is ready for those parameters (see the fourth and the fifth parameter of the _AssignEnum function)1 point
-
here a possible way... P.S. please don't amend me that this, more than a technical solution, is a Rube Goldberg's tribute, because I already know it... #AutoIt3Wrapper_Run_Au3Check=n _example() ; this will give error since those variables where in local scope only ; ConsoleWrite($Opt_1 & @TAB & $Opt_2 & @TAB & $Opt_3 & @TAB & $Opt_4 & " ....." & @CRLF) Func _example() ; -- generate variables in local scope -------- Local $aMyVars = _AssignEnum("Opt_", 10, 10) For $i = 0 To UBound($aMyVars) - 1 Assign($aMyVars[$i][0], $aMyVars[$i][1], 1) Next ; --------------------------------------------- ; use yours generated Opt_* vars here, in LOCAL scope for this function only ConsoleWrite($Opt_1 & @TAB & $Opt_2 & @TAB & $Opt_3 & @TAB & $Opt_4 & " ....." & @CRLF) EndFunc ;==>_example Func _AssignEnum($VarPrefix, $iNumOfVars, $iStartValue = 0, $sStepIncrement = 1) If $iStartValue = 0 And StringInStr($sStepIncrement, '*') Then $iStartValue = 1 If IsNumber($sStepIncrement) And $sStepIncrement > 0 Then $sStepIncrement = '+' & $sStepIncrement Local $iNextValue = $iStartValue Local $aVars[$iNumOfVars][2] For $i = 1 To $iNumOfVars ; Assign($VarPrefix & $i, $iNextValue) $aVars[$i - 1][0] = $VarPrefix & $i $aVars[$i - 1][1] = $iNextValue $iNextValue = Execute($iNextValue & $sStepIncrement) Next Return $aVars EndFunc ;==>_AssignEnum1 point
-
@Deye, Short answer: No. Long answer: No, type that yourself.1 point
-
Enum Assign like
Deye reacted to FrancescoDiMuro for a topic
@Deye Enum increments the first variable from 0 (if not specified), to N. You can specify a Step, so the increment will be like the Step specified. In your case, you have the first variable set to 10, so the last variable is set to 19, since the Step is 1. With Assign , you assign data to a variable, which, in this case, is already set (by Enum). So, what AssignEnum() should do?1 point -
Utter - Utilizing more of SAPI (Speech Recognition UDF)
Network_Guy reacted to Surya for a topic
Nope it only currently supports English the next update would come with an online speech recognizer which would suite your need.1 point -
Hey you two, I found my problem. Its because of one statement for AutoIt3Wrapper. #AutoIt3Wrapper_UseX64=y My original script is running in 64bit mode. After I had deleted my project in the most necessary way (including the line above), the error was gone. When I finally figured out that it was this one line, I took my whole project again and just commented out this line and everything worked. I can also reproduce it with our old "demo". #AutoIt3Wrapper_UseX64=y #include <GUIConstantsEx.au3> #include <MsgBoxConstants.au3> #include "GUIListViewEx.au3" Global $GUI_Listview[1][2], $iModulID = 0 $hGUI = GUICreate("Test", 800, 500) ;Listview $GUI_Listview[$iModulID][0] = GUICtrlCreateListView("", 1, 1, 780, 90) ;,$LVS_SORTDESCENDING) ;Fügt der Listview Spaltennamen hinzu _GUICtrlListView_AddColumn($GUI_Listview[$iModulID][0], "EndSZ A", 100) _GUICtrlListView_AddColumn($GUI_Listview[$iModulID][0], "Port A", 50) _GUICtrlListView_AddColumn($GUI_Listview[$iModulID][0], "LSZ", 35) _GUICtrlListView_AddColumn($GUI_Listview[$iModulID][0], "OrdnNR", 60) _GUICtrlListView_AddColumn($GUI_Listview[$iModulID][0], "Port B", 50) _GUICtrlListView_AddColumn($GUI_Listview[$iModulID][0], "EndSZ B", 100) _GUICtrlListView_AddColumn($GUI_Listview[$iModulID][0], "Betrieb", 60) _GUICtrlListView_AddColumn($GUI_Listview[$iModulID][0], "Status", 50) _GUICtrlListView_AddColumn($GUI_Listview[$iModulID][0], "Pegel", 70) ;Test Data For $i = 1 To 2 Local $sData = "Item: "&$i&"|1|2|3|4|5|6|7|8" GUICtrlCreateListViewItem($sData, $GUI_Listview[$iModulID][0]) Next Local $aLV = _GUIListViewEx_ReadToArray($GUI_Listview[$iModulID][0], 0) ; ListView UDF >> Initiate ListView $GUI_Listview[$iModulID][1] = _GUIListViewEx_Init($GUI_Listview[$iModulID][0], $aLV, 0, 0, False, 16 + 32 + 64 + 128) ; ListView UDF >> If colours used then this function must be run BEFORE GUISetState _GUIListViewEx_MsgRegister() ; Set required colours for ListView elements - (Normal text, Normal field, Selected text, Selected field) ;Local $aSelCol[4] = [$GUIBKCOLOR_FONT_TEXT, $GUIBKCOLOR_MAIN_SECOND, $GUIBKCOLOR_MAIN_SECOND, $GUIBKCOLOR_FONT_TEXT] Local $aSelCol[4] = ["0x999b9d", "0x303443", "0x303443", "0x999b9d"] _GUIListViewEx_SetDefColours($GUI_Listview[$iModulID][1], $aSelCol) ; Set header data ;Local $sHeaderColor = $GUIBKCOLOR_FONT_TEXT&";"&$GUIBKCOLOR_MAIN_SECOND Local $sHeaderColor = "0x999b9d;0x303443" Local $aHdrData[][] = [["Tom", "Dick", "Harry", "Fred", "Fred", "Fred", "Fred", "Fred", "Fred"], _ ; As colour is enabled, these will replace original titles [$sHeaderColor, $sHeaderColor, $sHeaderColor, $sHeaderColor, $sHeaderColor, $sHeaderColor, $sHeaderColor, $sHeaderColor, $sHeaderColor], _ ["", "", "", "", "", "", "", "", ""], _ [0,0,0,0,0,0,0,0,0]] Local $sTest = _GUIListViewEx_LoadHdrData($GUI_Listview[$iModulID][1], $aHdrData) GUISetState() While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE Exit EndSwitch WEnd I'm just at the point of finding out. If the bug has been handled before, I'm sorry, I didn't see that. Still the question, am I making a mistake here? Or is your UDF 64bit capable? Is there anything I can do to change it or deal with the bug in a different way?1 point
-
Uninstall bad AV - install good AV ?1 point
-
#include <GUIConstantsEx.au3> #include <StaticConstants.au3> #include <WindowsConstants.au3> Opt ("MustDeclareVars", 1) Local $Form1 = GUICreate("Form1", 319, 217, 192, 124) Local $Label1 = GUICtrlCreateLabel("Label1", 32, 32, 36, 17) Local $Input1 = GUICtrlCreateInput("Input1", 80, 30, 145, 21) Local $Button1 = GUICtrlCreateButton("Button1", 80, 96, 97, 33) GUISetState(@SW_SHOW) ; without error GCC(ControlSend,$Form1,"",$Input1,"First") GCC(ControlClick,$Form1,"",$Button1,"Left",1) Sleep (2000) GCC(ControlSetText,$Form1,"",$Input1,"Second") ; with errors ; GCC(XYZ,1,1,1,1) ; GCC(ControlCommand,$Form1,"",$Input1,"Third") GCC(ControlSetText,"Test","",99,1) Local $nMsg While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit EndSwitch WEnd Func GCC ($Func, $p1, $p2, $p3, $p4, $p5 = "", $p6 = "", $p7 = "") Local Const $aFunc [3][3] = [[ControlClick,7,"Click"],[ControlSend,5,"Send"],[ControlSetText,5,"SetText"]] Local $aArg [1] = ["CallArgArray"], $iFunc = -1 For $i = 0 to Ubound ($aFunc)-1 if $Func = $aFunc[$i][0] then $iFunc = $i ExitLoop EndIf Next If $iFunc < 0 then Exit MsgBox (0,"Error","Unknown Function") Redim $aArg[$aFunc[$iFunc][1]+1] For $i = 1 to $aFunc[$iFunc][1] $aArg [$i] = Eval ("p" & $i) Next Local $sRet = Call ($Func, $aArg) If @error = 0xDEAD and @extended = 0xBEEF then Exit MsgBox (0,"Fatal Error", "Invalid function call") If not $sRet then Exit MsgBox (0,"Error", "Error calling " & $aFunc[$iFunc][2] & " with param " & $p1 & "/" & $p2 & "/" & $p3 & "/" & $p4 & "/" & $p5 & "/" & $p6 & "/" & $p7) EndFunc Something like that for example1 point
-
1 point
-
Random Number Generator - Gaussian Distribution
AndrewSchultz reacted to andybiochem for a topic
Hi, Here's a quick math function to generate random numbers based on the normal distribution (gaussian distribution). This is the Box-Muller polar transformation FYI #include <Array.au3> #include <File.au3> $Mean = 150 $StandardDeviation = 10.0 Dim $GaussianData[501] For $i = 1 to (UBound($GaussianData) - 1) $GaussianData[$i] = _Random_Gaussian($Mean,$StandardDeviation,5) Next _ArrayDisplay($GaussianData) Func _Random_Gaussian($nMean,$nSD,$iDP = 3) ;****************************************** ; Box-Muller polar transform gaussian RND ;****************************************** ; $iMean = The mean of the distribution ; $iSD = desired standard deviation ; $iDP = data precision (d.p.) Do $nX = ((2 * Random()) - 1) $nY = ((2 * Random()) - 1) $nR = ($nX^2) + ($nY^2) Until $nR < 1 $nGaus = ($nX * (Sqrt((-2 * (Log($nR) / $nR))))) Return StringFormat("%." & $iDP & "f",($nGaus * $nSD) + $nMean) EndFunc By the way, how is Random() seeded in AutoIT? Is it standard time-based?...is there going to be a problem here with calling Random() in quick succession?1 point