Jump to content
Sign in to follow this  
Regency

Why wont this freaking work!

Recommended Posts

Regency

$GTA1, and $Jail dont work. They never send the address & the given addon. They just send a empty page. Anyone know freaking why!!

#include <GUIConstants.au3>
#include <IE.au3>

Opt("MustDeclareVars", 1); having this option set will help find mistakes before you run it. Such as using a variable before setting its value or misspelling a variable 

Global $begin = 0
Global $begin2 = 0
Global $nMsg = 0
Global $age1 = ''
Global $name1 = ''
Global $pass1 = ''
Global $url1 = ''
Global $Crimes1 = ''
Global $Gta1 = ''
Global $Jail = ''

Global $Quick = GUICreate("TMN Auto Scripter - By - ScorpiA", 300, 300, 300, 300, BitOR($WS_SYSMENU, $WS_CAPTION, $WS_POPUP, $WS_POPUPWINDOW, $WS_BORDER, $WS_CLIPSIBLINGS))
Global $agegroup = GUICtrlCreateGroup("Would You Like to Script Jail?:", 8, 8, 265, 49)
Global $Selectone = GUICtrlCreateCombo("Select one", 16, 24, 145, 25)
    GUICtrlSetData(-1, "----------------------|Yes|No|")
Global $Saveage = GUICtrlCreateButton("Save", 168, 24, 75, 25, 0)
    GUICtrlCreateGroup("", -99, -99, 1, 1)
Global $Desired = GUICtrlCreateGroup("TMN Login Name", 8, 56, 265, 49)
Global $username = GUICtrlCreateInput("", 16, 72, 145, 21)
Global $savename = GUICtrlCreateButton("Save", 168, 72, 75, 25, 0)
    GUICtrlCreateGroup("", -99, -99, 1, 1)
Global $DesiredP = GUICtrlCreateGroup("Password", 8, 104, 265, 49)
Global $password = GUICtrlCreateInput("", 16, 120, 145, 21)
Global $savepassword = GUICtrlCreateButton("Save", 168, 120, 75, 25, 0)
    GUICtrlCreateGroup("", -99, -99, 1, 1)
Global $StartUrl = GUICtrlCreateGroup("Address to log into TMN with", 8, 152, 256, 49)
Global $address = GUICtrlCreateInput("", 16, 168, 145, 21)
Global $saveurl = Guictrlcreatebutton("Save", 168, 168 ,75, 25, 0)
    GuictrlCreategroup("",-99, -99, 1, 1)

    
Global $Age = GUICtrlCreateLabel("", 8, 208, 250, 17)
Global $User = GUICtrlCreateLabel("", 8, 224, 250, 17)
Global $Pass = GUICtrlCreateLabel("", 8, 240, 250, 17)
Global $Url = GUICtrlCreatelabel("",8, 256, 250, 17)
Global $Make = GUICtrlCreateButton("Start Auto Scripter By ScorpiA", 8, 272, 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 $saveurl
            $url1 = GUICtrlRead($address) & "/userlogin.aspx?"
            Guictrlsetdata($Url, $url1)
         Case $Crimes1
            $Crimes1 = GUICtrlRead($address) & "/crimes.aspx?"
        Case $Gta1
            $Gta1 = Guictrlread($address) & "/gta.aspx?"
        Case $Jail
            $Jail = GuiCtrlRead($address) & "/jail.aspx?"               
        Case $Make
            myRun()
    EndSwitch
WEnd


Func myRun()
    Local $dif = ''
    Local $AgeValue = ''
    Local $oIE = 0
    Local $oUser = 0
    Local $oPass = 0
    Local $oLogIn = 0
    Local $bLoop = 1
    
    $AgeValue = GUICtrlRead($Age)
    $oIE = _IECreate($Url1)
    _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)

    If $AgeValue = "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
    ElseIf $AgeValue = "Yes"  Then
    _IELoadWait($oIE)
    $begin = ""
    $begin2 = ""
    MyFunction2()
    $begin = TimerInit()
    $begin2 = TimerInit()
    
        $oIE = _IECreate($Jail)
        _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, $Jail)
            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

  

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

