iCrypto

next and EndIf completely broke

11 posts in this topic

Hey,

I made a script with a decent amount of Ifs, and now I have a ton of Problems

#include <FFC.au3>
#include <String.au3>


_FFStart("www.howrse.de")
If _FFisConnected() Then
    $html = _FFReadHTML()
    MsgBox(0, "title", $html)
    $loggedin = StringInStr($html, "Equus")
    MsgBox (0, "title", $loggedin)
    if $loggedin = 0 or @error then
        MsgBox ( 0, "Achtung", "Sie sind nicht eingeloggt, bitte in Firefox einloggen")
    else
        _FFOpenURL("http://www.howrse.de/elevage/chevaux/?elevage=all-horses")
        if _FFisConnected() then
        $html = _FFReadHTML()
        MsgBox(0, "title", $html)
        ;<a href="/elevage/chevaux/cheval?id=54133288" class="horsename">Achal-Tekkiner#</a>

    EndIf
    EndIf
EndIf


        $id =  _StringBetween($html, 'a href="/elevage/chevaux/cheval?id=', " class=")
        $anzahl = Ubound($id)
        if IsDeclared($anzahl) Then
            for $i = 0 to $anzahl

         $resturl = "http://www.howrse.de/elevage/chevaux/cheval?id="
         $url = $resturl & $id[$i]
         _FFOpenURL($url)
         If _FFisConnected() then
         $html = _FFReadHTML()
         $alter =  _StringBetween($html, '<strong>Alter:</strong>', "</td>")
         Next
            EndIf
           

         func Einstallen()
    $eingestallt    = StringInStr($html, "Melde Dein Pferd")
    if $eingestallt = 0 or @error Then

Else
        $urlStall = "www.howrse.de/elevage/chevaux/centreInscription?id=" & $id[$i]
        MsgBox(0,"",$urlStall)
        ;type="submit" style="" onclick="  "> ></button>
        $javascript = _StringBetween($html,'type="submit" style="" onclick="','"> ></button>')
        _FFCmd($javascript)
        _FFOpenUrl($url)
