Jump to content

GUI Script Help


Regency
 Share

Recommended Posts

First of all.. Yes, This is exactly like the runescape login kids.. I am learning from his, but i keep getting errors.

#include <GUIConstants.au3>
#include <IE.au3>
$Quick = GUICreate("TMN Auto Scripter - By - ScorpiA", 285, 251, 193, 115, BitOR($WS_SYSMENU,$WS_CAPTION,$WS_POPUP,$WS_POPUPWINDOW,$WS_BORDER,$WS_CLIPSIBLINGS))
$agegroup = GUICtrlCreateGroup("Would You Like to Script Jail?:", 8, 8, 265, 49)
$Selectone = GUICtrlCreateCombo("Select one", 16, 24, 145, 25)
GUICtrlSetData(-1, "----------------------|Yes|No|")
$Saveage = GUICtrlCreateButton("Save", 168, 24, 75, 25, 0)
GUICtrlCreateGroup("", -99, -99, 1, 1)
$Desired = GUICtrlCreateGroup("TMN Login Name", 8, 56, 265, 49)
$username = GUICtrlCreateInput("", 16, 72, 145, 21)
$savename = GUICtrlCreateButton("Save", 168, 72, 75, 25, 0)
GUICtrlCreateGroup("", -99, -99, 1, 1)
$DesiredP = GUICtrlCreateGroup("Password", 8, 104, 265, 49)
$password = GUICtrlCreateInput("", 16, 120, 145, 21)
$savepassword = GUICtrlCreateButton("Save", 168, 120, 75, 25, 0)
GUICtrlCreateGroup("", -99, -99, 1, 1)
$Age = GUICtrlCreateLabel("Jail", 8, 160, 250, 17)
$User = GUICtrlCreateLabel("User", 8, 176, 250, 17)
$Pass = GUICtrlCreateLabel("Pass", 8, 192, 250, 17)
$Make = GUICtrlCreateButton("Start Auto Scripter By ScorpiA", 8, 216, 267, 25, 0)
GUISetState(@SW_SHOW)

While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit
        Case $Saveage
            If GUICtrlRead($Selectone) = "Select one" or GUICtrlRead($Selectone) = "----------------------" Then
            Sleep(1000)
            Else
            $age1 = GUICtrlRead($Selectone) 
            GUICtrlSetData($age, $age1)
            EndIf
        Case $savename
            $name1 = GUICtrlRead($Username)
            GUICtrlSetData($user, $name1)
        Case $savepassword
            $pass1 = GUICtrlRead($password)
            GUICtrlSetData($pass, $pass1)
        Case $Make
            $oIE=_IECreate("http://tmn4.bounceme.net/userlogin.aspx?")
            _ieloadwait ($oIE)
            WinSetState("TheMafiaNetwork - Internet Explorer", "", @SW_MAXIMIZE)
            $oUser=_IEGetObjByName($oIE,"txtuid")
            _IEFormElementSetValue($oUser,$name1)
            $oPass=_IEGetObjByName($oIE,"txtpwd")
            _IEFormElementSetValue($oPass,$pass1)
            $oLogIn=_IEGetObjByName($oIE,"Button1")
            _IEAction($oLogIn,"click")
            _ieloadwait($oIE)
        EndSwitch
    WEnd
    
    
        
    If GUICtrlRead($age) = "No" Then
        $begin = ""
        $begin2 = ""
        MyFunction()
        $begin = TimerInit()
        $begin2 = Timerinit()
        While 2
            sleep(100)
            $dif = Int(TimerDiff($begin)/1000)
            If $dif >= (2 * 60) Then
                MyFunction()
                $begin = Timerinit()
            EndIf
        WEnd
        Func MyFunction()
            $oIE =  _IECreate("http://tmn4.bounceme.net/crimes.aspx")
            _IELoadWait($oIE)
            Send("{Tab 5}")
            Send("{Enter}")
            _IELoadWait($oIE)
            _IEQuit($oIE)
            $dif2 = Int(TimerDiff($begin2)/1000)
            If $dif2 >= (4 * 60) Then
                $oIE = _IECreate("http://tmn4.bounceme.net/gta.aspx")
            ;~ "TheMafianetwork - Grand Theft Auto - Internet Explorer"
                _IELoadWait($oIE)
                $begin2 = TimerInit()
                Send("{Tab 5}")
                Send("{Right 2}")
                $oSubmit = _IEGetObjByName ($oIE, "Submit1")
                _IEAction ($oSubmit, "click")
                _IELoadWait($oIE)
                _IEQuit($oIE)
            EndIf
    Endif
        EndFunc
    

        If GUICtrlRead($age) = "Yes" Then
        
