Jump to content

StringInStr with array why crash it ?


Recommended Posts

hi  guys  , i have  this  script  i dont understun why crashed when find stringinstring 

#cs ----------------------------------------------------------------------------

    AutoIt Version: 3.3.14.2
    Author:         faustf

    Script Function:
    Macro per usare Amazon come venditore non professionale

#ce ----------------------------------------------------------------------------

; Script Start - Add your code below here
;#cs
#include <MsgBoxConstants.au3>
#include <WinAPIFiles.au3>
#include <File.au3>
#include <IE.au3>
#include <Array.au3>

If ProcessExists("iexplore.exe") Then ; Check if the internet esplorer process is running.
    ProcessClose("iexplore.exe")
EndIf
;#ce

Global $iGTimeToCeck = "1000", $iGTimeOut = "1000"
Local $urlAmaS = "https://www.amazon.it/s/ref=nb_sb_noss?__mk_it_IT=%C3%85M%C3%85%C5%BD%C3%95%C3%91&url=search-alias%3Daps&field-keywords="
;Local $urlAmaS = "https://www.amazon.it/s/ref=sr_nr_p_76_0?fst=as%3Aoff&rh=n%3A425916031%2Cn%3A460080031%2Cn%3A460126031%2Ck%3Ai7%2Cp_76%3A490211031%7C490210031&keywords=i7&ie=UTF8&qid=1489074068&rnid=490209031" ; con opzione attiva amazon prime e spedizione gratis
;Local $urlAmaS = "https://www.amazon.it/s/ref=sr_st_price-asc-rank?keywords=" ; prima parte url per prezzo crescente
Local $sLUrl2 = "&__mk_it_IT=%C3%85M%C3%85Z%C3%95%C3%91&rh=i%3Aaps%2Ck%3A0190198457509&qid=1533231546&sort=price-asc-rank" ; opzione prezzo crescente
Global $sUrlAtom1 = "https://www.amazon.it/s/ref=sr_pg_"

Local $sLuser = "com"
Local $sLpass = ""

_Amazon_Search("TN329BK", $urlAmaS)
;_Amazon_Search("5032037108591", $urlAmaS)
;_Amazon_Search("iphone x", $urlAmaS)


