Sign in to follow this  
Followers 0
Mast3rpyr0

_arrayDelete help

3 posts in this topic

Ok ive already finished this program once but gotta re write it cause someone stole my flashdrive.... anyway i had a section that would delete a subscript of an array if it was blank and it worked before but now it doesnt. These are two ways i tried it this time but they dont work.

While Not @error
    $i = _ArraySearch($networkListArray, "")
            _ArrayDelete($networkListArray, $i)
            $arrStep = $arrStep - 1
WEndoÝ÷ Ù«­¢+Ø%½ÈÀÌØí¤ôÀѼÀÌØí¹Õ´´Ä($%%ÀÌØí¹Ñݽɭ1¥ÍÑÉÉålÀÌØí¥tôÅÕ½ÐìÅÕ½ÐìQ¡¸($$%}ÉÉå±Ñ ÀÌØí¹Ñݽɭ1¥ÍÑÉÉä°ÀÌØí¤¤($$$ÀÌØíÉÉMÑÀôÀÌØíÉÉMÑÀ´Ä($%¹%(%9áÐ

$num is what the array was initialized with, being line numbers from a txt file. Some lines didnt meet the criteria to be put into the array so the array is now too large and blank subscripts must be deleted.

$arrStep was just a counter used to increment the array subscript if something did meet the criteria and was added to the array.

Any ideas?

Share this post


Link to post
Share on other sites



Ok ive already finished this program once but gotta re write it cause someone stole my flashdrive.... anyway i had a section that would delete a subscript of an array if it was blank and it worked before but now it doesnt. These are two ways i tried it this time but they dont work.

While Not @error
    $i = _ArraySearch($networkListArray, "")
            _ArrayDelete($networkListArray, $i)
            $arrStep = $arrStep - 1
WEndoÝ÷ Ù«­¢+Ø%½ÈÀÌØí¤ôÀѼÀÌØí¹Õ´´Ä($%%ÀÌØí¹Ñݽɭ1¥ÍÑÉÉålÀÌØí¥tôÅÕ½ÐìÅÕ½ÐìQ¡¸($$%}ÉÉå±Ñ ÀÌØí¹Ñݽɭ1¥ÍÑÉÉä°ÀÌØí¤¤($$$ÀÌØíÉÉMÑÀôÀÌØíÉÉMÑÀ´Ä($%¹%(%9áÐ

$num is what the array was initialized with, being line numbers from a txt file. Some lines didnt meet the criteria to be put into the array so the array is now too large and blank subscripts must be deleted.

$arrStep was just a counter used to increment the array subscript if something did meet the criteria and was added to the array.

Any ideas?

First method should be like this I think

While Not @error
    $i = _ArraySearch($networkListArray, "")
        if $i > -1 then _ArrayDelete($networkListArray, $i)
            $arrStep = $arrStep - 1; don't know what this is for
WEnd

Second method will fail I think because when you are incrementing through an array from first to last and possibly deleting some elements the incrememt variable will be wrong if you delete an element thereby changing the indexes of all following elements. So you must go from last to first

For $i = $num-1 to 0 step -1
        If $networkListArray[$i] = "" Then
            _ArrayDelete($networkListArray, $i)
            $arrStep = $arrStep - 1
        EndIf
    Next

Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0