Jump to content
Sign in to follow this  
Busti

got an error in script but i cant find it -_-

Recommended Posts

see post above^^

I did, I'm still lost... not much on guessing :D

Edit:

I ASSumed you were saying that one or both of those 2 functions were causing the double semi colon issue... I just gave a solution for that. If this is something different, then you should start a new thread.

Edited by SmOke_N

Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.

Share this post


Link to post
Share on other sites

this version wil handle ;;

Func _DivDub($sText, $vDelim = ';')
    Local $aSplit = StringSplit($sText, $vDelim)
    Local $sNewString
    $sText = $vDelim & $sText & $vDelim
    For $iCount = 1 To UBound($aSplit) - 1
        If $aSplit[$iCount] = "" Then ContinueLoop
        If StringInStr($sText, $vDelim & $aSplit[$iCount] & $vDelim) Then
            $sText = StringReplace($sText,$aSplit[$iCount] & $vDelim, '')
            $iExtended = @extended
            If $iExtended > 1 Then
                $sNewString &= $aSplit[$iCount] & '*' & $iExtended & $vDelim
            Else
                $sNewString &= $aSplit[$iCount] & $vDelim
            EndIf
        EndIf
    Next
    Return StringTrimRight($sNewString, 1)
EndFunc

Share this post


Link to post
Share on other sites

this version wil handle ;;

Func _DivDub($sText, $vDelim = ';')
    Local $aSplit = StringSplit($sText, $vDelim)
    Local $sNewString
    $sText = $vDelim & $sText & $vDelim
    For $iCount = 1 To UBound($aSplit) - 1
        If $aSplit[$iCount] = "" Then ContinueLoop
        If StringInStr($sText, $vDelim & $aSplit[$iCount] & $vDelim) Then
            $sText = StringReplace($sText,$aSplit[$iCount] & $vDelim, '')
            $iExtended = @extended
            If $iExtended > 1 Then
                $sNewString &= $aSplit[$iCount] & '*' & $iExtended & $vDelim
            Else
                $sNewString &= $aSplit[$iCount] & $vDelim
            EndIf
        EndIf
    Next
    Return StringTrimRight($sNewString, 1)
EndFunc
Jdeb... wouldn't just be easier to do the double delim StringReplace before the stringsplit()? Or maybe not smarter incase there are 3+...

Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.

Share this post


Link to post
Share on other sites

but what is if there are ;;; or ;;;; or ;;;;;;;;;;;;;;;; ???

His example covers that Busti with the ContinueLoop, min wouldn't cover more than 2 delimeters.

Edit:

Proof of concept:

Edited by SmOke_N

Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.

Share this post


Link to post
Share on other sites

but what is if there are ;;; or ;;;; or ;;;;;;;;;;;;;;;; ???

This implies you don't understand how it works..... :D

Share this post


Link to post
Share on other sites

im wired sry i cant understand anything now ... :D

Original String :

DivDubbed String:

BackConvertet String:

is return xD

€dit : sorry was an error in my function

Edited by Busti

My UDF's : Startet on : 06.06.2006_CaseSearchOrReplaceStr();~> Searches OR Replaces a String,;~> With or Without Casesensivity

Share this post


Link to post
Share on other sites

sorry for my doubblepost, but i found the old version of my script, and i think its funny to see what i did before, the hell much code !:

Func __FormatMultiple($__StringOrArray, $mode = 1, $ret = 1, $delim = ";"); this func is for shorter Code
    Local $using = $__StringOrArray
    Local $__test
    Local $ATTACK = 0, $count = 0, $changetonextloop = 0, $ranthrough = 0, $gescount = 0, $string = ""
    If $mode = 1 Then
        $_split = StringSplit($using, $delim)
        For $_i = 1 To $_split[0]
            
            If $_i + 1 <> (UBound($_split)) Then
                MsgBox(0,"", $_split[$_i + 1] & @CRLF & $_split[$_i] &@CRLF & UBound($_split) )
                If $_split[$_i + 1] == $_split[$_i]Then
                    $ATTACK = 1
                EndIf
            EndIf
            If $_i + 1 <> (UBound($_split)) Then
                dbg("ATTACK :" & $ATTACK & " --- " & $_split[$_i] & "->" & $_split[$_i + 1] & @LF)
            Else
                dbg("ATTACK :" & $ATTACK & " --- end of array" & @LF)
            EndIf
            If $ATTACK = 1 Then
                For $i = $_i To $_split[0]
                    If $_split[$i] <> $_split[$_i]Then
                        $changetonextloop = 1
                        dbg("ChangeToNextLoop :" & $changetonextloop & @LF)
                        ExitLoop
                    EndIf
                    If $changetonextloop = 1 Then
                        
                        For $_iTest= ($_i) To ($_i + $count) - 3
                            dbg("current word :" & $_split[$_iTest] & " -> count: " & $_iTest & @LF)
                            $_split[$_iTest] = ""
                            $gescount += 1
                        Next
                        $_split[$i - 1] = $_split[$i - 1] & "*" & $count
                    ;$_i += $count
                        $gescount = $count
                        $count = 0
                        $changetonextloop = 0
                    EndIf
                    $count += 1
                    
                Next
                $ATTACK = 0
            EndIf
            For $_zu = 1 To $_split[0];-$gescount
                If $_split[$_zu] <> "" Then
                    $string &= $_split[$_zu] & $delim
                EndIf
            Next
            dbg("current string :" & $string & " ||-->.SplitCount :" & $_split[0] & " ||-->.GesCount :" & $gescount & @LF)
            $gescount = 0
            $_split = StringSplit($string, $delim)
            $string = ""
            
        Next
        Return $_split
    ElseIf $mode = 2 Then
        
        
    EndIf
EndFunc  ;==>__FormatMultiple
func dbg($m)
consolewrite($m&@LF)
endfunc

My UDF's : Startet on : 06.06.2006_CaseSearchOrReplaceStr();~> Searches OR Replaces a String,;~> With or Without Casesensivity

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  

×
×
  • Create New...