Func _Amazon_Search($frases, $url, $Hide = 0, $slow = 0)

    If $Hide = 0 Then
        $Hide = 1
    EndIf
    If $slow = 0 Then
        $slow = 1000
    EndIf

    Global $oIE = _IECreate($url & $frases & $sLUrl2, 0, $Hide, 1, 1) ; <--- 0011 invisible explorer  <--- 0111 visible explorer
    _IELoadWait($oIE)
    Sleep($slow)
    Local $sText = _IEBodyReadText($oIE)
    Local $iFindBadPage = StringInStr($sText, "This page can’t be displayed")

    If $iFindBadPage <> 0 Then
        If ProcessExists("iexplore.exe") Then ; Check if the internet esplorer process is running.
            ProcessClose("iexplore.exe")
        EndIf
        Sleep($slow)
        $oIE = _IECreate($url & $frases, 0, $Hide, 1, 1) ; <--- 0011 invisible explorer  <--- 0111 visible explorer
        _IELoadWait($oIE, $iGTimeToCeck, $iGTimeOut)
    EndIf

    Local $sLHtml = _IEBodyReadHTML($oIE)
    ConsoleWrite($sLHtml)
    Local $sLText = _IEBodyReadText($oIE)
    If StringInStr($sLText, "non coincide con alcun prodotto") = 0 Then
        ;MsgBox(0,'','sono qui')
        FileDelete(@ScriptDir & "\TEMP\Amazon.html")
        _True_write_File(@ScriptDir & "\TEMP\Amazon.html", $sLHtml)
        ;MsgBox(0, '', 'modifico la pagina web')
        Local $hLFileOP = FileOpen(@ScriptDir & "\TEMP\Amazon.html", $FO_READ)
        Local $sLFileRead = FileRead($hLFileOP)
        ;Local $iLStopFlag1 = StringInStr($sLFileRead,'<div id="centerMinus">')
        Local $arraytest
        _FileReadToArray(@ScriptDir & "\TEMP\Amazon.html", $arraytest)
        Local $iLStopFlag1
        _ArrayDisplay($arraytest)

        For $j = 0 To UBound($arraytest) - 1

            Local $iLStopFlag1 = StringInStr($arraytest[$j], '<div id="centerMinus">')
            If $iLStopFlag1 <> 0 Then
                $arraytest = $j
            EndIf

            ConsoleWrite($j & @CRLF)

        Next

        MsgBox(0, '83', $arraytest)
        FileClose($hLFileOP)
        ;   MsgBox(0,'71',$iLStopFlag1)
        _FileDeleteLine(@ScriptDir & '\TEMP\Amazon.html', '', '1', $iLStopFlag1)

        ;Local $iLStartFlag = StringInStr(@ScriptDir & '\TEMP\Amazon.html','<div class="rightCol" id="paRightContent">')
        Local $hLFileOP = FileOpen(@ScriptDir & "\TEMP\Amazon.html", $FO_READ)
        Local $sLFileRead = FileRead($hLFileOP)
        Local $iLStopFlag1 = StringInStr($sLFileRead, '<div class="rightCol" id="paRightContent">')
        FileClose($hLFileOP)

        ;   MsgBox(0,'72',$iLStopFlag1)
        _FileDeleteLine(@ScriptDir & '\TEMP\Amazon.html', '', $iLStopFlag1, 'end')
        Local $hLFileOP = FileOpen(@ScriptDir & "\TEMP\Amazon.html", $FO_READ)
        Local $sLFileRead = FileRead($hLFileOP)

        ;Local $aL = StringRegExp($sLHtml, 'href="(.*?)"><img src="(.*?)" srcset="(.+?)title="(.*?)" href="', 3)
        ;_ArrayDisplay($aL)
        ;Local $aL1 = StringRegExp($sLHtml, '(?s)href="([^"]+)"><img src="([^"]+)"\h*srcset="[^"]+.*?title="([^"]+)" href="', 3)
        ;MsgBox(0,'','sono qui2')

        Local $sLPagSuccessiva = StringRegExp($sLFileRead, '<span id="pagnNextString">(.*?)</span>', 3)
        If IsArray($sLPagSuccessiva) Then ; controlla se ci sono piu pagine
            Local $aLAddres2Page = StringRegExp($sLFileRead, '<a href="\/s\/ref=sr_pg_2(.*?)">2<\/a>', 3)
            ;MsgBox(0,'','sono qui3')
            If IsArray($aLAddres2Page) Then
                Local $aLAddres2PageSplit1 = StringRegExp($aLAddres2Page[0], '(.*?)page', 3)
                Local $aLAddres2PageSplit2 = StringRegExp($aLAddres2Page[0], 'page=2(.*?)$', 3)

                Local $aL2 = StringRegExp($sLFileRead, 'text-bold">EUR (.*?)</span></a><span class=', 3)
                ;Local $aL = StringRegExp($sLHtml, 'cfMarker" alt="(.*?)" src="', 3)
                Local $aL = StringRegExp($sLFileRead, 'cfMarker" alt=(.*?) src="', 3)
                ConsoleWrite($sLFileRead)

                _ArrayDisplay($aL2)
                _ArrayDisplay($aL)
                _ArrayDisplay($aLAddres2Page)
                _ArrayDisplay($aLAddres2PageSplit1)
                _ArrayDisplay($aLAddres2PageSplit2)
            Else
                MsgBox(16, 'Errore', 'Problema con regexp url $aLAddres2Page ')
            EndIf

        Else ; se ce una pagina solo
            MsgBox(0, 'Info', 'non ci sono piu pagine')

        EndIf
        _ArrayDisplay($sLPagSuccessiva)


    Else

        MsgBox(0, 'Info', 'non coincide con alcun prodoto ' & $frases)
    EndIf

    #cs
        Local $oBtns = $oIE.document.GetElementsByTagName("input")
        For $oBtn In $oBtns
        $name = String($oBtn.id())
        $buttonOK = String($oBtn.type())
        If $name = "twotabsearchtextbox" Then
        _IEAction($oBtn, "click")
        _IEFormElementSetValue($oBtn, $frases)
        EndIf
        If $buttonOK = "submit" Then
        _IEAction($oBtn, "click")
        EndIf
        Next
    #ce