$oIE=_IECreate("http://tmn4.bounceme.net/jail.aspx?")
_IELoadWait($oIE)
WinSetState("TheMafiaNetwork - National Jail - Microsoft Internet Explorer", "", @SW_MAXIMIZE)
WinSetState("TheMafiaNetwork - National Jail - Microsoft Internet Explorer", "", @SW_MINIMIZE)

$bLoop = 1
While $bLoop = 1
    For $var = 0 To 100 Step 1
   _IELoadWait($oIE)
  _IELinkClickByText ($oIE, "Break")
  _IELoadWait($oIE)
  _IENavigate($oIE,"http://tmn4.bounceme.net/jail.aspx?", 1)

Next
    WinSetState("TheMafiaNetwork - National Jail - Microsoft Internet Explorer", "", @SW_MAXIMIZE)
    If IsArray(PixelSearch(603,200,655,215,9175040,"",2)) = 1 Then
        sleep(100)
        $bLoop = 0
    ;MsgBox(0,"Verification Box Present","Please Enter Verification Code For Script To Resume")
    Else
        If IsArray(PixelSearch(603,200,655,215,9175040,"",2)) = 0 Then
            sleep(100)
        WinSetState("TheMafiaNetwork - National Jail - Microsoft Internet Explorer", "", @SW_MINIMIZE)
        Else 
            $bLoop = 1
        EndIf
    EndIf
WEnd
Endif

$begin = ""
$begin2 = ""
MyFunction2()
$begin = TimerInit()
$begin2 = TimerInit()

While 2
    Sleep(10)
    $dif = Int(TimerDiff($begin)/1000)
    If $dif >= (2 * 60) Then 
        MyFunction()
        $begin = Timerinit()
    EndIf
WEnd


Func MyFunction2()
    $oIE =  _IECreate("http://tmn4.bounceme.net/crimes.aspx")
;~ "TheMafianetwork - Crimes - Internet Explorer" 
    _IELoadWait($oIE)
    Send("{Tab 5}")
    Send("{Enter}")
    _IELoadWait($oIE)
    sleep(2000)
    _IEQuit($oIE)
    sleep(2000)
    $dif2 = Int(TimerDiff($begin2)/1000)
    If $dif2 >= (4 * 60) Then
     $oIE = _IECreate("http://tmn4.bounceme.net/gta.aspx")
;~ "TheMafianetwork - Grand Theft Auto - Internet Explorer"
    _IELoadWait($oIE)
        $begin2 = TimerInit()
        Send("{Tab 5} ")
        Send("{Right 2}")
          $oSubmit = _IEGetObjByName ($oIE, "Submit1")
          _IEAction ($oSubmit, "click")
          _IELoadWait($oIE)
          _IEQuit($oIE)
        
    EndIf
    
EndFunc  ;==>MyFunction

This is the error sheet

>C:\Program Files\AutoIt3\SciTE\..\au3check.exe "C:\Documents and Settings\Compaq\Desktop\Tmn GUI autoscipter.au3"
AutoIt3 Syntax Checker v1.54  Copyright (c) Tylo 2006

C:\Documents and Settings\Compaq\Desktop\Tmn GUI autoscipter.au3(71,3) : ERROR: missing EndIf.
        Func
        ^
