Jump to content
Sign in to follow this  
Regency

Is there a better way to inseter these?

Recommended Posts

Regency

So i wrote my code, and i just copied the function it would do, then re did it with a different address.. any way i can just substitute the url's in and only use the least amount of code?

I do it ten times, any way i can substitute just anew url in with the code thats needed?

Func MyFunction2()
    $Gta = _IECreate($url1 & "cartheft.aspx", 0, 1, 1, 0)
    _IELoadWait($Gta)
    WinSetState("TMN - Steal a Car - ", "", @SW_MAXIMIZE)
    WinSetState("tmnX - themafianetwork Xclusive Edition - ", "", @SW_MAXIMIZE)
    
    $oUser = _IEGetObjByName($Gta, "Login1$UserName")
    _IEFormElementSetValue($oUser, $A1)
    $oPass = _IEGetObjByName($Gta, "Login1$Password")
    _IEFormElementSetValue($oPass, $P1)
    $oLogIn = _IEGetObjByName($Gta, "Login1$LoginLinkButton")
    _IEAction($oLogIn, "click")
    _IELoadWait($Gta)
    
$oRadio = _IEGetObjById($Gta, "ctl00_MainPageContent_rblCarThefts_1")
    _IEAction($oRadio, "click")
    $oSubmit = _IEGetObjByName($Gta, "ctl00$MainPageContent$btnCommit")
    _IEAction($oSubmit, "click")
    _IELoadWait($Gta)
    Sleep(2000)
    $oVerify = _IEGetObjByName($Gta, "ctl00$MainPageContent$valCartheft$btn1")
    If IsObj($oVerify) Then
        Script1()
    EndIf
    
    _IELoadWait($Gta)
    
    _IENavigate($Gta, $url2 & "cartheft.aspx", 1)
    _IELoadWait($Gta)
    WinSetState("TMN - Steal a Car - ", "", @SW_MAXIMIZE)
    WinSetState("tmnX - themafianetwork Xclusive Edition - ", "", @SW_MAXIMIZE)
    $oUser = _IEGetObjByName($Gta, "Login1$UserName")
    _IEFormElementSetValue($oUser, $A2)
    $oPass = _IEGetObjByName($Gta, "Login1$Password")
    _IEFormElementSetValue($oPass, $P2)
    $oLogIn = _IEGetObjByName($Gta, "Login1$LoginLinkButton")
    _IEAction($oLogIn, "click")
    _IELoadWait($Gta)
    
    $oRadio = _IEGetObjById($Gta, "ctl00_MainPageContent_rblCarThefts_1")
    _IEAction($oRadio, "click")
    $oSubmit = _IEGetObjByName($Gta, "ctl00$MainPageContent$btnCommit")
    _IEAction($oSubmit, "click")
    _IELoadWait($Gta)
    Sleep(2000)
    $oVerify = _IEGetObjByName($Gta, "ctl00$MainPageContent$valCartheft$btn1")
    If IsObj($oVerify) Then
        Script1()
    EndIf
    _IELoadWait($Gta)
    
    
    _IENavigate($Gta, $url3 & "cartheft.aspx", 1)
    _IELoadWait($Gta)
    WinSetState("TMN - Steal a Car - ", "", @SW_MAXIMIZE)
    WinSetState("tmnX - themafianetwork Xclusive Edition - ", "", @SW_MAXIMIZE)
    $oUser = _IEGetObjByName($Gta, "Login1$UserName")
    _IEFormElementSetValue($oUser, $A3)
    $oPass = _IEGetObjByName($Gta, "Login1$Password")
    _IEFormElementSetValue($oPass, $P3)
    $oLogIn = _IEGetObjByName($Gta, "Login1$LoginLinkButton")
    _IEAction($oLogIn, "click")
    _IELoadWait($Gta)
    
    $oRadio = _IEGetObjById($Gta, "ctl00_MainPageContent_rblCarThefts_1")
    _IEAction($oRadio, "click")
    $oSubmit = _IEGetObjByName($Gta, "ctl00$MainPageContent$btnCommit")
    _IEAction($oSubmit, "click")
    _IELoadWait($Gta)
    Sleep(2000)
    $oVerify = _IEGetObjByName($Gta, "ctl00$MainPageContent$valCartheft$btn1")
    If IsObj($oVerify) Then
        Script1()
    EndIf
    _IELoadWait($Gta)
    
    
    _IENavigate($Gta, $url4 & "cartheft.aspx", 1)
    _IELoadWait($Gta)
    WinSetState("TMN - Steal a Car - ", "", @SW_MAXIMIZE)
    WinSetState("tmnX - themafianetwork Xclusive Edition - ", "", @SW_MAXIMIZE)
    $oUser = _IEGetObjByName($Gta, "Login1$UserName")
    _IEFormElementSetValue($oUser, $A4)
    $oPass = _IEGetObjByName($Gta, "Login1$Password")
    _IEFormElementSetValue($oPass, $P4)
    $oLogIn = _IEGetObjByName($Gta, "Login1$LoginLinkButton")
    _IEAction($oLogIn, "click")
    _IELoadWait($Gta)
    
    $oRadio = _IEGetObjById($Gta, "ctl00_MainPageContent_rblCarThefts_1")
    _IEAction($oRadio, "click")
    $oSubmit = _IEGetObjByName($Gta, "ctl00$MainPageContent$btnCommit")
    _IEAction($oSubmit, "click")
    _IELoadWait($Gta)
    Sleep(2000)
    $oVerify = _IEGetObjByName($Gta, "ctl00$MainPageContent$valCartheft$btn1")
    If IsObj($oVerify) Then
        Script1()
    EndIf
    _IELoadWait($Gta)
    
    
    _IENavigate($Gta, $url5 & "cartheft.aspx", 1)
    _IELoadWait($Gta)
    WinSetState("TMN - Steal a Car - ", "", @SW_MAXIMIZE)
    WinSetState("tmnX - themafianetwork Xclusive Edition - ", "", @SW_MAXIMIZE)
    $oUser = _IEGetObjByName($Gta, "Login1$UserName")
    _IEFormElementSetValue($oUser, $A5)
    $oPass = _IEGetObjByName($Gta, "Login1$Password")
    _IEFormElementSetValue($oPass, $P5)
    $oLogIn = _IEGetObjByName($Gta, "Login1$LoginLinkButton")
    _IEAction($oLogIn, "click")
    _IELoadWait($Gta)
    
    $oRadio = _IEGetObjById($Gta, "ctl00_MainPageContent_rblCarThefts_1")
    _IEAction($oRadio, "click")
    $oSubmit = _IEGetObjByName($Gta, "ctl00$MainPageContent$btnCommit")
    _IEAction($oSubmit, "click")
    _IELoadWait($Gta)
    Sleep(2000)
    $oVerify = _IEGetObjByName($Gta, "ctl00$MainPageContent$valCartheft$btn1")
    If IsObj($oVerify) Then
        Script1()
    EndIf
    _IELoadWait($Gta)
    _IENavigate($Gta, $url6 & "cartheft.aspx", 1)
    _IELoadWait($Gta)
    WinSetState("TMN - Steal a Car - ", "", @SW_MAXIMIZE)
    WinSetState("tmnX - themafianetwork Xclusive Edition - ", "", @SW_MAXIMIZE)
    
    $oUser = _IEGetObjByName($Gta, "Login1$UserName")
    _IEFormElementSetValue($oUser, $A11)
    $oPass = _IEGetObjByName($Gta, "Login1$Password")
    _IEFormElementSetValue($oPass, $P11)
    $oLogIn = _IEGetObjByName($Gta, "Login1$LoginLinkButton")
    _IEAction($oLogIn, "click")
    _IELoadWait($Gta)
    
