Script stops when IF-branch on negativ condition


#1

Hi all,
I got stuck with an If operation. The script just stops without error (genrating output) but omitting code behind endif at least is case is negativ. Don't know behavior in positiv case since this is not reached.

Would be great you experts might have a look- most probably I'm just blind. Since code is for the "prohibited" source, I don't like to post the almost complete script. So find attached just the relevant part with the corresponding debug.

Thanks in advance!

Added some of the original line numbers in abbrev. for sync:

        FindLine "sample" 1 1                                                        # Kriterium für letzen Track finden (244)
        MoveLine -1
        unspace
        IfNot "</html>"                                                                    # ja:EOF (247)
            MoveLine +2
            Unspace
            If "<th"                                                                            # ja:weitere CD (250)
                MoveLine -10
                FindLine "<h2>tracks"
                FindInLine "tracks"
                outputto "CurDisc"                                                    # Discnummer zwischenspeichern
                RegexpReplace "<.*?>" ""
                SayRegexp "\d+"
            EndIf
        EndIF

#----------------------------------------------------------------------------
#Disc-Number & Totaldisc ausgeben
#----------------------------------------------------------------------------
        outputto "Discnumber" #(263)
        SayOutput "CurDisc" 
#        say "|" 
        
        Set "TOTALDISCS"            # alten Wert löschen
        outputto "TOTALDISCS"
        SayOutput "CurDisc" 
        MoveLine +1
        Unspace
    While "<div class="ui360">"                                                # ja: weitere Tarcks (272)
#endif

Trace dazu:
------------------------------------------------------------

Script-Line    : 242
Command        : say
Parameter 1    : >|<

Output         : >Koko Taylor|<

Line and position:
Koko Taylor
           ^

------------------------------------------------------------

Script-Line    : 244
Command        : findline
Parameter 1    : >sample<
Parameter 2    : >1<
Parameter 3    : >1<

Output         : >Koko Taylor|<

Line and position:
                <td class="sample pick" title="AllMusic Pick">
^

------------------------------------------------------------

Script-Line    : 245
Command        : moveline
Parameter 1    : >-1<

Output         : >Koko Taylor|<

Line and position:
                    <tr>
^

------------------------------------------------------------

Script-Line    : 246
Command        : unspace

Output         : >Koko Taylor|<

Line and position:
<tr>
^

------------------------------------------------------------

Script-Line    : 247
Command        : ifnot
Parameter 1    : ></html><

Output         : >Koko Taylor|<

Line and position:
<tr>
^

------------------------------------------------------------

Script-Line    : 248
Command        : moveline
Parameter 1    : >+2<

Output         : >Koko Taylor|<

Line and position:
                                    <div class="ui360">
^

------------------------------------------------------------

Script-Line    : 249
Command        : unspace

Output         : >Koko Taylor|<

Line and position:
<div class="ui360">
^

------------------------------------------------------------

Script-Line    : 250
Command        : if
Parameter 1    : ><th<

Output         : >Koko Taylor|<

Line and position:
<div class="ui360">
^

------------------------------------------------------------

Total output:

#2

Maybe

outputto "Discnumber" #(263)
SayOutput "CurDisc"

is a problem when "CurDisc" does not exist. Try to workaround this by writing

outputto "CurDisc"
say ""

in front of the first if command.


#3

Hi pone,
thanks for looking at it.
I don't think this is the reason, you can't know but there is this part before:

FindLine "<h2>tracks"
FindInLine "tracks"
outputto "CurDisc"        # Discnummer zwischenspeichern
RegexpReplace "<.*?>" ""
SayRegexp "\d+"

Ouput for "CurDisc" is "1" when it stops, this is set first time when the first disc was found by the code above.

Thanks again anyway.


#4

Add an else (empty) statement to that if block.


#5

Hi dano,
thanks - but does not work for me.
Played around with else before but now double checked again with 2 (as below) or just one in inner or outer branch.

        IfNot "</html>"                                                                    # Wenn td class nicht gefunden EOF
            MoveLine +2
            Unspace
            If "<th"
                MoveLine -10
                FindLine "<h2>tracks"
                FindInLine "tracks"
                outputto "CurDisc"        # Discnummer zwischenspeichern
                RegexpReplace "<.*?>" ""
                SayRegexp "\d+"
                Else
            EndIf
        Else
        EndIF

That why I'm so confused. If you like I can send you the complete script, this would might make it easier.
Greets


#6

Ok send the script.

Solution:
endif must be lower case