EndIf
EndFunc

         Einstallen()
         if $alter = "1 Monat" or "2 Monate" or "3 Monate" or "4 Monate" or "5 Monate" or "6 Monate" Then
             $rand = Random (1000,5000,1)
             sleep ($rand)
             _FFCmd("$('#boutonAllaiter').css('position','absolute').fadeOut(500);$('#boutonAllaiter-inactive').css('position','relative').fadeIn(500);$('#form-do-suckle').submit();")
             $rand = Random (1000,5000,1)
             sleep ($rand)
             _FFCmd("$('#boutonPanser').css('position','absolute').fadeOut(500);$('#boutonPanser-inactive').css('position','relative').fadeIn(500);$('#form-do-groom').submit();")
              $rand = Random (1000,5000,1)
             sleep ($rand)

         else
             $rand = Random (1000,5000,1)
             sleep ($rand)
             _FFCMD ('removeFieldsErro
             _FFClick("feed-button",'id')
         Elsers(); showConsoleBlockTab("care", "feed", function() { $("#tutoriel-highlight-nourrir").hide(); $("#tutoriel-highlight-nourrir-astuce").show(); });')
             $rand = Random (1000,5000,1)
             sleep ($rand)
         MsgBox (0, "Fehler", "ERROR: Keine Pferde gefunden")
         EndIf

         MsGbox(0, "Lol","text")
         Next

What am I doing wrong? When I add endIfs its saying syntax error and statement cannot be just an expression

 

Thanks in advance

Share this post


Link to post
Share on other sites



iCrypto,

You have Next instead of EndIf on lines 36 & 77 - and EndIf instead of Next on line 37. Once those errors are corrected the script passes syntax checks.

M23

P.S. if you use Tidy (a utility that comes with the SciTE4AutoIt3 package which you can download here) then you can set the correct indenting which really helps debug this sort of problem.


Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind._______My UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Share this post


Link to post
Share on other sites

Its still broken, 

#include <FFC.au3>
#include <String.au3>


_FFStart("www.howrse.de")
If _FFisConnected() Then
    $html = _FFReadHTML()
    MsgBox(0, "title", $html)
    $loggedin = StringInStr($html, "Equus")
    MsgBox(0, "title", $loggedin)
    If $loggedin = 0 Or @error Then
        MsgBox(0, "Achtung", "Sie sind nicht eingeloggt, bitte in Firefox einloggen")
    Else
        _FFOpenURL("http://www.howrse.de/elevage/chevaux/?elevage=all-horses")
        If _FFisConnected() Then
            $html = _FFReadHTML()
            MsgBox(0, "title", $html)
            ;<a href="/elevage/chevaux/cheval?id=54133288" class="horsename">Achal-Tekkiner#</a>

        EndIf
    EndIf
EndIf


$id = _StringBetween($html, 'a href="/elevage/chevaux/cheval?id=', " class=")
$anzahl = UBound($id)
If IsDeclared($anzahl) Then
    For $i = 0 To $anzahl

        $resturl = "http://www.howrse.de/elevage/chevaux/cheval?id="
        $url = $resturl & $id[$i]
        _FFOpenURL($url)
        If _FFisConnected() Then
            $html = _FFReadHTML()
            $alter = _StringBetween($html, '<strong>Alter:</strong>', "</td>")
;### Tidy Error -> "next" is closing previous "if" on line 33
        Next
;### Tidy Error -> "endif" is closing previous "for" on line 28
    EndIf
EndIf

Func Einstallen()
    $eingestallt = StringInStr($html, "Melde Dein Pferd")
    If $eingestallt = 0 Or @error Then

    Else
        $urlStall = "www.howrse.de/elevage/chevaux/centreInscription?id=" & $id[$i]
        MsgBox(0, "", $urlStall)
        ;type="submit" style="" onclick="  "> ></button>
        $javascript = _StringBetween($html, 'type="submit" style="" onclick="', '"> ></button>')
        _FFCmd($javascript)
        _FFOpenUrl($url)
    EndIf
EndFunc   ;==>Einstallen

Einstallen()
If $alter = "1 Monat" Or "2 Monate" Or "3 Monate" Or "4 Monate" Or "5 Monate" Or "6 Monate" Then
    $rand = Random(1000, 5000, 1)
    Sleep($rand)
    _FFCmd("$('#boutonAllaiter').css('position','absolute').fadeOut(500);$('#boutonAllaiter-inactive').css('position','relative').fadeIn(500);$('#form-do-suckle').submit();")
    $rand = Random(1000, 5000, 1)
    Sleep($rand)
    _FFCmd("$('#boutonPanser').css('position','absolute').fadeOut(500);$('#boutonPanser-inactive').css('position','relative').fadeIn(500);$('#form-do-groom').submit();")
    $rand = Random(1000, 5000, 1)
    Sleep($rand)

Else
    $rand = Random(1000, 5000, 1)
    Sleep($rand)
    _FFCMD('removeFieldsErrors(); showConsoleBlockTab("care", "feed", function() { $("#tutoriel-highlight-nourrir").hide(); $("#tutoriel-highlight-nourrir-astuce").show(); });')
    $rand = Random(1000, 5000, 1)
    Sleep($rand)
    _FFClick("feed-button", 'id')
Else
    MsgBox(0, "Fehler", "ERROR: Keine Pferde gefunden")
EndIf

MsgBox(0, "Lol", "text")
;### Tidy Error: "next" is likely missing it's opening statement. next line creates a negative tablevel.
EndIf
;### Tidy Error: "endif" is likely missing it's opening statement. next line creates a negative tablevel.
EndIf
;### Tidy Error: "endif" is likely missing it's opening statement. next line creates a negative tablevel.
EndIf
;### Tidy Error: "endif" is likely missing it's opening statement. next line creates a negative tablevel.
EndIf
;### Tidy Error: "endif" is likely missing it's opening statement. next line creates a negative tablevel.
EndIf

Share this post


Link to post
Share on other sites

iCrypto,

If someone replies, at least read what they say:

You have Next instead of EndIf on lines 36 [...] - and EndIf instead of Next on line 37.

And you have now added several extraneous EndIf lines at the end of the script. 

M23


Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind._______My UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Share this post


Link to post
Share on other sites
#include <FFC.au3>
#include <String.au3>


_FFStart("www.howrse.de")
If _FFisConnected() Then
    $html = _FFReadHTML()
    MsgBox(0, "title", $html)
    $loggedin = StringInStr($html, "Equus")
    MsgBox(0, "title", $loggedin)
    If $loggedin = 0 Or @error Then
        MsgBox(0, "Achtung", "Sie sind nicht eingeloggt, bitte in Firefox einloggen")
    Else
        _FFOpenURL("http://www.howrse.de/elevage/chevaux/?elevage=all-horses")
        If _FFisConnected() Then
            $html = _FFReadHTML()
            MsgBox(0, "title", $html)
            ;<a href="/elevage/chevaux/cheval?id=54133288" class="horsename">Achal-Tekkiner#</a>

        EndIf
    EndIf
EndIf


$id = _StringBetween($html, 'a href="/elevage/chevaux/cheval?id=', " class=")
$anzahl = UBound($id)
If IsDeclared($anzahl) Then
    For $i = 0 To $anzahl

        $resturl = "http://www.howrse.de/elevage/chevaux/cheval?id="
        $url = $resturl & $id[$i]
        _FFOpenURL($url)
        If _FFisConnected() Then
            $html = _FFReadHTML()
            $alter = _StringBetween($html, '<strong>Alter:</strong>', "</td>")
;### Tidy Error -> "next" is closing previous "if" on line 33
        EndIf
;### Tidy Error -> "endif" is closing previous "for" on line 28
    Next
EndIf

Func Einstallen()
    $eingestallt = StringInStr($html, "Melde Dein Pferd")
    If $eingestallt = 0 Or @error Then

    Else
        $urlStall = "www.howrse.de/elevage/chevaux/centreInscription?id=" & $id[$i]
        MsgBox(0, "", $urlStall)
        ;type="submit" style="" onclick="  "> ></button>
        $javascript = _StringBetween($html, 'type="submit" style="" onclick="', '"> ></button>')
        _FFCmd($javascript)
        _FFOpenUrl($url)
    EndIf
EndFunc   ;==>Einstallen

Einstallen()
If $alter = "1 Monat" Or "2 Monate" Or "3 Monate" Or "4 Monate" Or "5 Monate" Or "6 Monate" Then
    $rand = Random(1000, 5000, 1)
    Sleep($rand)
    _FFCmd("$('#boutonAllaiter').css('position','absolute').fadeOut(500);$('#boutonAllaiter-inactive').css('position','relative').fadeIn(500);$('#form-do-suckle').submit();")
    $rand = Random(1000, 5000, 1)
    Sleep($rand)
    _FFCmd("$('#boutonPanser').css('position','absolute').fadeOut(500);$('#boutonPanser-inactive').css('position','relative').fadeIn(500);$('#form-do-groom').submit();")
    $rand = Random(1000, 5000, 1)
    Sleep($rand)

Else
    $rand = Random(1000, 5000, 1)
    Sleep($rand)
    _FFCMD('removeFieldsErrors(); showConsoleBlockTab("care", "feed", function() { $("#tutoriel-highlight-nourrir").hide(); $("#tutoriel-highlight-nourrir-astuce").show(); });')
    $rand = Random(1000, 5000, 1)
    Sleep($rand)
    _FFClick("feed-button", 'id')
Else
    MsgBox(0, "Fehler", "ERROR: Keine Pferde gefunden")
EndIf

MsgBox(0, "Lol", "text")

Here i fixed it but  there are some bugs

 

Share this post


Link to post
Share on other sites

iCrypto,

I do not use FF so I cannot help further.

M23


Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind._______My UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Share this post


Link to post
Share on other sites

its endif bug

Share this post


Link to post
Share on other sites

You dont need FF its saying missing EndIf

 

Share this post


Link to post
Share on other sites

iCrypto

#include <FFC.au3>
#include <String.au3>


_FFStart("www.howrse.de")
If _FFisConnected() Then
    $html = _FFReadHTML()
    MsgBox(0, "title", $html)
    $loggedin = StringInStr($html, "Equus")
    MsgBox(0, "title", $loggedin)
    If $loggedin = 0 Or @error Then
        MsgBox(0, "Achtung", "Sie sind nicht eingeloggt, bitte in Firefox einloggen")
    Else
        _FFOpenURL("http://www.howrse.de/elevage/chevaux/?elevage=all-horses")
        If _FFisConnected() Then
            $html = _FFReadHTML()
            MsgBox(0, "title", $html)
            ;<a href="/elevage/chevaux/cheval?id=54133288" class="horsename">Achal-Tekkiner#</a>

        EndIf

    EndIf

EndIf





$id = _StringBetween($html, 'a href="/elevage/chevaux/cheval?id=', " class=")
$anzahl = UBound($id)
If IsDeclared($anzahl) Then
    For $i = 0 To $anzahl



        $resturl = "http://www.howrse.de/elevage/chevaux/cheval?id="
        $url = $resturl & $id[$i]
        _FFOpenURL($url)
        If _FFisConnected() Then
            $html = _FFReadHTML()
            $alter = _StringBetween($html, '<strong>Alter:</strong>', "</td>")
        EndIf

    Next
EndIf



Func Einstallen()
    $eingestallt = StringInStr($html, "Melde Dein Pferd")
    If $eingestallt = 0 Or @error Then

    Else
        $urlStall = "www.howrse.de/elevage/chevaux/centreInscription?id=" & $id[$i]
        MsgBox(0, "", $urlStall)
        ;type="submit" style="" onclick="  "> ></button>
        $javascript = _StringBetween($html, 'type="submit" style="" onclick="', '"> ></button>')
        _FFCmd($javascript)
        _FFOpenUrl($url)
    EndIf

EndFunc   ;==>Einstallen



Einstallen()
If $alter = "1 Monat" Or "2 Monate" Or "3 Monate" Or "4 Monate" Or "5 Monate" Or "6 Monate" Then
    $rand = Random(1000, 5000, 1)
    Sleep($rand)
    _FFCmd("$('#boutonAllaiter').css('position','absolute').fadeOut(500);$('#boutonAllaiter-inactive').css('position','relative').fadeIn(500);$('#form-do-suckle').submit();")
    $rand = Random(1000, 5000, 1)
    Sleep($rand)
    _FFCmd("$('#boutonPanser').css('position','absolute').fadeOut(500);$('#boutonPanser-inactive').css('position','relative').fadeIn(500);$('#form-do-groom').submit();")
    $rand = Random(1000, 5000, 1)
    Sleep($rand)

Else
    $rand = Random(1000, 5000, 1)
    Sleep($rand)
    _FFCMD('removeFieldsErrors(); showConsoleBlockTab("care", "feed", function() { $("#tutoriel-highlight-nourrir").hide(); $("#tutoriel-highlight-nourrir-astuce").show(); });')
    $rand = Random(1000, 5000, 1)
    Sleep($rand)
    _FFClick("feed-button", 'id')
Else
    MsgBox(0, "Fehler", "ERROR: Keine Pferde gefunden")
EndIf



MsgBox(0, "Lol", "text")

M23


Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind._______My UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Share this post


Link to post
Share on other sites

Still errors, 2 EndIf Missing

Share this post


Link to post
Share on other sites

iCrypto,

You have 2 Else sections inside the section starting at line 68:

If $alter = "1 Monat" Or "2 Monate" Or "3 Monate" Or "4 Monate" Or "5 Monate" Or "6 Monate" Then
    [...]
Else
    [...]
Else
    [...]
EndIf

You need to recast that section so that you have only one.

And having looked at the website you are attempting to automate, I see it is a game - so I suggest you read the Forum rules now - particularly the bit about not discussing game automation - and then you will understand why you will get no more help and this thread will now be locked.

M23

 


Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind._______My UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Share this post


Link to post
Share on other sites
Guest
This topic is now closed to further replies.