Func MyFunction()
    Local $oIE = 0
    Local $dif2 = ''
    Local $oSubmit = 0
    
    $oIE = _IECreate($Crimes1)
    _IELoadWait($oIE)
    Send("{Tab 5}")
    Send("{Enter}")
    _IELoadWait($oIE)
    _IEQuit($oIE)
    $dif2 = Int(TimerDiff($begin2) / 1000)
    If $dif2 >= (4 * 60) Then
        $oIE = _IECreate($Gta1)
;~ "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

Func MyFunction2()
    Local $oIE = 0
    Local $dif2 = ''
    Local $oSubmit = 0

    $oIE = _IECreate($Crimes1)
;~ "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($Gta1)
;~ "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

Share this post


Link to post
Share on other sites
BrettF
Regency

$jail is nothing? Case $nmsg = ''? Course it won't work....

why does Crimes work.. not the others?

Share this post


Link to post
Share on other sites
therks

Because it's working like this:

;~ Here's the problematic portion of code:

$nMsg = GUIGetMsg()
Switch $nMsg
    Case $Crimes1
        $Crimes1 = GUICtrlRead($address) & "/crimes.aspx?"
    Case $Gta1
        $Gta1 = Guictrlread($address) & "/gta.aspx?"
    Case $Jail
        $Jail = GuiCtrlRead($address) & "/jail.aspx?"
EndSwitch

;~ Now, on a loop where nothing happens, GUIGetMsg() returns 0.

$nMsg = GUIGetMsg()
Switch 0 ; <-- Say this is zero
    Case $Crimes1
        $Crimes1 = GUICtrlRead($address) & "/crimes.aspx?"
    Case $Gta1
        $Gta1 = Guictrlread($address) & "/gta.aspx?"
    Case $Jail
        $Jail = GuiCtrlRead($address) & "/jail.aspx?"
EndSwitch

;~ When comparing a string to a number in a Switch statement, the string gets evaluated as 0, so now your code looks like:

$nMsg = GUIGetMsg()
Switch 0
    Case 0 ; <-- These all become zero
        $Crimes1 = GUICtrlRead($address) & "/crimes.aspx?"
    Case 0 ; <-- These all become zero
        $Gta1 = Guictrlread($address) & "/gta.aspx?"
    Case 0 ; <-- These all become zero
        $Jail = GuiCtrlRead($address) & "/jail.aspx?"
EndSwitch

;~ And of course with the way a switch statement works, it's going to hit that first case and then exit.

Share this post


Link to post
Share on other sites
Regency

Because it's working like this:

;~ Here's the problematic portion of code:

$nMsg = GUIGetMsg()
Switch $nMsg
    Case $Crimes1
        $Crimes1 = GUICtrlRead($address) & "/crimes.aspx?"
    Case $Gta1
        $Gta1 = Guictrlread($address) & "/gta.aspx?"
    Case $Jail
        $Jail = GuiCtrlRead($address) & "/jail.aspx?"
EndSwitch

;~ Now, on a loop where nothing happens, GUIGetMsg() returns 0.

$nMsg = GUIGetMsg()
Switch 0 ; <-- Say this is zero
    Case $Crimes1
        $Crimes1 = GUICtrlRead($address) & "/crimes.aspx?"
    Case $Gta1
        $Gta1 = Guictrlread($address) & "/gta.aspx?"
    Case $Jail
        $Jail = GuiCtrlRead($address) & "/jail.aspx?"
EndSwitch

;~ When comparing a string to a number in a Switch statement, the string gets evaluated as 0, so now your code looks like:

$nMsg = GUIGetMsg()
Switch 0
    Case 0 ; <-- These all become zero
        $Crimes1 = GUICtrlRead($address) & "/crimes.aspx?"
    Case 0 ; <-- These all become zero
        $Gta1 = Guictrlread($address) & "/gta.aspx?"
    Case 0 ; <-- These all become zero
        $Jail = GuiCtrlRead($address) & "/jail.aspx?"
EndSwitch

;~ And of course with the way a switch statement works, it's going to hit that first case and then exit.

.. SOO... How could i go about fixing this? I kinda get it.. i am gunna fiddel with it.. but someone mind helping me?

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  

×