C:\Documents and Settings\Compaq\Desktop\Tmn GUI autoscipter.au3(57,34) : REF: missing EndIf.
    If GUICtrlRead($age) = "No" Then
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^
C:\Documents and Settings\Compaq\Desktop\Tmn GUI autoscipter.au3(91,2) : ERROR: syntax error
    Endif
    ^
C:\Documents and Settings\Compaq\Desktop\Tmn GUI autoscipter.au3 - 2 error(s), 0 warning(s)
>Exit code: 2   Time: 1.392
Link to comment
Share on other sites

If you have downloaded SciTe (not the one that comes with AoutoIT, press ctrl+T to run Tidy.exe

It will spot the mistakes:

#include <GUIConstants.au3>
#include <IE.au3>
$Quick = GUICreate("TMN Auto Scripter - By - ScorpiA", 285, 251, 193, 115, BitOR($WS_SYSMENU, $WS_CAPTION, $WS_POPUP, $WS_POPUPWINDOW, $WS_BORDER, $WS_CLIPSIBLINGS))
$agegroup = GUICtrlCreateGroup("Would You Like to Script Jail?:", 8, 8, 265, 49)
$Selectone = GUICtrlCreateCombo("Select one", 16, 24, 145, 25)
GUICtrlSetData(-1, "----------------------|Yes|No|")
$Saveage = GUICtrlCreateButton("Save", 168, 24, 75, 25, 0)
GUICtrlCreateGroup("", -99, -99, 1, 1)
$Desired = GUICtrlCreateGroup("TMN Login Name", 8, 56, 265, 49)
$username = GUICtrlCreateInput("", 16, 72, 145, 21)
$savename = GUICtrlCreateButton("Save", 168, 72, 75, 25, 0)
GUICtrlCreateGroup("", -99, -99, 1, 1)
$DesiredP = GUICtrlCreateGroup("Password", 8, 104, 265, 49)
$password = GUICtrlCreateInput("", 16, 120, 145, 21)
$savepassword = GUICtrlCreateButton("Save", 168, 120, 75, 25, 0)
GUICtrlCreateGroup("", -99, -99, 1, 1)
$Age = GUICtrlCreateLabel("Jail", 8, 160, 250, 17)
$User = GUICtrlCreateLabel("User", 8, 176, 250, 17)
$Pass = GUICtrlCreateLabel("Pass", 8, 192, 250, 17)
$Make = GUICtrlCreateButton("Start Auto Scripter By ScorpiA", 8, 216, 267, 25, 0)
GUISetState(@SW_SHOW)

While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit
        Case $Saveage
            If GUICtrlRead($Selectone) = "Select one"  Or GUICtrlRead($Selectone) = "----------------------"  Then
                Sleep(1000)
            Else
                $age1 = GUICtrlRead($Selectone)
                GUICtrlSetData($Age, $age1)
            EndIf
        Case $savename
            $name1 = GUICtrlRead($username)
            GUICtrlSetData($User, $name1)
        Case $savepassword
            $pass1 = GUICtrlRead($password)
            GUICtrlSetData($Pass, $pass1)
        Case $Make
            $oIE = _IECreate("http://tmn4.bounceme.net/userlogin.aspx?")
            _IELoadWait($oIE)
            WinSetState("TheMafiaNetwork - Internet Explorer", "", @SW_MAXIMIZE)
            $oUser = _IEGetObjByName($oIE, "txtuid")
            _IEFormElementSetValue($oUser, $name1)
            $oPass = _IEGetObjByName($oIE, "txtpwd")
            _IEFormElementSetValue($oPass, $pass1)
            $oLogIn = _IEGetObjByName($oIE, "Button1")
            _IEAction($oLogIn, "click")
            _IELoadWait($oIE)
    EndSwitch
WEnd



If GUICtrlRead($Age) = "No"  Then
    $begin = ""
    $begin2 = ""
    MyFunction()
    $begin = TimerInit()
    $begin2 = TimerInit()
    While 2
        Sleep(100)
        $dif = Int(TimerDiff($begin) / 1000)
        If $dif >= (2 * 60) Then
            MyFunction()
            $begin = TimerInit()
        EndIf
    WEnd
EndIf
Func MyFunction()
    $oIE = _IECreate("http://tmn4.bounceme.net/crimes.aspx")
    _IELoadWait($oIE)
    Send("{Tab 5}")
    Send("{Enter}")
    _IELoadWait($oIE)
    _IEQuit($oIE)
    $dif2 = Int(TimerDiff($begin2) / 1000)
    If $dif2 >= (4 * 60) Then
        $oIE = _IECreate("http://tmn4.bounceme.net/gta.aspx")
;~ "TheMafianetwork - Grand Theft Auto - Internet Explorer"
        _IELoadWait($oIE)
        $begin2 = TimerInit()
        Send("{Tab 5}")
        Send("{Right 2}")
        $oSubmit = _IEGetObjByName($oIE, "Submit1")
        _IEAction($oSubmit, "click")
        _IELoadWait($oIE)
        _IEQuit($oIE)
    EndIf

EndFunc  ;==>MyFunction


If GUICtrlRead($Age) = "Yes"  Then

    $oIE = _IECreate("http://tmn4.bounceme.net/jail.aspx?")
    _IELoadWait($oIE)
    WinSetState("TheMafiaNetwork - National Jail - Microsoft Internet Explorer", "", @SW_MAXIMIZE)
    WinSetState("TheMafiaNetwork - National Jail - Microsoft Internet Explorer", "", @SW_MINIMIZE)

    $bLoop = 1
    While $bLoop = 1
        For $var = 0 To 100 Step 1
            _IELoadWait($oIE)
            _IELinkClickByText($oIE, "Break")
            _IELoadWait($oIE)
            _IENavigate($oIE, "http://tmn4.bounceme.net/jail.aspx?", 1)

        Next
        WinSetState("TheMafiaNetwork - National Jail - Microsoft Internet Explorer", "", @SW_MAXIMIZE)
        If IsArray(PixelSearch(603, 200, 655, 215, 9175040, "", 2)) = 1 Then
            Sleep(100)
            $bLoop = 0
        ;MsgBox(0,"Verification Box Present","Please Enter Verification Code For Script To Resume")
        Else
            If IsArray(PixelSearch(603, 200, 655, 215, 9175040, "", 2)) = 0 Then
                Sleep(100)
                WinSetState("TheMafiaNetwork - National Jail - Microsoft Internet Explorer", "", @SW_MINIMIZE)
            Else
                $bLoop = 1
            EndIf
        EndIf
    WEnd
EndIf

$begin = ""
$begin2 = ""
MyFunction2()
$begin = TimerInit()
$begin2 = TimerInit()

While 2
    Sleep(10)
    $dif = Int(TimerDiff($begin) / 1000)
    If $dif >= (2 * 60) Then
        MyFunction()
        $begin = TimerInit()
    EndIf
WEnd


Func MyFunction2()
    $oIE = _IECreate("http://tmn4.bounceme.net/crimes.aspx")
;~ "TheMafianetwork - Crimes - Internet Explorer"
    _IELoadWait($oIE)
    Send("{Tab 5}")
    Send("{Enter}")
    _IELoadWait($oIE)
    Sleep(2000)
    _IEQuit($oIE)
    Sleep(2000)
    $dif2 = Int(TimerDiff($begin2) / 1000)
    If $dif2 >= (4 * 60) Then
        $oIE = _IECreate("http://tmn4.bounceme.net/gta.aspx")
;~ "TheMafianetwork - Grand Theft Auto - Internet Explorer"
        _IELoadWait($oIE)
        $begin2 = TimerInit()
        Send("{Tab 5} ")
        Send("{Right 2}")
        $oSubmit = _IEGetObjByName($oIE, "Submit1")
        _IEAction($oSubmit, "click")
        _IELoadWait($oIE)
        _IEQuit($oIE)

    EndIf

EndFunc  ;==>MyFunction2
Link to comment
Share on other sites

If you have downloaded SciTe (not the one that comes with AoutoIT, press ctrl+T to run Tidy.exe

It will spot the mistakes:

#include <GUIConstants.au3>
#include <IE.au3>
$Quick = GUICreate("TMN Auto Scripter - By - ScorpiA", 285, 251, 193, 115, BitOR($WS_SYSMENU, $WS_CAPTION, $WS_POPUP, $WS_POPUPWINDOW, $WS_BORDER, $WS_CLIPSIBLINGS))
$agegroup = GUICtrlCreateGroup("Would You Like to Script Jail?:", 8, 8, 265, 49)
$Selectone = GUICtrlCreateCombo("Select one", 16, 24, 145, 25)
GUICtrlSetData(-1, "----------------------|Yes|No|")
$Saveage = GUICtrlCreateButton("Save", 168, 24, 75, 25, 0)
GUICtrlCreateGroup("", -99, -99, 1, 1)
$Desired = GUICtrlCreateGroup("TMN Login Name", 8, 56, 265, 49)
$username = GUICtrlCreateInput("", 16, 72, 145, 21)
$savename = GUICtrlCreateButton("Save", 168, 72, 75, 25, 0)
GUICtrlCreateGroup("", -99, -99, 1, 1)
$DesiredP = GUICtrlCreateGroup("Password", 8, 104, 265, 49)
$password = GUICtrlCreateInput("", 16, 120, 145, 21)
$savepassword = GUICtrlCreateButton("Save", 168, 120, 75, 25, 0)
GUICtrlCreateGroup("", -99, -99, 1, 1)
$Age = GUICtrlCreateLabel("Jail", 8, 160, 250, 17)
$User = GUICtrlCreateLabel("User", 8, 176, 250, 17)
$Pass = GUICtrlCreateLabel("Pass", 8, 192, 250, 17)
$Make = GUICtrlCreateButton("Start Auto Scripter By ScorpiA", 8, 216, 267, 25, 0)
GUISetState(@SW_SHOW)

While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit
        Case $Saveage
            If GUICtrlRead($Selectone) = "Select one"  Or GUICtrlRead($Selectone) = "----------------------"  Then
                Sleep(1000)
            Else
                $age1 = GUICtrlRead($Selectone)
                GUICtrlSetData($Age, $age1)
            EndIf
        Case $savename
            $name1 = GUICtrlRead($username)
            GUICtrlSetData($User, $name1)
        Case $savepassword
            $pass1 = GUICtrlRead($password)
            GUICtrlSetData($Pass, $pass1)
        Case $Make
            $oIE = _IECreate("http://tmn4.bounceme.net/userlogin.aspx?")
            _IELoadWait($oIE)
            WinSetState("TheMafiaNetwork - Internet Explorer", "", @SW_MAXIMIZE)
            $oUser = _IEGetObjByName($oIE, "txtuid")
            _IEFormElementSetValue($oUser, $name1)
            $oPass = _IEGetObjByName($oIE, "txtpwd")
            _IEFormElementSetValue($oPass, $pass1)
            $oLogIn = _IEGetObjByName($oIE, "Button1")
            _IEAction($oLogIn, "click")
            _IELoadWait($oIE)
    EndSwitch
WEnd



If GUICtrlRead($Age) = "No"  Then
    $begin = ""
    $begin2 = ""
    MyFunction()
    $begin = TimerInit()
    $begin2 = TimerInit()
    While 2
        Sleep(100)
        $dif = Int(TimerDiff($begin) / 1000)
        If $dif >= (2 * 60) Then
            MyFunction()
            $begin = TimerInit()
        EndIf
    WEnd
EndIf
Func MyFunction()
    $oIE = _IECreate("http://tmn4.bounceme.net/crimes.aspx")
    _IELoadWait($oIE)
    Send("{Tab 5}")
    Send("{Enter}")
    _IELoadWait($oIE)
    _IEQuit($oIE)
    $dif2 = Int(TimerDiff($begin2) / 1000)
    If $dif2 >= (4 * 60) Then
        $oIE = _IECreate("http://tmn4.bounceme.net/gta.aspx")
;~ "TheMafianetwork - Grand Theft Auto - Internet Explorer"
        _IELoadWait($oIE)
        $begin2 = TimerInit()
        Send("{Tab 5}")
        Send("{Right 2}")
        $oSubmit = _IEGetObjByName($oIE, "Submit1")
        _IEAction($oSubmit, "click")
        _IELoadWait($oIE)
        _IEQuit($oIE)
    EndIf

EndFunc ;==>MyFunction


If GUICtrlRead($Age) = "Yes"  Then

    $oIE = _IECreate("http://tmn4.bounceme.net/jail.aspx?")
    _IELoadWait($oIE)
    WinSetState("TheMafiaNetwork - National Jail - Microsoft Internet Explorer", "", @SW_MAXIMIZE)
    WinSetState("TheMafiaNetwork - National Jail - Microsoft Internet Explorer", "", @SW_MINIMIZE)

    $bLoop = 1
    While $bLoop = 1
        For $var = 0 To 100 Step 1
            _IELoadWait($oIE)
            _IELinkClickByText($oIE, "Break")
            _IELoadWait($oIE)
            _IENavigate($oIE, "http://tmn4.bounceme.net/jail.aspx?", 1)

        Next
        WinSetState("TheMafiaNetwork - National Jail - Microsoft Internet Explorer", "", @SW_MAXIMIZE)
        If IsArray(PixelSearch(603, 200, 655, 215, 9175040, "", 2)) = 1 Then
            Sleep(100)
            $bLoop = 0
    ;MsgBox(0,"Verification Box Present","Please Enter Verification Code For Script To Resume")
        Else
            If IsArray(PixelSearch(603, 200, 655, 215, 9175040, "", 2)) = 0 Then
                Sleep(100)
                WinSetState("TheMafiaNetwork - National Jail - Microsoft Internet Explorer", "", @SW_MINIMIZE)
            Else
                $bLoop = 1
            EndIf
        EndIf
    WEnd
EndIf

$begin = ""
$begin2 = ""
MyFunction2()
$begin = TimerInit()
$begin2 = TimerInit()

While 2
    Sleep(10)
    $dif = Int(TimerDiff($begin) / 1000)
    If $dif >= (2 * 60) Then
        MyFunction()
        $begin = TimerInit()
    EndIf
WEnd


Func MyFunction2()
    $oIE = _IECreate("http://tmn4.bounceme.net/crimes.aspx")
;~ "TheMafianetwork - Crimes - Internet Explorer"
    _IELoadWait($oIE)
    Send("{Tab 5}")
    Send("{Enter}")
    _IELoadWait($oIE)
    Sleep(2000)
    _IEQuit($oIE)
    Sleep(2000)
    $dif2 = Int(TimerDiff($begin2) / 1000)
    If $dif2 >= (4 * 60) Then
        $oIE = _IECreate("http://tmn4.bounceme.net/gta.aspx")
;~ "TheMafianetwork - Grand Theft Auto - Internet Explorer"
        _IELoadWait($oIE)
        $begin2 = TimerInit()
        Send("{Tab 5} ")
        Send("{Right 2}")
        $oSubmit = _IEGetObjByName($oIE, "Submit1")
        _IEAction($oSubmit, "click")
        _IELoadWait($oIE)
        _IEQuit($oIE)

    EndIf

EndFunc ;==>MyFunction2
Most of the code in this script will never be run as it is never called from withing the message loop. MyFunction() and MyFunction2() are never called. In a script with a GUI and a message loop there should normally never be any code below the message loop that is not part of a function. Any code below the message loop will only execute if the message loop is terminated in some other way than the normal Exit.

"Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the universe trying to build bigger and better idiots. So far, the universe is winning."- Rick Cook

Link to comment
Share on other sites

Most of the code in this script will never be run as it is never called from withing the message loop. MyFunction() and MyFunction2() are never called. In a script with a GUI and a message loop there should normally never be any code below the message loop that is not part of a function. Any code below the message loop will only execute if the message loop is terminated in some other way than the normal Exit.

Thanks i was trying to figure out why it was never being called, as this is my first gui script i need ome instruction.

How would i need to edit this script to work?

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...