EndFunc   ;==>_Amazon_Search



; #INDEX# ========================================================================
; Title .........: GUI_Configure.au3
; AutoIt Version : 3.3.14.2++
; Language ......: Italian
; Description ...: A collection of Function for Logic of Gest
; Author ........: Faustf
; What do you do.: Write data in File
; Version .......: 0.0.1 BETA - Work in progress 15/03/2016
; Syntax ........:
; ================================================================================

Func _True_write_File($sFilePath, $sDataWrite, $iReturn = 0)
    If $iReturn = Default Then $iReturn = 0

    $File = FileOpen($sFilePath, 1)
    If $iReturn = 0 Then
        FileWrite($File, $sDataWrite & @CRLF)
    Else
        FileWrite($File, $sDataWrite)
    EndIf
    FileClose($File)

EndFunc   ;==>_True_write_File


; #INDEX# =========================================================================================================================
; Title .........: UDF_Plus.au3
; AutoIt Version : 3.3.14.2++
; Language ......: Italian
; Description ...: A collection of Function
; Author ........: Faustf
; What do you do.: delete a line inside of file
; Version .......: 0.0.1 BETA - Work in progress 13/06/2018
; Syntax ........: _FileDeleteLine($path, $match, $start, $to) path of file + word to $match, when find it erase all line.
; ...............: or you can use  $match + $to if you want erase a range of line or $start + $to if  you want erase a range
; ...............: of line. You can use a word "end"  if you want erase line at end of file
; Example .......: _FileDeleteLine(@ScriptDir & '\TEMP\test.txt', '<div class="container table-wrap">', '0', '20')
; ...............: _FileDeleteLine(@ScriptDir & "\TEMP\test.txt", 0, 1, "end")
; ...............: _FileDeleteLine(@ScriptDir & '\TEMP\test.txt', '', '2', '133')
; Error Retrun ..: txtopenko = when is not possible open a file
; ...............: Error 1 = when insert a number of line , you have this error.
; ...............: You must use a difference from first point to arrive point
; =================================================================================================================================

