Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 02/10/2020 in all areas

  1. I know I'm not Bill Murray, so I'm not a god
    2 points
  2. I have been working on audio graphical scripts these last several months. This is my last script on this subject for now. On to other projects. Credits: UEZ, Eukalyptus, BrettF, Prog@ndy, Authenticity and the AutoIt Community. Thanks to all that made these scripts possible! Please let me know if you have any problems with it. Download: LIVE Stereo Audio Waveform v2.zip
    1 point
  3. Just a note : @Jos has repeatedly stated not to upload compiled AutoIt scripts. As we all know to our annoyance, AutoIt-Exe's are often flagged as 'false positives' by virus software. This can also have a negative impact on the reputation of the entire forum (as far as I understood).
    1 point
  4. Inches per book? What?
    1 point
  5. A different approach, that will replace any vertical characters (only when pasting) : #include <Constants.au3> #include <GUIConstants.au3> #include <WinAPI.au3> $sString = @CRLF & "This " & @LF & "is a" & @CR & " test" & @CRLF ClipPut($sString) Example() Func Example() GUICreate("My script", 200, 200) Local $idInput = GUICtrlCreateInput("CTRL+V HERE", 5, 5, 190) Local $idButton = GUICtrlCreateButton("load info", 50, 25, 100) GUICtrlSetState(-1, $GUI_DEFBUTTON) GUISetState() Local $wProcHandle = DllCallbackRegister("_WindowProc", "ptr", "hwnd;uint;wparam;lparam") Global $wProcOld = _WinAPI_SetWindowLong(GUICtrlGetHandle($idInput), $GWL_WNDPROC, DllCallbackGetPtr($wProcHandle)) While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE ExitLoop Case $idButton MsgBox(0, Default, "Entered ID=" & GUICtrlRead($idInput)) EndSwitch WEnd DllCallbackFree($wProcHandle) EndFunc ;==>Example Func _WindowProc($hWnd, $iMsg, $wParam, $lParam) If $iMsg = $WM_PASTE Then _WinAPI_SetWindowText($hWnd, StringRegExpReplace(ClipGet(), "(\v)", "")) Return _WinAPI_CallWindowProc($wProcOld, $hWnd, $iMsg, $wParam, $lParam) EndFunc ;==>_WindowProc
    1 point
  6. Something like this? #include <GUIConstantsEx.au3> ClipPut(@CRLF & "12356") Example() Func Example() GUICreate("My script", 200, 200) Local $idInput = GUICtrlCreateEdit("CTRL+V HERE", 5, 5, 190,20) Local $idButton = GUICtrlCreateButton("load info", 50, 25, 100) GUICtrlSetState(-1, 512) ;512 = $GUI_DEFBUTTON GUISetState() While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE ExitLoop Case $idButton MsgBox(0, Default, "Entered ID=" & GUICtrlRead($idInput)) EndSwitch If StringInStr(GUICtrlRead($idInput),@CRLF) then GUICtrlSetData($idInput,StringReplace(GUICtrlRead($idInput),@CRLF,"")) ConsoleWrite('@@ Debug(' & @ScriptLineNumber & ') : StringReplace(GUICtrlRead($idInput),@CRLF,"") = ' & StringReplace(GUICtrlRead($idInput),@CRLF,"") & @CRLF & '>Error code: ' & @error & @CRLF) ;### Debug Console EndIf WEnd EndFunc Jos
    1 point
  7. ...I should not be responding since I don't use Outlook BUT, if I ever need to work with it, having a full featured UDF is a god send. Am I calling you a god ?, maybe
    1 point
  8. @Bert There's also the clue that he linked to a gaming website in his other thread. 🤔
    1 point
  9. @Danp2 You are legend. Thank you. Your code works perfectly.
    1 point
  10. Please have a look at my OutlookEX UDF (for download please see my signature). Example script: #include <OutlookEX.au3> Local $iAttachmentCount = 0, $sAttachmentNames = "" Global $oOutlook = _OL_Open() MsgBox(0, "Select", "Please select one or multiple items ...") Global $oSelection = $oOutlook.ActiveExplorer().Selection For $oSel In $oSelection $iAttachmentCount = $oSel.attachments.Count $sAttachmentNames = "" $aAttachments = _OL_ItemAttachmentGet($oOutlook, $oSel) MsgBox(0, "_OL_ItemAttachmentGet", "@error = " & @error & ", @extended = " & @extended) _ArrayDisplay($aAttachments) If $iAttachmentCount > 0 Then For $i = 1 To $aAttachments[0][0] $sAttachmentNames = $aAttachments[$i][2] & @CRLF Next EndIf MsgBox(0, "Selection", "Subject: " & @CRLF & StringLeft($oSel.Subject, 100) & @CRLF & @CRLF & "Body:" & @CRLF & StringLeft($oSel.Body, 100) & @CRLF & @CRLF & "Attachments: " & $iAttachmentCount & @CRLF & $sAttachmentNames) Next
    1 point
  11. Yeah... you definitely don't want the "desiredCapabilities" entry inside your "alwaysMatch". Looking here, it appears that some of the options are no longer valid. This works for me -- $sDesiredCapabilities = '{"capabilities":{"alwaysMatch":{"acceptInsecureCerts":true, "pageLoadStrategy":"none", "moz:firefoxOptions": {"args": ["-kiosk", "-private", "-profile", "C:\\Users\\Username\\AppData\\Roaming\\Mozilla\\Firefox\\Profiles\\Profile.Name"]}}}}'
    1 point
  12. There's a newer version of WinHTTP.au3 that may fix this for you. You can copy / paste the code from here.
    1 point
  13. I suggest that you try to troubleshoot one thing at a time. Please rerun after removing the latest edits to $sDesiredCapabilities.
    1 point
  14. A few observations -- ProcessClose("geckodriver-v0.26.0.exe") This line shouldn't be needed because _WD_Startup will automatically close the prior instance for you. $_WD_DEBUG = 0 Suggest that you use the Enum constants, which should eliminate an issues when / if their underlying values change in the future Please set $_WD_DEBUG = $_WD_DEBUG_Info, rerun the code, and then post the results from the Scite output panel They would still come after the alwayMatch, but not inside "moz:firefoxOptions" structure, like this -- $sDesiredCapabilities = '{"capabilities":{"alwaysMatch": {{"desiredCapabilities":{"javascriptEnabled":true,"nativeEvents":true,"acceptInsecureCerts":true, "pageLoadStrategy":"none", "moz:firefoxOptions": {"args": ["-kiosk", "-private", "-profile", "C:/Users/Ian/Desktop/Firefox"]}}}}'
    1 point
  15. @IanN1990 I believe that your DesiredCapabilities string is incorrect as follows -- There should be a single "args" entry, which can contain multiple arguments It should be inside a "moz:firefoxOptions" entry
    1 point
  16. I understand that coding can be frustrating and difficult, I've been learning from people on the internet for the last 8 years. In those last 8 years I moved from literal copy-paste StackOverflow answers to actually writing a few of them and working on a degree in programming. I'm not looking for you to have all the answers, I just want you to think critically about the difference between what you're trying to do and what your code actually does. I really don't mind writing some code for you, but I don't want to just do it for you, I want to help you learn about the code that you have so you can get better at it. Back in '83 I wasn't even thought of yet and in 2004 the only thing I cared about computers was that they let me play games Now, about your program... let's walk through what actually happens... 1. All of the initial stuff happens: you setup functions to be executed on buttons pressed, you initialize some variables, etc. 2. It moves to the While loop and checks $Paused. It isn't paused yet, runs the calculations and calls _MouseClickWrapper. 3. Some time passes and it clicks 3 of the 6 times. 4. You press F6. 5. AutoIt interrupts _MouseClickWrapper and executes the code in TogglePause. $Paused is True now. 6. AutoIt continues back in _MouseClickWrapper. It continues clicking the other 3 of 6 times. 7. _MouseClickWrapper finishes and returns. The rest of the While loop finishes. 8. It moves back to the beginning of the While loop and realizes it is paused. What you want to happen should happen in _MouseClickWrapper (at step 6). _MouseClickWrapper doesn't care if the program is $Pause-d, it just clicks. You're looking to do something like in your While loop where you say "If Not $Paused Then" As for where to look, there is a more-in depth discussion of this topic here: https://www.autoitscript.com/wiki/Interrupting_a_running_function However, I was asking you to think and try. Sometimes experimentation is the best way to learn. I also don't know what you want to do when the program is paused, you could have it sit idly while waiting for another key press before picking up where it left off, or it could exit the current action, or it could do something else entirely.
    1 point
  17. this person proved from the beginning that they were ungrateful for help or answers given, i dont know why all of you continued to try and help them then act surprised when they do the same thing to you that they did to me.
    1 point
  18. The error does exactly tell you what is wrong,,,,right? Jos
    1 point
  19. I think you do not understand my point (unless it is me that don't understand you). This is what I was telling you : Const $iClickDuration = 10 ; how long last a click --> use default of opt : MouseClickDownDelay Const $iInterval = 90 ; interval between clicks Const $iDuration = 1000 * 60 ; * 15 -- but for test lets says 1 minute Opt ("MouseClickDelay", $iInterval) ; this is what you want, right ? Local $iNumberOfClicks = Int($iDuration/($iInterval+$iClickDuration)) Local $hTimer = TimerInit () MouseClick ("left", 200, 200, $iNumberOfClicks, 0) ; clicking every 90 ms for the duration ConsoleWrite (TimerDiff ($hTimer) & @CRLF)
    1 point
  20. Gianni

    Decode HTML entities

    just a quick and wild test using the browser control as a decoder. it seems to work, the returned string is OK, but why when placing that string into the Edit control using GUICtrlSetData @cr and @lf are lost? to test, paste an entity string in the upper input and click button to decode it. #include <GUIConstantsEx.au3> #include <EditConstants.au3> Global $oIE_Server _Example() Func _Example() Local $hW = GUICreate("Entity decoder", 470, 445, 230, 134) Local $Edit1 = GUICtrlCreateEdit("", 8, 8, 450, 200, BitOR($ES_MULTILINE, $ES_WANTRETURN, $ES_AUTOVSCROLL)) GUICtrlSetData(-1, '&#x1D49C;&#x1D4CA;&#x1D4C9;&#x2134;&#x2110;&#x1D4C9;' & @CRLF & _ '&#x260E; &#x2640; &#x2642; &#x2660; &#x2663; &#x2665; &#x2666; ' & @CRLF & _ '&#x1D49C;&#x1D4CA;&#x1D4C9;&#x2134;&#x2110;&#x1D4C9; &#x260E; &#x2640; &#x2642; &#x2660; &#x2663; &#x2665; &#x2666;' & @CRLF & @CRLF) Local $Edit2 = GUICtrlCreateEdit("", 8, 238, 450, 200, BitOR($ES_MULTILINE, $ES_WANTRETURN, $ES_AUTOVSCROLL)) GUICtrlSetFont(-1, 12) $Button1 = GUICtrlCreateButton("Decode Entity", 8, 210, 450, 25) GUISetState(@SW_SHOW) _SetupDecoder() Local $hDecoder = $oIE_Server.document.parentwindow.d3c0d3r While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case $Button1 $hDecoder.innerHTML = GUICtrlRead($Edit1) $sstr = $hDecoder.value MsgBox(0, 0, $sstr) ; ??? using GUICtrlSetData @cr are lost ??? GUICtrlSetData($Edit2, $sstr); $hDecoder.value) EndSwitch WEnd EndFunc ;==>_Example Func _SetupDecoder() $oIE_Server = ObjCreate("Shell.Explorer.2") GUICtrlCreateObj($oIE_Server, -10, -10, 5, 5) Sleep(3000) $oIE_Server.navigate("about:blank") Local $sHTML = _ '<!DOCTYPE html>' & @CRLF & _ '<html>' & @CRLF & _ ' <head>' & @CRLF & _ ' <meta http-equiv="X-UA-Compatible" content="IE=edge">' & @CRLF & _ ' </head>' & @CRLF & _ ' <body>' & @CRLF & _ '<textarea id="d3c0d3r"cols="10" wrap="hard"> </textarea>' & @CRLF & _ ' </body>' & @CRLF & _ '</html>' $oIE_Server.document.Write($sHTML) ; inject lising directly to the HTML document: $oIE_Server.document.close() ; close the write stream $oIE_Server.document.execCommand("Refresh") EndFunc ;==>_SetupDecoder
    1 point
  21. @jpm : many thanks for your thoughts Today was a lucky day because I finally found the quickest way to import / export a CVS file, after it has been modified by a listview control. Here are the steps that led me here : 1) Import phase : _CSVSplit() by Czardas, found here : I haven't found another function that is so reliable. We'll talk about its speed a bit later. Melba23 indicated here to Water that, from AutoIt v3.3.12.0, _FileReadToArray() could be used to parse a CSV file into an array. That's true... as long as there aren't any delimiters embedded in any field. But let's say your CSV file is comma delimited and an adress field contains a comma (for example 326, Highway Road) then _FileReadToArray() won't return any Array at all (error 3). Now good luck to find why, in this file full of commas delimiters. I'm not sure that the $FRTA_INTARRAYS flag (creating a 1D "array of arrays") will be enough to quickly debug what's happening in your file. Also better avoid embedded quotes in fields, or fields surrounded by quotes etc... They won't generate an error but will appear like this in the Array """Sacramento""" instead of "Sacramento" That's why _CSVSplit() seems imho a more reliable solution, as it handles all preceding situations. 2) Export phase : _ArrayToCSV() by Czardas Unfortunately this export function, though reliable, takes a lot of time, which made me try something else : 2) Export phase : _GUICtrlListView_SaveCSV() by Guinness, found here or there : This one is quick as it's based on surrounding each and every listview cell with a quote, also doubling any eventual quote found within the cell. Here is a part of guinness function : For $i = 0 To $iItemCount For $j = 0 To $iColumnCount $sReturn &= $sQuote & StringReplace(_GUICtrlListView_GetItemText($hListView, $i, $j), $sQuote, $sQuote & $sQuote, 0, 1) & $sQuote ... Next ... Next Using guinness export function, you end up with a CSV file where every field is surrounded with quotes but guess what ? When you want to import it back with Czardas _CSVSplit(), now it takes a very long time because of all the quotes found everywhere in guinness CSV file ! That's because Czardas _CSVSplit() is very fast... as long as most fields aren't surrounded by quotes. Facing that dilemma, I decided to rework a bit guinness function, not only to change _GUICtrlListView_GetItemText() with the "personal" function as we discussed yesterday, but to avoid having any field surrounded by quotes when it's not absolutely necessary (99% of all cases), here is the result : ;============================================ Func Export_csv() ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ; trying this, instead of _GUICtrlListView_GetItemText() ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; Local $nBegin = TimerInit() Local $iRows = _GUICtrlListView_GetItemCount($idListView) Local $iCols = _GUICtrlListView_GetColumnCount($idListView) Local $sWrite = "", $sText = "", $sQuote = chr(34), $sDoubleQuote = chr(34) & chr(34), $sPattern = "\R|" & $sDelimiter If $bHeaders1stRow = True Then ; 1st row contained headers in the imported CSV file $sWrite = $g_sHeadersReadLine & @CRLF EndIf Local $bUnicode = GUICtrlSendMsg($idListView, $LVM_GETUNICODEFORMAT, 0, 0) <> 0 Local $tBuffer, $pBuffer, $tItem, $pItem $tBuffer = DllStructCreate(($bUnicode ? "wchar Text[4096]" : "char Text[4096]")) $pBuffer = DllStructGetPtr($tBuffer) $tItem = DllStructCreate($tagLVITEM) $pItem = DllStructGetPtr($tItem) DllStructSetData($tItem, "TextMax", 4096) DllStructSetData($tItem, "Text", $pBuffer) For $i = 0 To $iRows -1 For $j = 0 To $iCols -1 DllStructSetData($tItem, "SubItem", $j) GUICtrlSendMsg($idListView, ($bUnicode ? $LVM_GETITEMTEXTW : $LVM_GETITEMTEXTA), $i, $pItem) $sText = DllStructGetData($tBuffer, "Text") If StringRegExp($sText, $sQuote) Then $sText = $sQuote & StringReplace($sText, $sQuote, $sDoubleQuote) & $sQuote ; 1st If +++ If StringRegExp($sText, $sPattern) And StringLeft($sText, 1) <> $sQuote Then $sText = $sQuote & $sText & $sQuote ; 2nd If +++ $sWrite &= $sText & (($j < $iCols - 1) ? $sDelimiter : @CRLF) Next Next Local $nEnd = TimerDiff($nBegin) ConsoleWrite($nEnd & @CRLF) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; Local $sFileName_Export = FileSaveDialog(...) And now Czardas _CSVSplit() is very quick again when importing a CSV file created by guinness amended export function, while tests done this afternoon looked very promising (speed & reliability)
    1 point
  22. Hello Guys! I wanted to share all my knowledge on arrays! Hope may enjoy the article , Lets start! Declaring arrays! Declaring arrays is a little different than other variables: ; Rules to follow while declaring arrays: ; ; Rule #1: You must have a declarative keyword like Dim/Global/Local before the declaration unless the array is assigned a value from a functions return (Ex: StringSplit) ; Rule #2: You must declare the number of dimensions but not necessarily the size of the dimension if you are gonna assign the values at the time of declaration. #include <Array.au3> Local $aEmptyArray[0] ; Creates an Array with 0 elements (aka an Empty Array). Local $aArrayWithData[1] = ["Data"] _ArrayDisplay($aEmptyArray) _ArrayDisplay($aArrayWithData) That's it Resizing Arrays Its easy! Just like declaring an empty array! ReDim is our friend here: #include <Array.au3> Local $aArrayWithData[1] = ["Data1"] ReDim $aArrayWithData[2] ; Change the number of elements in the array, I have added an extra element! $aArrayWithData[1] = "Data2" _ArrayDisplay($aArrayWithData) Just make sure that you don't use ReDim too often (especially don't use it in loops!), it can slow down you program. Best practice of using "Enum" You might be wondering what they might be... Do you know the Const keyword which you use after Global/Local keyword? Global/Local are declarative keywords which are used to declare variables, of course, you would know that already by now , If you check the documentation for Global/Local there is a optional parameter called Const which willl allow you to "create a constant rather than a variable"... Enum is similar to Const, it declares Integers (ONLY Integers): Global Enum $ZERO, $ONE, $TWO, $THREE, $FOUR, $FIVE, $SIX, $SEVEN, $EIGHT, $NINE ; And so on... ; $ZERO will evaluate to 0 ; $ONE will evaluate to 1 ; You get the idea :P ; Enum is very useful to declare Constants each containing a number (starting from 0) This script will demonstrate the usefulness and neatness of Enums : ; We will create an array which will contain details of the OS Global Enum $ARCH, $TYPE, $LANG, $VERSION, $BUILD, $SERVICE_PACK Global $aOS[6] = [@OSArch, @OSType, @OSLang, @OSVersion, @OSBuild, @OSServicePack] ; Now, if you want to access anything related to the OS, you would do this: ConsoleWrite(@CRLF) ConsoleWrite('+>' & "Architecture: " & $aOS[$ARCH] & @CRLF) ConsoleWrite('+>' & "Type: " & $aOS[$TYPE] & @CRLF) ConsoleWrite('+>' & "Langauge: " & $aOS[$LANG] & @CRLF) ConsoleWrite('+>' & "Version: " & $aOS[$VERSION] & @CRLF) ConsoleWrite('+>' & "Build: " & $aOS[$BUILD] & @CRLF) ConsoleWrite('+>' & "Service Pack: " & $aOS[$SERVICE_PACK] & @CRLF) ConsoleWrite(@CRLF) ; Isn't it cool? XD You can use this in your UDF(s) or Program(s), it will look very neat! Looping through an Array Looping through an array is very easy! . There are 2 ways to loop an array in AutoIt! Simple Way: ; This is a very basic way to loop through an array ; In this way we use a For...In...Next Loop! Global $aArray[2] = ["Foo", "Bar"] ; Create an array ; This loop will loop 2 times because our $aArray contains 2 elements. For $vElement In $aArray ; $vElement will contain the value of the elements in the $aArray... one element at a time. ConsoleWrite($vElement & @CRLF) ; Prints the element out to the console Next ; And that's it! Advanced Way: ; This is an advanced way to loop through an array ; In this way we use a For...To...Next Loop! Global $aArray[4] = ["Foo", "Bar", "Baz", "Quack"] ; Create an array ; This loop will loop 2 times because our $aArray contains 2 elements. For $i = 0 To UBound($aArray) - 1 ; $i is automatically created and is set to zero, UBound($aArray) returns the no. of elements in the $aArray. ConsoleWrite($aArray[$i] & @CRLF) ; Prints the element out to the console. Next ; This is the advanced way, we use $i to access the elements! ; With the advanced method you can also use the Step keyword to increase the offset in each "step" of the loop: ; This will only print every 2nd element starting from 0 ConsoleWrite(@CRLF & "Every 2nd element: " & @CRLF) For $i = 0 To UBound($aArray) - 1 Step 2 ConsoleWrite($aArray[$i] & @CRLF) Next ; This will print the elements in reverse order! ConsoleWrite(@CRLF & "In reverse: " & @CRLF) For $i = UBound($aArray) - 1 To 0 Step -1 ConsoleWrite($aArray[$i] & @CRLF) Next ; And that ends this section! For some reason, many people use the advance way more than the simple way . For more examples of loops see this post by @FrancescoDiMuro! Interpreting Multi-Dimensional Arrays Yeah, its the most brain squeezing problem for newbies, Imagining an 3D Array... I will explain it in a very simple way for ya, so stop straining you brain now! . This way will work for any array regardless of its dimensions... Ok, Lets start... You can imagine an array as a (data) mine of information: ; Note that: ; Dimension = Level (except the ground level :P) ; Element in a Dimension = Path ; Level 2 ----------\ ; Level 1 -------\ | ; Level 0 ----\ | | ; v v v Local $aArray[2][2][2] ; \-----/ ; | ; v ; Ground Level ; As you can see that $aArray is the Ground Level ; All the elements start after the ground level, i.e from level 0 ; Level 0 Contains 2 different paths ; Level 1 Contains 4 different paths ; Level 2 Contains 8 different paths ; When you want too fill some data in the data mine, ; You can do that like this: $aArray[0][0][0] = 1 $aArray[0][0][1] = 2 $aArray[0][1][0] = 3 $aArray[0][1][1] = 4 $aArray[1][0][0] = 5 $aArray[1][0][1] = 6 $aArray[1][1][0] = 7 $aArray[1][1][1] = 8 ; Don't get confused with the 0s & 1s, Its just tracing the path! ; Try to trace the path of a number with the help of the image! Its super easy! :D I hope you might have understand how an array looks, Mapping your way through is the key in Multi-Dimensional arrays, You take the help of notepad if you want! Don't be shy! Frequently Asked Questions (FAQs) & Their answers Q #1. What are Arrays? A. An Array is an datatype of an variable (AutoIt has many datatypes of variables like "strings", "integers" etc. Array is one of them). An Array can store information in a orderly manner. An Array consist of elements, each element can be considered as a variable (and yes, each element has its own datatype!). AutoIt can handle 16,777,216 elements in an Array, If you have an Array with 16,777,217 elements then AutoIt crashes. Q #2. Help! I get an error while declaring an Array!? A. You tried to declare an array like this: $aArray[1] = ["Data"] That is not the right way, Array is a special datatype, since its elements can be considered as individual variables you must have an declarative keyword like Dim/Global/Local before the declaration, So this would work: Local $aArray[1] = ["Data"] Q #3. How can I calculate the no. of elements in an array? A. The UBound function is your answer, Its what exactly does! If you have an multi-dimensional Array you can calculate the total no. of elements in that dimension by specifying the dimension in the second parameter of UBound Q #4. Why is my For...Next loop throwing an error while processing an Array? A. You might have done something like this: #include <MsgBoxConstants.au3> Local $aArray[10] = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10] Local $iMyNumber = 0 For $i = 0 To UBound($aArray) ; Concentrate here! $iMyNumber += $aArray[$i] Next MsgBox($MB_OK, "Sum of all Numbers!", $iMyNumber) Did you notice the mistake? UBound returns the no. of elements in an array with the index starting from 1! That's right, you need to remove 1 from the total no. of elements in order to process the array because the index of an array starts with 0! So append a simple - 1 to the statment: #include <MsgBoxConstants.au3> Local $aArray[10] = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10] Local $iMyNumber = 0 For $i = 0 To UBound($aArray) - 1 $iMyNumber += $aArray[$i] Next MsgBox($MB_OK, "Sum of all Numbers!", $iMyNumber) Q #5. Can an Array contain an Array? How do I access an Array within an Array? A. Yes! It is possible that an Array can contain another Array! Here is an example of an Array within an Array: ; An Array can contain another Array in one of its elements ; Let me show you an example of what I mean ;) #include <Array.au3> Global $aArray[2] $aArray[0] = "Foo" Global $aChildArray[1] = ["Bar"] $aArray[1] = $aChildArray _ArrayDisplay($aArray) ; Did you see that!? The 2nd element is an {Array} :O ; But how do we access it??? ; You almost guessed it, like this: ; Just envolope the element which contains the {Array} (as shown in _ArrayDisplay) with brackets (or parentheses)! :D ConsoleWrite(($aArray[1])[0]) ; NOTE the brackets () around $aArray[1]!!! They are required or you would get an syntax error! ; So this: $aArray[1][0] wont work! More FAQs coming soon!
    1 point
  23. 1 point
  24. @TheDcoder here is the result. For a small array with 10 element, _ArrayAdd is the faster method. This is the result ArrayAdd Time = 0.46618648011839 ms ArrayList Time = 2.82040846777807 ms But for a large array with 2225 elements, ArrayList is faster.This is the result ArrayAdd Time = 1449.32797699147 ms ArrayList Time = 48.0397075617342 ms
    1 point
  25. Not if you are returning it from a fuction. $aArray = StringSplit("123", "");
    1 point
×
×
  • Create New...