Jump to content

Search the Community

Showing results for tags '_arrayadd'.

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • General
    • Announcements and Site News
    • Administration
  • AutoIt v3
    • AutoIt Help and Support
    • AutoIt Technical Discussion
    • AutoIt Example Scripts
  • Scripting and Development
    • Developer General Discussion
    • Language Specific Discussion
  • IT Administration
    • Operating System Deployment
    • Windows Client
    • Windows Server
    • Office

Categories

  • AutoIt Team
    • Beta
    • MVP
  • AutoIt
    • Automation
    • Databases and web connections
    • Data compression
    • Encryption and hash
    • Games
    • GUI Additions
    • Hardware
    • Information gathering
    • Internet protocol suite
    • Maths
    • Media
    • PDF
    • Security
    • Social Media and other Website API
    • Windows
  • Scripting and Development
  • IT Administration
    • Operating System Deployment
    • Windows Client
    • Windows Server
    • Office

Categories

  • Forum FAQ
  • AutoIt

Calendars

  • Community Calendar

Find results in...

Find results that contain...


Date Created

  • Start

    End


Last Updated

  • Start

    End


Filter by number of...

Joined

  • Start

    End


Group


Member Title


Location


WWW


Interests

Found 4 results

  1. Edit: This is now part of beta 3.3.15.4 __________________________________________________________________________________________________ There is a _ArrayToString() but no _ArrayFromString(). ( searched in the forum and google ) The example is based on the _ArrayToString() help file, to show the reconstruction of the array. #include <Array.au3> #include <MsgBoxConstants.au3> Local $aArray[20] For $i = 0 To 19 $aArray[$i] = $i Next _ArrayDisplay($aArray, "1D Array") MsgBox($MB_SYSTEMMODAL, "Items 1-7", _ArrayToString($aArray, @TAB, 1, 7)) ConsoleWrite('>' & _ArrayToString($aArray, @TAB, 1, 7) & '<' & @CRLF) _ArrayDisplay(_ArrayFromString(_ArrayToString($aArray, @TAB, 1, 7), @TAB), "1D ArrayFromString") Local $aArray[10][10] For $i = 0 To 9 For $j = 0 To 9 $aArray[$i][$j] = $i & "-" & $j Next Next _ArrayDisplay($aArray, "2D Array") MsgBox($MB_SYSTEMMODAL, "Rows 4-7, cols 2-5", _ArrayToString($aArray, " :: ", 4, 7, @CRLF, 2, 5)) ConsoleWrite('>' & _ArrayToString($aArray, " :: ", 4, 7, @CRLF, 2, 5) & '<' & @CRLF) _ArrayDisplay(_ArrayFromString(_ArrayToString($aArray, " :: ", 4, 7, @CRLF, 2, 5), " :: ", @CRLF), "2D ArrayFromString") ; au3.user.calltips.api: ; _ArrayFromString($sString , [$sDelim_Col = "|" [, $sDelim_Row = @CRLF [, $iForce2D = 0]]]) Rebuild an array from _ArrayToString() ; #FUNCTION# ==================================================================================================================== ; Name ..........: _ArrayFromString ; Description ...: Reconstruct an array from _ArrayToString() or _SQLite_Display2DResult()** ; Syntax ........: _ArrayFromString($sArrayStr[, $sDelim_Col = "|", [$sDelim_Row = @CRLF, [$bForce2D = False]]]) ; Parameters ....: $sArrayStr : A string formated by _ArrayToString() or _SQLite_Display2DResult()** ; $sDelim_Col : [optional] default is "|" ; $sDelim_Row : [optional] default is @CRLF ; $bForce2D : [optional] default is False. True will force a 2 dimensional array even if 1 dimensional. ; Return values .: Success - An array ; Failure - Return 0 with error = 1 ; Link...........: https://www.autoitscript.com/forum/topic/197277-_arrayfromstring/ ; Author ........: argumentum ; Remarks .......: ** for _SQLite_Display2DResult(), $sDelim_Col must be declared. ; =============================================================================================================================== Func _ArrayFromString($sArrayStr, $sDelim_Col = "|", $sDelim_Row = @CRLF, $bForce2D = False) If $sDelim_Col = Default Then $sDelim_Col = "|" If $sDelim_Row = Default Then $sDelim_Row = @CRLF If $bForce2D = Default Then $bForce2D = False Local $aRow, $aCol = StringSplit($sArrayStr, $sDelim_Row, 3) $aRow = StringSplit($aCol[0], $sDelim_Col, 3) If UBound($aCol) = 1 And Not $bForce2D Then For $m = 0 To UBound($aRow) - 1 $aRow[$m] = StringStripWS($aRow[$m], 3) If $aRow[$m] == Int($aRow[$m]) Then $aRow[$m] = Int($aRow[$m]) Next Return $aRow EndIf Local $aRet[UBound($aCol)][UBound($aRow)] For $n = 0 To UBound($aCol) - 1 $aRow = StringSplit($aCol[$n], $sDelim_Col, 3) If UBound($aRow) > UBound($aRet, 2) Then Return SetError(1) For $m = 0 To UBound($aRow) - 1 $aRow[$m] = StringStripWS($aRow[$m], 3) If $aRow[$m] == Int($aRow[$m]) Then $aRow[$m] = Int($aRow[$m]) $aRet[$n][$m] = $aRow[$m] Next Next Return $aRet EndFunc ;==>_ArrayFromString PS: so, how to save an array to an ini file ? ( small array, the limitations of an ini file still applies ) #include <Array.au3>; For _ArrayDisplay() ; if you declare it, it will use it, else, use default ;Global $g_iniFile = @ScriptDir & "\ThisTest.ini" Example() Func Example() Local $n, $aTest, $aArray[3] = ["00", "one", "2"] ; if is not in the INI file, it will save it $aTest = IniGet("Test", $aArray) _ArrayDisplay($aTest, "1st") ; since is saved, it'll recall it $aTest = IniGet("Test") For $n = 0 To UBound($aTest) - 1 ; ..just to show the elements found as integer If IsInt($aTest[$n]) Then $aTest[$n] &= " = IsInt() = " & (IsInt($aTest[$n]) = 1) Next _ArrayDisplay($aTest, "2nd") EndFunc ;==>Example Func IniGet($sKey, $vDefault = Default, $sSection = "Settings") Local Static $ini = IsDeclared("g_iniFile") ? Eval("g_iniFile") : StringTrimRight(@ScriptFullPath, 4) & ".ini" Local $v, $s = IniRead($ini, $sSection, $sKey, Chr(1)) If $s = Chr(1) Then If $vDefault == Default Then Return SetError(1, 0, "") Else IniSet($sKey, $vDefault, $sSection) Return $vDefault EndIf EndIf $v = StringLeft($s, 1) Switch $v Case "i" Return Int(StringTrimLeft($s, 2)) Case "a" Return _ArrayFromString(BinaryToString(StringTrimLeft($s, 2)), Chr(1), Chr(2)) Case "d" Return Binary(StringTrimLeft($s, 2)) Case Else Return String(StringTrimLeft($s, 2)) EndSwitch EndFunc ;==>IniGet Func IniSet($sKey, $vValue, $sSection = "Settings") Local Static $ini = IsDeclared("g_iniFile") ? Eval("g_iniFile") : StringTrimRight(@ScriptFullPath, 4) & ".ini" If IsInt($vValue) Then $vValue = "i:" & $vValue ElseIf IsArray($vValue) Then $vValue = "a:" & StringToBinary(_ArrayToString($vValue, Chr(1), -1, -1, Chr(2))) ElseIf IsBinary($vValue) Then $vValue = "d:" & $vValue Else $vValue = "s:" & $vValue EndIf $vValue = IniWrite($ini, $sSection, $sKey, $vValue) Return SetError(@error, @extended, $vValue) EndFunc ;==>IniSet ; au3.user.calltips.api: ; _ArrayFromString($sString , [$sDelim_Col = "|" [, $sDelim_Row = @CRLF [, $iForce2D = 0]]]) Rebuild an array from _ArrayToString() ; #FUNCTION# ==================================================================================================================== ; Name ..........: _ArrayFromString ; Description ...: Reconstruct an array from _ArrayToString() or _SQLite_Display2DResult()** ; Syntax ........: _ArrayFromString($sArrayStr[, $sDelim_Col = "|", [$sDelim_Row = @CRLF, [$bForce2D = False]]]) ; Parameters ....: $sArrayStr : A string formated by _ArrayToString() or _SQLite_Display2DResult()** ; $sDelim_Col : [optional] default is "|" ; $sDelim_Row : [optional] default is @CRLF ; $bForce2D : [optional] default is False. True will force a 2 dimensional array even if 1 dimensional. ; Return values .: Success - An array ; Failure - Return 0 with error = 1 ; Link...........: https://www.autoitscript.com/forum/topic/197277-_arrayfromstring/ ; Author ........: argumentum ; Remarks .......: ** for _SQLite_Display2DResult(), $sDelim_Col must be declared. ; =============================================================================================================================== Func _ArrayFromString($sArrayStr, $sDelim_Col = "|", $sDelim_Row = @CRLF, $bForce2D = False) If $sDelim_Col = Default Then $sDelim_Col = "|" If $sDelim_Row = Default Then $sDelim_Row = @CRLF If $bForce2D = Default Then $bForce2D = False Local $aRow, $aCol = StringSplit($sArrayStr, $sDelim_Row, 3) $aRow = StringSplit($aCol[0], $sDelim_Col, 3) If UBound($aCol) = 1 And Not $bForce2D Then For $m = 0 To UBound($aRow) - 1 $aRow[$m] = StringStripWS($aRow[$m], 3) If $aRow[$m] == Int($aRow[$m]) Then $aRow[$m] = Int($aRow[$m]) Next Return $aRow EndIf Local $aRet[UBound($aCol)][UBound($aRow)] For $n = 0 To UBound($aCol) - 1 $aRow = StringSplit($aCol[$n], $sDelim_Col, 3) If UBound($aRow) > UBound($aRet, 2) Then Return SetError(1) For $m = 0 To UBound($aRow) - 1 $aRow[$m] = StringStripWS($aRow[$m], 3) If $aRow[$m] == Int($aRow[$m]) Then $aRow[$m] = Int($aRow[$m]) $aRet[$n][$m] = $aRow[$m] Next Next Return $aRet EndFunc ;==>_ArrayFromString PS2: https://www.autoitscript.com/trac/autoit/ticket/3696#ticket <-- completed.
  2. Hi all, How to add 2 elements to a 2D array. This is my code, But not working. Local $ResArray[0][1] ; Declaring an empty array Local $Elem1 = 10 Local $Elem2 = 20 _ArrayAdd($ResArray, $Elem1, 0) ; Trying to add first column _ArrayAdd($ResArray, $Elem2, 1) ; Trying to add second column _ArrayDisplay($ResArray)This will only add the first element.
  3. I just updated to the newest version of AutoIT and when I add a line of text containing "|" characters to my array using _ArrayAdd(), the array ends up with each element containing a part of my string broken at "|". So, if I had a string like "A|B|C|D", and I did an _arrayAdd($ar, "A|B|C|D), my array then contains 6 elements: [0] = 5 [1] = A [2] = B [3] = C [4] = D I see that the calling syntax in the old AutoIT version is quite different than the new syntax: old: _ArrayAdd(ByRef $avArray, $vValue) new: _ArrayAdd ( ByRef $aArray, $vValue [, $iStart = 0 [, $sDelim_Item = "|" [, $sDelim_Row = @CRLF [, $hDataType = 0]]]] ) The new syntax is not backwards compatible. Sample code: #include <Array.au3> global $ar, $str, $outstr = "" $str = "A|B|C|D" $ar = stringsplit("","") _ArrayAdd($ar, $str) $outstr &= ubound($ar) & @crlf for $x = 0 to ubound($ar) - 1 $outstr &= $ar[$x] & @CRLF Next msgbox(0, "INFO", $outstr) New Version info: Version 3.4.4 Jul 13 2014 20:07:38 Old Version info: Version 3.3.6 Dec 30 2013 15:53:31
  4. Hi all Im still New To Autoit and would realy like some help ... I have gone through some examples and other code on the forum but now I am stuck see comments on what I want to do . #RequireAdmin #include <IE.au3> #include <MsgBoxConstants.au3> #include <File.au3> #include <String.au3> #include <Array.au3> Global $oIE = _IECreate("https://www.harryhomers.org/et/forum/viewtopic.php?f=89&t=4309", 0, 0, 1, 0) Global $oElements = _IETagNameAllGetCollection($oIE) Global $oID = _IEGetObjById($oIE, "p41827") Global $ListArray[1] #cs ; the list I want to get is 1 - 20 max 30 and there names . The DIV ID is p41827 <div class="content">HarryHomers can be found at 85.236.100.205:<span style="font-weight: bold">27960</span><br /><br /><ul>HH Bot Multi campaign **<br /><br />1. NAME 1<br />2. NAME 2<br />3. NAME 3<br />4. NAME 4<br /> 5. NAME 5<br />6. NAME 6<br />7. NAME 7<br />8. NAME 8<br />9. NAME 9<br />10. NAME 10<br />11. NAME 11<br />12. NAME 12<br />13. NAME 13<br />14. NAME 14<br /> 15. NAME 15<br />16. NAME 16<br />17. NAME 17<br />18. NAME 18<br />19. NAME 19<br />20. NAME 20<br /> </ul> #ce For $oElement in $oElements Local $_sSourceTAG = $oElement.tagname Local $_sSourceTEXT = $oElement.innerText Local $_sSourceID = $oElement.id Local $_sSourceHTML = $oElement.innerhtml If $_sSourceID = "p41827" Then ;Test message box MsgBox($MB_SYSTEMMODAL, "MY TAG ID", "Innertext: " & $_sSourceTAG & @CRLF & "id: " & $_sSourceID & @CRLF & "innerText: " & $_sSourceTEXT) MsgBox($MB_SYSTEMMODAL, "MY HTML", "Innerhtml: " & "id: " & $_sSourceID & $_sSourceHTML) $oData = _IEPropertyGet($oIE, "strong") $Check = StringRight($oData, 11) If $Check = "ohnDory</A>" Then ;Test message box MsgBox($MB_SYSTEMMODAL, "SEARCH FOUND", "The characters are: " & $Check ) $ArraySplit1 = StringSplit($oData, ".") For $ArrayItem in $ArraySplit1 $ArrayItem = StringSplit($ArrayItem, "<BR>", 1) If $ArrayItem[0] > 1 Then If $ArrayItem[2] > 0 Then $ArrayItem[1] = StringStripWS($ArrayItem[1], 3) _ArrayAdd($ListArray, $ArrayItem[1]) EndIf EndIf If StringInStr($ArrayItem[1], "</UL>") Then $POS = StringInStr($ArrayItem[1], "</UL>") - 1 $String = StringLeft($ArrayItem[1], $POS) $String = StringStripWS($String, 3) _ArrayAdd($ListArray, $String) EndIf Next Else ; Not correct so ignore MsgBox($MB_SYSTEMMODAL, "NOT FOUND", "The characters are: " & $Check ) EndIf EndIf Next _ArrayDisplay($ListArray) _ArrayReverse($ListArray) _ArrayPop($ListArray) _ArrayReverse($ListArray) _ArrayDisplay($ListArray, "Map List Array Final View") sleep(2500) _IEQuit($oIE) #cs ; note the html (map names) does change once a month ; save txt file #ce ;_FileWriteLog(@TempDir & "\list.txt", $ListArray)
×
×
  • Create New...