$oRadio = _IEGetObjById($Gta, "ctl00_MainPageContent_rblCarThefts_1")
    _IEAction($oRadio, "click")
    $oSubmit = _IEGetObjByName($Gta, "ctl00$MainPageContent$btnCommit")
    _IEAction($oSubmit, "click")
    _IELoadWait($Gta)
    Sleep(2000)
    $oVerify = _IEGetObjByName($Gta, "ctl00$MainPageContent$valCartheft$btn1")
    If IsObj($oVerify) Then
        Script1()
    EndIf
    
    _IELoadWait($Gta)
    
    _IENavigate($Gta, $url7 & "cartheft.aspx", 1)
    _IELoadWait($Gta)
    WinSetState("TMN - Steal a Car - ", "", @SW_MAXIMIZE)
    WinSetState("tmnX - themafianetwork Xclusive Edition - ", "", @SW_MAXIMIZE)
    $oUser = _IEGetObjByName($Gta, "Login1$UserName")
    _IEFormElementSetValue($oUser, $A21)
    $oPass = _IEGetObjByName($Gta, "Login1$Password")
    _IEFormElementSetValue($oPass, $P21)
    $oLogIn = _IEGetObjByName($Gta, "Login1$LoginLinkButton")
    _IEAction($oLogIn, "click")
    _IELoadWait($Gta)
    
    $oRadio = _IEGetObjById($Gta, "ctl00_MainPageContent_rblCarThefts_1")
    _IEAction($oRadio, "click")
    $oSubmit = _IEGetObjByName($Gta, "ctl00$MainPageContent$btnCommit")
    _IEAction($oSubmit, "click")
    _IELoadWait($Gta)
    Sleep(2000)
    $oVerify = _IEGetObjByName($Gta, "ctl00$MainPageContent$valCartheft$btn1")
    If IsObj($oVerify) Then
        Script1()
    EndIf
    _IELoadWait($Gta)
    
    
    _IENavigate($Gta, $url8 & "cartheft.aspx", 1)
    _IELoadWait($Gta)
    WinSetState("TMN - Steal a Car - ", "", @SW_MAXIMIZE)
    WinSetState("tmnX - themafianetwork Xclusive Edition - ", "", @SW_MAXIMIZE)
    $oUser = _IEGetObjByName($Gta, "Login1$UserName")
    _IEFormElementSetValue($oUser, $A31)
    $oPass = _IEGetObjByName($Gta, "Login1$Password")
    _IEFormElementSetValue($oPass, $P31)
    $oLogIn = _IEGetObjByName($Gta, "Login1$LoginLinkButton")
    _IEAction($oLogIn, "click")
    _IELoadWait($Gta)
    
    $oRadio = _IEGetObjById($Gta, "ctl00_MainPageContent_rblCarThefts_1")
    _IEAction($oRadio, "click")
    $oSubmit = _IEGetObjByName($Gta, "ctl00$MainPageContent$btnCommit")
    _IEAction($oSubmit, "click")
    _IELoadWait($Gta)
    Sleep(2000)
    $oVerify = _IEGetObjByName($Gta, "ctl00$MainPageContent$valCartheft$btn1")
    If IsObj($oVerify) Then
        Script1()
    EndIf
    _IELoadWait($Gta)
    
    
    _IENavigate($Gta, $url9 & "cartheft.aspx", 1)
    _IELoadWait($Gta)
    WinSetState("TMN - Steal a Car - ", "", @SW_MAXIMIZE)
    WinSetState("tmnX - themafianetwork Xclusive Edition - ", "", @SW_MAXIMIZE)
    $oUser = _IEGetObjByName($Gta, "Login1$UserName")
    _IEFormElementSetValue($oUser, $A41)
    $oPass = _IEGetObjByName($Gta, "Login1$Password")
    _IEFormElementSetValue($oPass, $P41)
    $oLogIn = _IEGetObjByName($Gta, "Login1$LoginLinkButton")
    _IEAction($oLogIn, "click")
    _IELoadWait($Gta)
    
    $oRadio = _IEGetObjById($Gta, "ctl00_MainPageContent_rblCarThefts_1")
    _IEAction($oRadio, "click")
    $oSubmit = _IEGetObjByName($Gta, "ctl00$MainPageContent$btnCommit")
    _IEAction($oSubmit, "click")
    _IELoadWait($Gta)
    Sleep(2000)
    $oVerify = _IEGetObjByName($Gta, "ctl00$MainPageContent$valCartheft$btn1")
    If IsObj($oVerify) Then
        Script1()
    EndIf
    _IELoadWait($Gta)
    
    
    _IENavigate($Gta, $url10 & "cartheft.aspx", 1)
    _IELoadWait($Gta)
    WinSetState("TMN - Steal a Car - ", "", @SW_MAXIMIZE)
    WinSetState("tmnX - themafianetwork Xclusive Edition - ", "", @SW_MAXIMIZE)
    $oUser = _IEGetObjByName($Gta, "Login1$UserName")
    _IEFormElementSetValue($oUser, $A51)
    $oPass = _IEGetObjByName($Gta, "Login1$Password")
    _IEFormElementSetValue($oPass, $P51)
    $oLogIn = _IEGetObjByName($Gta, "Login1$LoginLinkButton")
    _IEAction($oLogIn, "click")
    _IELoadWait($Gta)
    
    $oRadio = _IEGetObjById($Gta, "ctl00_MainPageContent_rblCarThefts_1")
    _IEAction($oRadio, "click")
    $oSubmit = _IEGetObjByName($Gta, "ctl00$MainPageContent$btnCommit")
    _IEAction($oSubmit, "click")
    _IELoadWait($Gta)
    Sleep(2000)
    $oVerify = _IEGetObjByName($Gta, "ctl00$MainPageContent$valCartheft$btn1")
    If IsObj($oVerify) Then
        Script1()
    EndIf
    _IELoadWait($Gta)
    _IEQuit($Gta)