Func _FileDeleteLine($path, $match, $start, $to)

    Local $file_count_lines = _FileCountLines($path)
    If $file_count_lines = 0 Then Return "txtopenko"
    If $to = "end" Then
        $to = $file_count_lines
    EndIf

    Select
        Case $start = 0 And $to = "" And $match = "" ;  cancel only match word finded
            Local $aLText = FileReadToArray($path)
            ;_ArrayDisplay($aLText)
            For $i = 0 To UBound($aLText) - 1
                If StringInStr($aLText[$i], $match) Then
                    _ArrayDelete($aLText, $i)
                EndIf
            Next
            ;_ArrayDisplay($aLText)
            _FileWriteFromArray($path, $aLText)

        Case $start = 0 And $to <> "" And $match <> "" ;  cancel from word finded till $to
            Local $iLCtrlDO = 1
            Local $aLText = FileReadToArray($path)
            Local $aLTextClone = FileReadToArray($path)
            ;_ArrayDisplay($aLText)
            For $i = 0 To UBound($aLText) - 1
                If StringInStr($aLText[$i], $match) Then
                    $iLCtrlDO = $i
                    Do
                        _ArrayDelete($aLTextClone, $iLCtrlDO)
                        $to -= 1
                    Until $to <= 0
                EndIf
            Next
            ;_ArrayDisplay($aLTextClone)
            _FileWriteFromArray($path, $aLTextClone)

        Case $start <> 0 And $to <> "" And $match = "" ; cancel from $start till $to (also with "end" special-word)
            If $to = $file_count_lines Then
                Local $aLText = FileReadToArray($path)
                ;_ArrayDisplay($aLText)
                Local $aLTextClone = FileReadToArray($path)
                For $i = 0 To UBound($aLText) - 1
                    $iLCtrlDO = ($start - 1)
                    While $to <> 0
                        ;       MsgBox(0,'235',$iLCtrlDO)
                        _ArrayDelete($aLTextClone, $iLCtrlDO)
                        ;_ArrayDisplay($aLTextClone,'while')
                        $to -= 1
                        ;$to = 0
                    WEnd
                Next
                ;_ArrayDisplay($aLTextClone)
                _FileWriteFromArray($path, $aLTextClone)
            Else
                Local $to1 = $to + $start
                If $to1 < $file_count_lines Then
                    Local $aLText = FileReadToArray($path)
                    Local $aLTextClone = FileReadToArray($path)
                    For $i = 0 To UBound($aLText) - 1
                        $iLCtrlDO = ($start - 1)
                        Do
                            _ArrayDelete($aLTextClone, $iLCtrlDO)
                            $to -= 1
                        Until $to = 0
                        ExitLoop
                    Next
                    _FileWriteFromArray($path, $aLTextClone)
                Else
                    Return "Error 1"
                    ;MsgBox(16, "Errore", "Errore probabilmente non hai inserito la differenza ma  hai messo direttamente il numero riga e superi con l'inizio  il totale righe del foglio")
                EndIf
            EndIf

    EndSelect
EndFunc   ;==>_FileDeleteLine

arrive at point where exist  this '<div id="centerMinus"> but  tell me 

(81) : ==> Subscript used on non-accessible variable.:
If $arraytest[$j]= '<div id="centerMinus">' Then

but  array is not  finished o_O

why ?

 

Link to comment
Share on other sites

thankz  for repley  ,  so i tryed  to close  file before filereadtoarray  but  have the same error 

i test if is arry with arraydisplay and   return me a array.

the  strange things  is  $i and  loop work  till   meet the   word in stringinstrig  , is very strange  in fact at poit of array 1053  exist a word 

Link to comment
Share on other sites

#cs ----------------------------------------------------------------------------

    AutoIt Version: 3.3.14.2
    Author:         faustf

    Script Function:
    Macro per usare Amazon come venditore non professionale

#ce ----------------------------------------------------------------------------

; Script Start - Add your code below here
;#cs
#include <MsgBoxConstants.au3>
#include <WinAPIFiles.au3>
#include <File.au3>
#include <IE.au3>
#include <Array.au3>

If ProcessExists("iexplore.exe") Then ; Check if the internet esplorer process is running.
    ProcessClose("iexplore.exe")
EndIf
;#ce

Global $iGTimeToCeck = "1000", $iGTimeOut = "1000"
Local $urlAmaS = "https://www.amazon.it/s/ref=nb_sb_noss?__mk_it_IT=%C3%85M%C3%85%C5%BD%C3%95%C3%91&url=search-alias%3Daps&field-keywords="
;Local $urlAmaS = "https://www.amazon.it/s/ref=sr_nr_p_76_0?fst=as%3Aoff&rh=n%3A425916031%2Cn%3A460080031%2Cn%3A460126031%2Ck%3Ai7%2Cp_76%3A490211031%7C490210031&keywords=i7&ie=UTF8&qid=1489074068&rnid=490209031" ; con opzione attiva amazon prime e spedizione gratis
;Local $urlAmaS = "https://www.amazon.it/s/ref=sr_st_price-asc-rank?keywords=" ; prima parte url per prezzo crescente
Local $sLUrl2 = "&__mk_it_IT=%C3%85M%C3%85Z%C3%95%C3%91&rh=i%3Aaps%2Ck%3A0190198457509&qid=1533231546&sort=price-asc-rank" ; opzione prezzo crescente
Global $sUrlAtom1 = "https://www.amazon.it/s/ref=sr_pg_"

