Search the Community
Showing results for tags '2D'.
-
mesale0077 asked me whether I could code some CSS loading animations from different web sites. These are the results using GDI+ (AutoIt v3.3.12.0+ required!): _GDIPlus_MonochromaticBlinker.au3 / _GDIPlus_RotatingBokeh.au3 _GDIPlus_SpinningCandy.au3 / _GDIPlus_SteamPunkLoading.au3 _GDIPlus_IncreasingBalls.au3 / _GDIPlus_PacmanProgressbar.au3 _GDIPlus_StripProgressbar.au3 / _GDIPlus_RingProgressbar.au3 _GDIPlus_LineProgressbar.au3 / _GDIPlus_SimpleLoadingAnim.au3 _GDIPlus_TextFillingWithWater.au3 / _GDIPlus_MultiColorLoader.au3 _GDIPlus_LoadingSpinner.au3 / _GDIPlus_SpinningAndPulsing.au3 _GDIPlus_TogglingSphere.au3 / _GDIPlus_CloudySpiral.au3 _GDIPlus_GlowingText.au3 (thanks to Eukalyptus) / _GDIPlus_HypnoticLoader.au3 _GDIPlus_RotatingRectangles.au3 / _GDIPlus_TRONSpinner.au3 _GDIPlus_RotatingBars.au3 / _GDIPlus_AnotherText.au3 (thanks to Eukalyptus) _GDIPlus_CogWheels.au3 (thanks to Eukalyptus) / _GDIPlus_DrawingText.au3 (thanks to Eukalyptus) _GDIPlus_GearsAnim.au3 / _GDIPlus_LEDAnim.au3 _GDIPlus_LoadingTextAnim.au3 / _GDIPlus_MovingRectangles.au3 _GDIPlus_SpinningAndGlowing.au3 (thanks to Eukalyptus) / _GDIPlus_YetAnotherLoadingAnim.au3 _GDIPlus_AnimatedTypeLoader.au3 / _GDIPlus_Carousel.au3 Each animation function has a built-in example how it can be used. AiO download: GDI+ Animated Wait Loading Screens.7z (previous downloads: 1757) Big thanks to Eukalyptus for providing several examples. Maybe useful for some of you Br, UEZ PS: I don't understand CSS - everything is made out of my mind, so it might be different from original CSS examples
-
We often have to get a 2D from a 1D array. A good example is with StringRegExp : it can only return a 1D array. But it can be interesting to transform the result to a 2D array. Of course, it's easy to make it, but I think this function could help someone. First, an example : ; #EXAMPLE# ===================================================================================================================== #Include <Array.au3> Local $sString = "<select>" & @CRLF & _ " <option value='volvo'>Volvo</option>" & @CRLF & _ " <option value='saab'>Saab</option>" & @CRLF & _ " <option value='mercedes'>Mercedes</option>" & @CRLF & _ " <option value='audi'>Audi</option>" & @CRLF & _ " <option value='porsche'>Porsche</option>" & @CRLF & _ "</select>" Local $aValues = StringRegExp($sString, "value='([^']+)'>([^<]+)", 3) _ArrayDisplay($aValues, "1D Array") Local $aValues2D = _Array1DTo2D($aValues, 2, 0, 0, 0) _ArrayDisplay($aValues2D, "2D Array") ; =============================================================================================================================== Now, the function : ; #FUNCTION# ==================================================================================================================== ; Name ..........: _Array1DTo2D ; Description ...: Transforms a 1D to a 2D array. ; Syntax ........: _Array1DTo2D($avArray, $iCols[, $iStart = 0[, $iEnd = 0[, $iFlag = 0]]]) ; Parameters ....: $avArray - Array to modify. ; $iCols - Number of columns to transform the array to. ; $iStart - [optional] Index of array to start the transformation. Default is the first element. ; $iEnd - [optional] Index of array to stop the transformation. Default is the last element. ; $iFlag - [optional] If set to 1, the array size must to a multiple of $iCols. Default is 0. ; Return values .: Success : Returns a 2D array ; Failure : Returns 0 and sets @error to : ; 1 - $aArray is not an array ; 2 - $iStart is greater than $iEnd ; 3 - $aArray is not a 1D array ; 4 - $aArray size is not a multiple of $iCols ; Author ........: jguinch ; =============================================================================================================================== Func _Array1DTo2D($avArray, $iCols, $iStart = 0, $iEnd = 0, $iFlag = 0) If $iStart = Default OR $iStart < 0 Then $iStart = 0 If $iEnd = Default Then $iEnd = 0 If NOT IsArray($avArray) Then Return SetError(1, 0, 0) If UBound($avArray, 0) <> 1 Then Return SetError(3, 0, 0) Local $iUBound = UBound($avArray) - 1 If $iEnd < 1 Then $iEnd = $iUBound If $iEnd > $iUBound Then $iEnd = $iUBound If $iStart > $iEnd Then Return SetError(2, 0, 0) Local $iNbRows = ($iEnd - $iStart + 1) / $iCols If $iFlag AND IsFloat($iNbRows) Then Return SetError(2, 0, 0) Local $aRet[ Ceiling($iNbRows) ][$iCols] Local $iCol = 0, $iRow = 0 For $i = $iStart To $iEnd If $iCol = $iCols Then $iCol = 0 $iRow += 1 EndIf $aRet[$iRow][$iCol] = $avArray[$i] $iCol += 1 Next Return $aRet EndFunc I hope it is clear enough
-
- 3 comments
- 3 reviews
-
- gdi+
- useless scripts
-
(and 3 more)
Tagged with:
-
I am reading a CSV file which is tab seperated as below. Local $aArray = FileReadToArray($file) And now, I am splitting this main array record wise so that Array contains internally another arrow to represent each row. For $i = 0 to (UBound($aArray) - 1) ;MsgBox(0,"",$aArray[$i]) $aArray[$i] = StringSplit(StringStripCR($aArray[$i]), Chr(9),2);Chr(9) for tab ;_ArrayDisplay($aArray[$i]) Next Afther that, _ArrayDIsplay is able to see the individual internal arrays. _ArrayDisplay($aArray[1]) But If I try to access the individual element of it as below.It is not showing any result. MsgBox(0,"",$aArray[1][1]) Any suggestion, below is the sample csv file. New Text Document.csv
-
Hi guys! I took @GaryFrost's Scripting Dictionary UDF and made just a few modifications. It now accepts multiple Scripting Dictionary objects around your script (many at once) and also allows you to choose any name for your variable. Also, it now uses OOP-like approach as proposed by @guinness. The modifications were too simple (and I would post it on the original thread, but it's dated 2007) so all credit goes to @GaryFrost. Example: #include 'scriptingdic.au3' #include <Array.au3> ; Needed only for _ArrayDisplay, and not required by the lib ; Init the object $oObj = _InitDictionary() ; Adding a single value _AddItem($oObj, 0, "Test") ; And showing it msgbox(0, '', _Item($oObj, 0)) ; Adding an array Dim $aArr[] = [0, -80, -49, -44, 80, 100, 8, 7, 6, 5, 4, 3, 2, 1] _AddItem($oObj, 1, $aArr) ; And showing it _ArrayDisplay(_Item($oObj, 1)) ; We can also use this approach: $oObj3 = _InitDictionary() $oObj.Add("test", "foo") MsgBox(0, '', $oObj.Item("test")) Download: scriptingdic.au3
-
Here some useless graphical examples using GDI+, made for fun (my 1st GDI+ codes ): !Some examples may run slowly on WinXP machines (workaround in this thread)! Some examples using Hex() function need adjustment when running on AutoIt version 3.3.8.0+ otherwise colors are flashing (fixed versions in AiO package below)!!! #01 Flying Pearl Necklaces: Source code here (577 downloads previously)! Flying Pearl Necklaces.au3 #02 Flying Squares: Source code here (265 downloads previously)! Flying Squares.au3 #03 Rotating Squares: Source code here! Rotating_Squares.au3 #04 Plasma & Plasma Variant: Source codes here! Plasma: Plasma.au3 Plasma Variant: Plasma Variante.au3 #05 L-System Fractals: Source code here (382 downloads previously)! L-System Fractals.7z #06 Sinus Scroller: Source code here (218 downloads previously)! Sinus Scroller.au3 #07 Visualization: Analog Meter: download here (including source, needed files and compiled exe): Source code + needed files here (473 downloads previously)! Visualizer_Analog Meter.7z More GDI+ visualizations here by monoceres or by Eukalyptus Audio Visualization Collection (German site) #08 Particle Catapult: Source code here (70 downloads previously)! Particle_Catapult.au3 #09 Rotating Cube: Source code here (79 downloads previously)! Rotating_Cube.au3 #10 Simple Ball Collision Simulation: Source code here (35 downloads previously)! Simple_Ball_Collision_Simulation.au3 (it is not finished yet! look from time to time into this thread for an update! Nice tutorial here) #11 Particle Explosions: Source code here: Explosions__from_AutoIteroids_.au3 #12 Rotating Letters: Source codes here: Rotating Letters.au3 Transparent version (87 downloads previously): Rotating Letters Transparent.au3 #13 Rotating Cube 2: Source code here (53 downloads previously): Rotating Cube 2.au3 #14 Rotating Cube 2 with Textures: Source code here (68 downloads previously): Rotating Cube 2 + Textures.7z #15 Rotating Cube 2 with some examples from above on each surface: Source code here (55 downloads previously): Rotating Cube 2 + animated surfaces.7z #16 Rotating Cube 2 simple: Source code here: Rotating Cube 2 - Simple.au3 Or with background pic or Rotating Cube 2 simple + Background #17 Tramp of Particles: Source code here: Tramp of Particles.au3 #18 Twister: Source code here: Twister.au3 WinAPI version is 2.5x faster (look in AiO archive)! #19 Star Burst: Source code here: Star Burst.au3 #20 Warp Starfield: Source code here: Warp Starfield.au3 #21 Plasma 2: Source code here: Plasma 2.au3 #22 Isometric Level-3 Cube: Source code here: Isometric Level-3 Cube.au3 #23 Zoomer: Source code here (7 downloads previously): Zoomer.au3 GDIP.au3 needed for Zoomer! #24 Suspended Cloth Simulation: Source code here: Suspended Cloth Simulation.au3 #25 Visualizer: Oscilloscope Farbrausch: Source code here (30 downloads previously): Visualizer Oscilloscope Farbrausch.au3 To run Visualizer Oscilloscope Farbrausch.au3 properly you need following files: Bass.au3, BassExt.au3, Bass.dll and BassExt.dll. These files can be found in AiO package or on German AutoIt site! #26 Im- Exploding Particle Logo: Source code here: Im- Exploding Particle Logo.7z #27 Pixel Text Effect: Source code here (12 downloads previously): Pixel Text Effect.7z or with ♬chip sound♫ aka demo style (download from German AutoIt site or from AiO archive). #27 works best on Vista+ machines! #28 Star Wars Scroller: Source code here: Star Wars Scroller.au3 For a complete Star Wars Intro have a look to eukalyptus' Star-Wars Intro (see below!) #29 Rotated Letters Simple: Source code here: Rotated Letters Simple.au3 #30 Ballet of Letters: Source code here: Ballet of Letters.au3 #31 Perfect Illusion: Source code here: Perfect Illusion Variant 1.au3 Perfect Illusion Variant 2.au3 Perfect Illusion Variant 3.au3 Mesmerizing Squares Screensaver (previous downloads approx. 100): Mesmerizing_Squares_Screensaver.au3 (compiled version here): Don't stare too long on it or you will be mesmerized One more: Rotating triangle + vertical scroller + music (modification of monoceres' code): Magic Lines Screesaver (110 downloads previously): Magic Lines Screensaver.7z Another screensaver - 3D Star Scrolling Screensaver (83 downloads previously): GDI+ 3D Star Scrolling Screensaver.au3 !Some examples may run slowly on WinXP machines (workaround in this thread)! Some examples using Hex() function need adjustment when running on AutoIt version 3.3.8.0+ otherwise colors are flashing (fixed versions in AiO package below)!!! AiO download link ☞ AiO1 or AiO2 ☜ (all examples above compiled + source codes packed with 7-Zip) Have a look also to the game I made using GDI+: Link: AUTOITEROIDS v1.018 Build 2011-06-09 (Final) (a clone of the game Asteroids made by Atari 1979) I hope you like it! Any kind of comment is welcome!!! My examples are all done with AutoIt v3.3.0.0 on Vista x32! Kudos to: monoceres, smashly, malkey, Eukalyptus and Authenticity! Check out Some Graphical Examples using GDI+ Vol. II build 2016-01-25 More examples made by other members in this thread (thanks you very much!): Spinning Flying Pearl Necklaces by smashly: Spinning Flying Squares by smashly and ProgAndy LMP Visualization by youknowwho4eva: SineWorm by monoceres: Enterprise Warp by youknowwho4eva: Confused ASCII by monoceres: Lissajous Curve by monoceres: Butterfly Curve by monoceres: ParticleCollisionFun2 by crashdemons: Extreme nice physic engine by moritz1243 (German site): Lingering Line by MvGulik: Scroller Sine Blobs by Lakes: Cube surface and 3D axis and by Lakes: by eukalyptus: by eukalyptus: Two more examples by eukalyptus: and FEEL FREE TO POST YOUR GDI+ EXAMPLES HERE,TOO!!! Have fun and regards, UEZ ✌ PS: more modified examples also here in this topic History of my useless scripts above:
-
Hi, I have a 2D array with 2 columns, the 1st column contains a "version string" and the 2nd column contains a generic string. I want to sort it in the descending order so the latest version comes first. #include <Array.au3> Local $aVersionsAndReleases[4][2] = [["0.2.8.9", "Release #1"], ["0.2.9.10", "Release #3"], ["0.2.9.11", "Release #4"], ["0.2.8.10", "Release #2"]] _ArraySort($aVersionsAndReleases, 1) ConsoleWrite(_ArrayToString($aVersionsAndReleases, ' - ')) _ArrayDisplay($aVersionsAndReleases) Unfortunately, _ArraySort isn't working here . This is the output generated by the script: 0.2.9.11 - Release #4 0.2.9.10 - Release #3 0.2.8.9 - Release #1 0.2.8.10 - Release #2 The expected result should be: 0.2.9.11 - Release #4 0.2.9.10 - Release #3 0.2.8.10 - Release #2 0.2.8.9 - Release #1 I am looking to develop an function which does this... but I don't know where to start . Can someone help me get started? Thanks in Advance! - TD.
-
Hello all, Summary: I have a basic piece of code that is to be a part of a much larger project; I just can't seem to get the right output. I'm retrieving two lots of powershell data into 2 x 1d arrays and trying to add them into a single 2d array. Retrieving the data together into the 2d array seemed harder, due to the application names varying too much to string split. Data being pulled is application name and GUID. From here I will use this info in a drop down box and an uninstall button to run the required command to remove the selected software (have this sorted already). Problem: When I merge the data it doesn't put the application name and GUID on the same row in differing columns eg. my test box has 24 applications plus some superfluous data from Powershell to be cleaned up by the _arraydeletes. Instead I end up with an array with 58 rows and 2 columns; whereas my temp 1d arrays have 28 rows. As you can see I've tried both _ArrayInsert and _ArrayAdd but I still get the same result. Question: Is there something that I'm doing wrong in putting the data into the 2d array or do I just need to do some more post processing to tidy it up and align the names and GUIDs? Code: #include <Array.au3> $Cmd1 = (" /c Powershell.exe " & Chr(34) & "Get-WmiObject -Class win32reg_addremoveprograms | where {$_.ProdID -like " & Chr(34) & Chr(123) & Chr(42) & Chr(125) & Chr(34) & "} | select DisplayName" & Chr(34)) $Cmd2 = (" /c Powershell.exe " & Chr(34) & "Get-WmiObject -Class win32reg_addremoveprograms | where {$_.ProdID -like " & Chr(34) & Chr(123) & Chr(42) & Chr(125) & Chr(34) & "} | select ProdID" & Chr(34)) Global $aNameGUID[1][2] ;_ArrayDisplay($aNameGUID) ReadApps($Cmd1,0) ;_ArrayDisplay($aNameGUID) ReadApps($Cmd2,1) _ArrayDisplay($aNameGUID) Terminate() Func ReadApps($Command,$col) $DOS = Run(@ComSpec & $Command, "", @SW_HIDE, $STDERR_CHILD + $STDOUT_CHILD) ProcessWaitClose($DOS) $DOSOut = StdoutRead($DOS) ;MsgBox(0,"Data",$DOSOut) ;Show the line items that we want in the array Local $tmpArray = StringSplit(StringTrimRight(StringStripCR($DOSOut), StringLen(@CRLF)), @CRLF) If @error Then MsgBox(0,"FAIL","I failed to find objects") Exit Else _ArrayDisplay($tmpArray) EndIf ;_ArrayDelete($tmpArray, 3) ;_ArrayDelete($tmpArray, 2) ;_ArrayDelete($tmpArray, 1) ;$tmpArray[0] = $tmpArray[0] - 3 For $i = 0 To UBound($tmpArray) - 1 ;_ArrayAdd($aNameGUID, $tmpArray[$i], $col) _ArrayInsert($aNameGUID, 0, $tmpArray[$i], $col) Next $tmpArray = 0 EndFunc ;==>ReadApps While 1 Sleep(1500) WEnd Func Terminate() Exit 0 EndFunc ;==>Terminate Thanks in advance, Luxyboy
-
Some Graphical Examples using GDI+ Vol. II build 2016-05-07 (33 examples) This is the continuation of "Some Graphical Examples using GDI+ Vol. I" with currently 33 examples in "snippet style". For downloads and screenshots just visit the download section. All examples should properly run on Win7+ operating systems / tested on AutoIt v3.3.14.2! More examples will follow from time to time. Thanks to Eukalyptus! Please report any issues / feel free to post any comment. Have fun.
-
Version v1.0.1.9
1,206 downloads
A remake of the arcade classical 2D game Asteroids® by Atari (1979). For more information visit AUTOITEROIDS topic. Keys: ctrl - shoot, up - thrust, left - turn left, right - turn right, space - hyper jump Game details: game is starting with 3 asteroids every 10.000 points increase of level (among other things amount of asteroids + 1) every 30.000 points extra live biggest asteroid = 20 points medium asteroid = 50 points smallest asteroid = 100 points big alien spaceship = 200 points small alien spaceship = 1000 point Br, UEZ PS: main code was written in 2009 and will not be continued! -
Hello, I wonder if there is a better way than this!: #include <Array.au3> Local $aArray[1][3] $aArray[0][0] = 1 $aArray[0][1] = 2 $aArray[0][2] = 3 ;$aArray[0] = [1, 2, 3] _ArrayDisplay($aArray)IIRC line no. 9 should work, but its not Thanks in Advance, TD
-
Appreciate some help with this Initially I had a [6][3] array & ArrayFindAll works Then I made it a [6][4] & then a [6][9] arrays & ArrayFindAll doesn't works @error = 6 - $vValue was not found in array #include <array.au3> Global $aArray[6][3] = [[1, "A", "1111"], [2, "B", "2222"], [3, "C", "3333"], [4, "D", "4444"], [5, "E", "5555"], [6, "F", "6666"]] ;Global $aArray[6][4] = [[1, "A", "1111","G"], [2, "B", "2222", "M"], [3, "C", "3333", "S"], [4, "D", "4444", "Y"], [5, "E", "5555", "B1"], [6, "F", "6666", "C1"]] ;Global $aArray[6][9] = [[1, "A", "1111", "G", "H","I","J","K","L"], [2, "B", "2222", "M","N", "O","P","Q", "R"], [3, "C", "3333", "S", "T","U","V","W","X"], [4, "D", "4444", "Y", "Z","A1","A2","A3","A4"], [5, "E", "5555", "B1", "B2","B3","B4","B5","B6"], [6, "F", "6666", "C1", "C2","C3","C4","C5","C6"]] _ArrayDisplay($aArray) Local $aiResult = _ArrayFindAll($aArray, "5555",0,0,0,1,3) If @error = 0 Then _ArrayDisplay($aiResult) Else MsgBox(0,"","Error " & @error) EndIf Exit
-
_FileWriteFromArray from 2D Array [BUG]
johnmcloud posted a topic in AutoIt General Help and Support
Hi guys, i have made this script: $File = _RecFileListToArray("C:\Test", "*.*", 1, 0, 0, 2, "", "") If IsArray($File) Then For $i = 1 To $File[0] $Time = FileGetTime($File[$i]) $dmyyyy = $Time[2] & "/" & $Time[1] & "/" & $Time[0] MsgBox(0,"FileDate", $File[$i] & " - " & $dmyyyy) Next EndIf The script working with MsgBox, so i have try to write the result on a txt like this: $ToWrite = $File[$i] & " - " & $dmyyyy $Log = @TempDir & "\log.txt" $LogCreate = FileOpen(@TempDir & "\log.txt", 1) _FileWriteFromArray($LogCreate, $ToWrite) FileClose($LogCreate) But not working, i have only the filename but not the date. What is the problem? Thanks for support -
Hi all, I need a hint. I'm not an adept coder by any means. I have a 2d array, and I want to copy records from the array to another 2d array. So for example, I can check strings inside the array and match them, and then write the whole row from the array to another array. So for array: Global $DeviceLocationList[1][4] I already can parse through it and check against an entry in a column, so I know the row number, but I can't figure out how to copy the entire row to a new entry in a different array in the same For loop. I am using __arrayadd for 2d arrays as downloaded from the forums to build the array. Below is a snippet where I build a 2d array, for example I would parse through that an might want to copy the record to another location. Apparently I'm too thick to understand how to read the entire row and pass it to a new array. :-( I'm looking at this page and still scratching my head -> '?do=embed' frameborder='0' data-embedContent>> (I use the below to get NIC card infos and then do <stuff> to them.) Func _GetNICHWKey($PNPFilter, $ENUMKey) For $i = 1 To 65535 $TopKey = RegEnumKey("HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Enum\" & $ENUMKey, $i) For $j = 1 To 65535 $SubKey = RegEnumKey("HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Enum\" & $ENUMKey & $TopKey, $j) If StringInStr($SubKey, $PNPFilter) Then For $k = 1 To 65535 $DeviceKey = RegEnumKey("HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Enum\" & $ENUMKey & $TopKey & "\" & $SubKey, $k) $DeviceSubKey = "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Enum\" & $ENUMKey & $TopKey & "\" & $SubKey & "\" & $DeviceKey If $DeviceKey = "" Then ExitLoop $DevName1 = RegRead($DeviceSubKey, "DeviceDesc") $DevName2 = StringSplit($DevName1, ";") $DevNameLoc = $DevName2[0] $NICENUMDevDesc = $DevName2[$DevNameLoc] $NICENUMDevLoc = RegRead($DeviceSubKey, "LocationInformation") $DevLoc1 = StringSplit($NICENUMDevLoc, ";") $DevLoc2 = $DevLoc1[0] $DevLoc3 = $DevLoc1[$DevLoc2] $DevLoc = $DevLoc3 Local $DEVLocadd[4] = [$NICENUMDevDesc, $DevLoc, "", $DeviceKey] __ArrayAdd($DeviceLocationList, $DEVLocadd, False) If @error <> 0 Then ExitLoop Next EndIf If $SubKey = "" Then ExitLoop If @error <> 0 Then ExitLoop Next If $TopKey = "" Then ExitLoop If @error <> 0 Then ExitLoop Next $DeviceLocationList[0][0] = UBound($DeviceLocationList) _ArraySort($DeviceLocationList, 0, 1, 0, 1); we sort the list of devices according to the index numbers, they end up in order of PCIbus, device, then port For $i = 1 To $DeviceLocationList[0][0] - 1 ; now we reference the location and deduce/insert the port number to position nr 2 by the ranking $DeviceLocationList[$i][2] = $i Next EndFunc ;==>_GetNICHWKey This is the __arrayadd function used to build the array. ; #FUNCTION# ==================================================================================================================== ; Name...........: __ArrayAdd ; Description ...: Adds a specified value or row at the end of an existing 1D or 2D array. ; Syntax.........: __ArrayAdd(ByRef $avArray, $vValue [, $NestArray = True]) ; Parameters ....: $avArray - Array to modify ByRef ; $vValue - Value to add, can be a 1D array if $avArray = 2D and $NestArray = False ; $NestArray - Optional flag if False causes array passed as $vValue to be interpreted as a 1D array ; of values to place in a single new row of a 2D array. Default = True, saves array as ; a single element. This flag is ignored if $avArray is 1D or $vValue is not an array. ; Return values .: Success - Index of last added item ; Failure - -1, sets @error to 1, and sets @extended to specify failure (see code below) ; Author ........: Jos van der Zande <jdeb at autoitscript dot com> ; Modified.......: Ultima - code cleanup ; ; PsaltyDS - Array and 2D $vValue inputs added ; Remarks .......: Each call to this function adds exactly one new row to $avArray. To add more rows use _ArrayConcatenate. ; Related .......: _ArrayConcatenate, _ArrayDelete, _ArrayInsert, _ArrayPop, _ArrayPush ; Link ..........; ; Example .......; Yes ; ================================================================================================================================= Func __ArrayAdd(ByRef $avArray, $vValue, $NestArray = True) Local $iBoundArray0, $iBoundArray1, $iBoundArray2, $iBoundValue1 If IsArray($avArray) = 0 Then Return SetError(1, 0, -1); $avArray is not an array $iBoundArray0 = UBound($avArray, 0); No. of dimesions in array If $iBoundArray0 > 2 Then Return SetError(1, 1, -1); $avArray is more than 2D $iBoundArray1 = UBound($avArray, 1); Size of array in first dimension If $iBoundArray0 = 2 Then $iBoundArray2 = UBound($avArray, 2); Size of array in second dimension If ($iBoundArray0 = 1) Or (IsArray($vValue) = 0) Or $NestArray Then ; If input array is 1D, or $vValue is not an array, or $NestArray = True (default) then save $vValue literally If $iBoundArray0 = 1 Then ; Add to 1D array ReDim $avArray[$iBoundArray1 + 1] $avArray[$iBoundArray1] = $vValue Else ; Add to 2D array at [n][0] ReDim $avArray[$iBoundArray1 + 1][$iBoundArray2] $avArray[$iBoundArray1][0] = $vValue EndIf Else ; If input array is 2D, and $vValue is an array, and $NestArray = False, ; then $vValue is a 1D array of values to add as a new row. If UBound($vValue, 0) <> 1 Then Return SetError(1, 2, -1); $vValue array is not 1D $iBoundValue1 = UBound($vValue, 1) If $iBoundArray2 < $iBoundValue1 Then Return SetError(1, 3, -1); $vValue array has too many elements ReDim $avArray[$iBoundArray1 + 1][$iBoundArray2] For $n = 0 To $iBoundValue1 - 1 $avArray[$iBoundArray1][$n] = $vValue[$n] Next EndIf ; Return index of new last row in $avArray Return $iBoundArray1
-
Hi, Could someone please look into the below issue and kindly advise. I have an array $CtrInfo[11][12] which has pre-defined information. However, the problem is depending on the situation I would like to use only 10 columns of this. Either Column 8 or Column 9 has to be skipped accordingly. To make this happen, I am trying to copy the information into another array ($NewCtrInfo[11][11]) so that the final set of values is available for usage. I have tried to use FOR statement for this purpose. I am encountering the error - Array variable has incorrect number of subscripts or subscript dimension range exceeded. Below is the code: ;Copy the last three columns of existing array into the new array For $clmcnt = 9 to 11 Step 1 For $rowcnt = 1 to 11 Step 1 Local $k = Execute("$rowcnt - 1") Local $l = Execute("$clmcnt - 1") Local $m = Execute("$clmcnt - 2") $NewCtrInfo[$rowcnt][$l] = $CtrInfo[$k][$m] Next Next
- 3 replies
-
- Two Dimenstion
- 2D
-
(and 1 more)
Tagged with:
-
Hi All, I'm still fairly new to this board, and just board search has helped a lot lately in general, requiring me not to post much. My Question now is, if I create an array (and more specifically a 2 dimensional array) that I'm checking, and using the "ReDim" function as needed to increase the size as need-be, do I need to delete the array at the end of it's scope to maintain memory management? I'm most accustomed to C++ with pointers and new-ing them into arrays, and the importance of deleting them at the end of the code. I as just wondering if their is a way to do this or if there is a Garbage collecting system in effect. I tried the old RTFM but there's nothing really on this topic and I felt I should ask to clarify this. Thanks for all your help!
- 3 replies
-
- Arrays Delete
- ReDim
-
(and 1 more)
Tagged with:
-
I have a modified version of the standard Array.au3 file that comes with AutoIt3. Most of the original _Arrayxxx functions didn't/don't support 2D arrays when using them. I have welded on the ability to use most of the existing functions with a 1 or 2D array. There are a couple of the _Array functions that I have not added this functionality to, mostly because I don't think it would be necessary and/or helpful for them to have it. Here is a list of the functions included in the Array.au3 file that have been added and modified, taken from the header of the file These modified functions are a drop in replacement for the original functions, they are backwards compatible with all scripts written to use the functions as originally written, but I have added the ability to use them with 2D arrays, as well as with 1D arrays. 2 of the new functions weren't written by me, _ArrayAddColumns and _ArrayDeleteColumn, but I have them in my arsenal of array functions so I figured it couldn't hurt to include them here as well. If anyone finds these useful, please let me know. If anyone finds any problems or bugs, I'd like to know that as well. Hopefully I have updated all of the function comment headers to reflect the changes, but if I have missed something let me know about that too so I can correct it. As an added bonus, I am also posting an array related function called _FileWriteFromArray2D, which will write a 2D array to a file and is a modified version of _FileWriteFromArray that only works with 1D arrays. This could probably be incorporated into the _FileWriteFromArray function so that it would be able to handle 1D and 2D arrays natively pretty easily. 11/10/2011 - Updated attachment Ran #AutoIt3Wrapper_Au3Check_Parameters=-d -w 1 -w 2 -w 3 -w- 4 -w 5 -w 6 -w 7 on the contents of the file to eliminate any warning messages that might be popping up. No functional changes to the functions, just cleaning up the mess of warning messages that didn't affect the working of the script, but might make the unwary nervous about them. All warnings have been fixed by declaring the variables correctly. _Array.au3
-
I had this FINISHED, lying around, waiting to be released here but I never got around to it. Now, here it is. Note 1: this is NOT using any images - it is only drawing-based! The sounds for this particular project were shamelessly ripped from elsewhere. Please let me know if it is too hard or too easy - more things can be added/changed! StarShooter.zip Known Bugs: Enemy phaser lines sometimes rarely draw towards 0,0 instead of towards you. Fixed If you go off-screen [wrapped] too many times or fly straight for too long, enemies clump/merge together on top of each other.