EndFunc   ;==>MyFunction2

Share this post


Link to post
Share on other sites
Zedna

Func MyFunction2()
    MyAction($url1, $A1, $P1, True)
    MyAction($url2, $A2, $P2)
    MyAction($url3, $A3, $P3)
    MyAction($url4, $A4, $P4)
    MyAction($url5, $A5, $P5)
    MyAction($url6, $A11, $P11)
    MyAction($url7, $A21, $P21)
    MyAction($url8, $A31, $P31)
    MyAction($url9, $A41, $P41)
    MyAction($url10, $A51, $P51)
    _IEQuit($Gta)
EndFunc   ;==>MyFunction2

Func MyAction($url, $user, $password, $first = False)
    If $first  Then
        $Gta = _IECreate($url & "cartheft.aspx", 0, 1, 1, 0)
    Else
        _IENavigate($Gta, $url & "cartheft.aspx", 1)
    EndIf
    _IELoadWait($Gta)
    WinSetState("TMN - Steal a Car - ", "", @SW_MAXIMIZE)
    WinSetState("tmnX - themafianetwork Xclusive Edition - ", "", @SW_MAXIMIZE)
    $oUser = _IEGetObjByName($Gta, "Login1$UserName")
    _IEFormElementSetValue($oUser, $user)
    $oPass = _IEGetObjByName($Gta, "Login1$Password")
    _IEFormElementSetValue($oPass, $password)
    $oLogIn = _IEGetObjByName($Gta, "Login1$LoginLinkButton")
    _IEAction($oLogIn, "click")
    _IELoadWait($Gta)
        $oRadio = _IEGetObjById($Gta, "ctl00_MainPageContent_rblCarThefts_1")
    _IEAction($oRadio, "click")
    $oSubmit = _IEGetObjByName($Gta, "ctl00$MainPageContent$btnCommit")
    _IEAction($oSubmit, "click")
    _IELoadWait($Gta)
    Sleep(2000)
    $oVerify = _IEGetObjByName($Gta, "ctl00$MainPageContent$valCartheft$btn1")
    If IsObj($oVerify) Then
        Script1()
    EndIf
    _IELoadWait($Gta)
EndFunc

Share this post


Link to post
Share on other sites
Regency

Your absolutly amazing..i will try that but i looked it over and its exactly what i wanted.. your the best

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  

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.