Local $sLuser = ""
Local $sLpass = ""

_Amazon_Search("TN329BK", $urlAmaS)
;_Amazon_Search("5032037108591", $urlAmaS)
;_Amazon_Search("iphone x", $urlAmaS)


Func _Amazon_Search($frases, $url, $Hide = 0, $slow = 0)

    If $Hide = 0 Then
        $Hide = 1
    EndIf
    If $slow = 0 Then
        $slow = 1000
    EndIf

    Global $oIE = _IECreate($url & $frases & $sLUrl2, 0, $Hide, 1, 1) ; <--- 0011 invisible explorer  <--- 0111 visible explorer
    _IELoadWait($oIE)
    Sleep($slow)
    Local $sText = _IEBodyReadText($oIE)
    Local $iFindBadPage = StringInStr($sText, "This page can’t be displayed")

    If $iFindBadPage <> 0 Then
        If ProcessExists("iexplore.exe") Then ; Check if the internet esplorer process is running.
            ProcessClose("iexplore.exe")
        EndIf
        Sleep($slow)
        $oIE = _IECreate($url & $frases, 0, $Hide, 1, 1) ; <--- 0011 invisible explorer  <--- 0111 visible explorer
        _IELoadWait($oIE, $iGTimeToCeck, $iGTimeOut)
    EndIf

    Local $sLHtml = _IEBodyReadHTML($oIE)
    ConsoleWrite($sLHtml)
    Local $sLText = _IEBodyReadText($oIE)
    If StringInStr($sLText, "non coincide con alcun prodotto") = 0 Then
        ;MsgBox(0,'','sono qui')
        FileDelete(@ScriptDir & "\TEMP\Amazon.html")
        _True_write_File(@ScriptDir & "\TEMP\Amazon.html", $sLHtml)

        Local $arraytest
        _FileReadToArray(@ScriptDir & "\TEMP\Amazon.html", $arraytest)
        Local $iLStopFlag1
        _ArrayDisplay($arraytest)
        If IsArray($arraytest) Then
            For $j = 0 To UBound($arraytest) - 1

                If StringInStr($arraytest[$j], '<div id="centerMinus">') <> 0 Then
                    $arraytest = $j
                EndIf

                ConsoleWrite($j & @CRLF)

            Next
        EndIf


        ;MsgBox(0, '83', $arraytest)
        ;FileClose($hLFileOP)
        ;   MsgBox(0,'71',$iLStopFlag1)
        _FileDeleteLine(@ScriptDir & '\TEMP\Amazon.html', '', '1', $iLStopFlag1)

        ;Local $iLStartFlag = StringInStr(@ScriptDir & '\TEMP\Amazon.html','<div class="rightCol" id="paRightContent">')
        Local $hLFileOP = FileOpen(@ScriptDir & "\TEMP\Amazon.html", $FO_READ)
        Local $sLFileRead = FileRead($hLFileOP)
        Local $iLStopFlag1 = StringInStr($sLFileRead, '<div class="rightCol" id="paRightContent">')
        FileClose($hLFileOP)

        ;   MsgBox(0,'72',$iLStopFlag1)
        _FileDeleteLine(@ScriptDir & '\TEMP\Amazon.html', '', $iLStopFlag1, 'end')
        Local $hLFileOP = FileOpen(@ScriptDir & "\TEMP\Amazon.html", $FO_READ)
        Local $sLFileRead = FileRead($hLFileOP)

        ;Local $aL = StringRegExp($sLHtml, 'href="(.*?)"><img src="(.*?)" srcset="(.+?)title="(.*?)" href="', 3)
        ;_ArrayDisplay($aL)
        ;Local $aL1 = StringRegExp($sLHtml, '(?s)href="([^"]+)"><img src="([^"]+)"\h*srcset="[^"]+.*?title="([^"]+)" href="', 3)
        ;MsgBox(0,'','sono qui2')

        Local $sLPagSuccessiva = StringRegExp($sLFileRead, '<span id="pagnNextString">(.*?)</span>', 3)
        If IsArray($sLPagSuccessiva) Then ; controlla se ci sono piu pagine
            Local $aLAddres2Page = StringRegExp($sLFileRead, '<a href="\/s\/ref=sr_pg_2(.*?)">2<\/a>', 3)
            ;MsgBox(0,'','sono qui3')
            If IsArray($aLAddres2Page) Then
                Local $aLAddres2PageSplit1 = StringRegExp($aLAddres2Page[0], '(.*?)page', 3)
                Local $aLAddres2PageSplit2 = StringRegExp($aLAddres2Page[0], 'page=2(.*?)$', 3)

                Local $aL2 = StringRegExp($sLFileRead, 'text-bold">EUR (.*?)</span></a><span class=', 3)
                ;Local $aL = StringRegExp($sLHtml, 'cfMarker" alt="(.*?)" src="', 3)
                Local $aL = StringRegExp($sLFileRead, 'cfMarker" alt=(.*?) src="', 3)
                ConsoleWrite($sLFileRead)

                _ArrayDisplay($aL2)
                _ArrayDisplay($aL)
                _ArrayDisplay($aLAddres2Page)
                _ArrayDisplay($aLAddres2PageSplit1)
                _ArrayDisplay($aLAddres2PageSplit2)
            Else
                MsgBox(16, 'Errore', 'Problema con regexp url $aLAddres2Page ')
            EndIf

        Else ; se ce una pagina solo
            MsgBox(0, 'Info', 'non ci sono piu pagine')

        EndIf
        _ArrayDisplay($sLPagSuccessiva)


    Else

        MsgBox(0, 'Info', 'non coincide con alcun prodoto ' & $frases)
    EndIf

    #cs
        Local $oBtns = $oIE.document.GetElementsByTagName("input")
        For $oBtn In $oBtns
        $name = String($oBtn.id())
        $buttonOK = String($oBtn.type())
        If $name = "twotabsearchtextbox" Then
        _IEAction($oBtn, "click")
        _IEFormElementSetValue($oBtn, $frases)
        EndIf
        If $buttonOK = "submit" Then
        _IEAction($oBtn, "click")
        EndIf
        Next
    #ce
EndFunc   ;==>_Amazon_Search



; #INDEX# ========================================================================
; Title .........: GUI_Configure.au3
; AutoIt Version : 3.3.14.2++
; Language ......: Italian
; Description ...: A collection of Function for Logic of Gest
; Author ........: Faustf
; What do you do.: Write data in File
; Version .......: 0.0.1 BETA - Work in progress 15/03/2016
; Syntax ........:
; ================================================================================

Func _True_write_File($sFilePath, $sDataWrite, $iReturn = 0)
    If $iReturn = Default Then $iReturn = 0

    $File = FileOpen($sFilePath, 1)
    If $iReturn = 0 Then
        FileWrite($File, $sDataWrite & @CRLF)
    Else
        FileWrite($File, $sDataWrite)
    EndIf
    FileClose($File)

EndFunc   ;==>_True_write_File


; #INDEX# =========================================================================================================================
; Title .........: UDF_Plus.au3
; AutoIt Version : 3.3.14.2++
; Language ......: Italian
; Description ...: A collection of Function
; Author ........: Faustf
; What do you do.: delete a line inside of file
; Version .......: 0.0.1 BETA - Work in progress 13/06/2018
; Syntax ........: _FileDeleteLine($path, $match, $start, $to) path of file + word to $match, when find it erase all line.
; ...............: or you can use  $match + $to if you want erase a range of line or $start + $to if  you want erase a range
; ...............: of line. You can use a word "end"  if you want erase line at end of file
; Example .......: _FileDeleteLine(@ScriptDir & '\TEMP\test.txt', '<div class="container table-wrap">', '0', '20')
; ...............: _FileDeleteLine(@ScriptDir & "\TEMP\test.txt", 0, 1, "end")
; ...............: _FileDeleteLine(@ScriptDir & '\TEMP\test.txt', '', '2', '133')
; Error Retrun ..: txtopenko = when is not possible open a file
; ...............: Error 1 = when insert a number of line , you have this error.
; ...............: You must use a difference from first point to arrive point
; =================================================================================================================================

Func _FileDeleteLine($path, $match, $start, $to)

    Local $file_count_lines = _FileCountLines($path)
    If $file_count_lines = 0 Then Return "txtopenko"
    If $to = "end" Then
        $to = $file_count_lines
    EndIf

    Select
        Case $start = 0 And $to = "" And $match = "" ;  cancel only match word finded
            Local $aLText = FileReadToArray($path)
            ;_ArrayDisplay($aLText)
            For $i = 0 To UBound($aLText) - 1
                If StringInStr($aLText[$i], $match) Then
                    _ArrayDelete($aLText, $i)
                EndIf
            Next
            ;_ArrayDisplay($aLText)
            _FileWriteFromArray($path, $aLText)

        Case $start = 0 And $to <> "" And $match <> "" ;  cancel from word finded till $to
            Local $iLCtrlDO = 1
            Local $aLText = FileReadToArray($path)
            Local $aLTextClone = FileReadToArray($path)
            ;_ArrayDisplay($aLText)
            For $i = 0 To UBound($aLText) - 1
                If StringInStr($aLText[$i], $match) Then
                    $iLCtrlDO = $i
                    Do
                        _ArrayDelete($aLTextClone, $iLCtrlDO)
                        $to -= 1
                    Until $to <= 0
                EndIf
            Next
            ;_ArrayDisplay($aLTextClone)
            _FileWriteFromArray($path, $aLTextClone)

        Case $start <> 0 And $to <> "" And $match = "" ; cancel from $start till $to (also with "end" special-word)
            If $to = $file_count_lines Then
                Local $aLText = FileReadToArray($path)
                ;_ArrayDisplay($aLText)
                Local $aLTextClone = FileReadToArray($path)
                For $i = 0 To UBound($aLText) - 1
                    $iLCtrlDO = ($start - 1)
                    While $to <> 0
                        ;       MsgBox(0,'235',$iLCtrlDO)
                        _ArrayDelete($aLTextClone, $iLCtrlDO)
                        ;_ArrayDisplay($aLTextClone,'while')
                        $to -= 1
                        ;$to = 0
                    WEnd
                Next
                ;_ArrayDisplay($aLTextClone)
                _FileWriteFromArray($path, $aLTextClone)
            Else
                Local $to1 = $to + $start
                If $to1 < $file_count_lines Then
                    Local $aLText = FileReadToArray($path)
                    Local $aLTextClone = FileReadToArray($path)
                    For $i = 0 To UBound($aLText) - 1
                        $iLCtrlDO = ($start - 1)
                        Do
                            _ArrayDelete($aLTextClone, $iLCtrlDO)
                            $to -= 1
                        Until $to = 0
                        ExitLoop
                    Next
                    _FileWriteFromArray($path, $aLTextClone)
                Else
                    Return "Error 1"
                    ;MsgBox(16, "Errore", "Errore probabilmente non hai inserito la differenza ma  hai messo direttamente il numero riga e superi con l'inizio  il totale righe del foglio")
                EndIf
            EndIf

    EndSelect
EndFunc   ;==>_FileDeleteLine

with new mod  but have always the same error

 

Link to comment
Share on other sites

If IsArray($arraytest) Then
            For $j = 0 To UBound($arraytest) - 1

                If StringInStr($arraytest[$j], '<div id="centerMinus">') <> 0 Then
                    $iLStopFlag1 = $j
                EndIf

                ConsoleWrite($j & @CRLF)

            Next
        EndIf

wit this work 

 

Edited by faustf
Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...