Regency Posted April 16, 2009 Share Posted April 16, 2009 So, i have two scripts, both work in parallel perfectly, but, i need then to be in the same script. They can be run each as a exe and work fine, but i would like it to be together so i can impliment a better overall script, and add mroe functionality. The first script, does as its supposed to, it does a certain action when a image isnt there, and when it is there, skips the function, Perfect. The second script is used every hour and a half, and is used to log back into the site (the game gets laggy and need to be reset) So, i want the second script to be called, from within the first script. I have tried a few times and cant get it to keep going, it gets stuck in infinite loops (somewhere i cant find it) expandcollapse popup#include <Constants.au3> #include <GUIConstantsEx.au3> #include <IE.au3> #include <Misc.au3> #include <GUIConstants.au3> #include <WindowsConstants.au3> #AutoIt3Wrapper_Run_Debug_Mode=Y ;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 Opt("TrayOnEventMode", 1) Opt("TrayAutoPause", 0) Opt("PixelCoordMode", 1) ;TraySetOnEvent($TRAY_EVENT_PRIMARYDOWN, "_MinimizeToTray") Global $Crimes = '' Global $Gta = '' Global $paused = "" Global $Url = "tmnx.net" Global $A1 = "" ;Insert your username in the " " Global $P1 = "" ; Insert your password in the " " Global $tmnx = "" Global $name1 = '' Global $oImg = '' Global $sInfo = '' Global $url1 = 'tmnx.net/authenticated/crimes.aspx' Global $url2 = 'tmnx.net/authenticated/gta.aspx' Global $url3 = 'tmnx.net/authenticated/' $tmnx = _IECreate($url1, 0, 1, 1, 0) _IELoadWait($tmnx) myRun() Func myRun() HotKeySet("{Home}", "TogglePause") HotKeySet("{ESC}", "Terminate") Local $begin = '' Local $begin3 = '' Local $dif3 = 0 Local $dif = 0 While 2 Sleep(10) $dif = Int(TimerDiff($begin) / 1000) If $dif >= (.5 * 60) Then MyFunction2() $begin = TimerInit() EndIf WEnd EndFunc ;==>myRun Func MyFunction2() _IENavigate($tmnx, $url1) _IELoadWait($tmnx) $CaptchaCheck = _IEGetObjById($Tmnx,"txtusername") If IsObj($CaptchaCheck) = 1 Then ;Relogin() Exit ElseIf IsObj($CaptchaCheck) = 0 Then EndIf ;end checking for login _IEAction($tmnx, "refresh") _IELoadWait($tmnx) $sImgToLookFor = "wait.gif" ; Fill this in with whatever you're looking for $bImgIsThere = False $oImgs = _IEImgGetCollection($tmnx) For $oImg In $oImgs If StringInStr($oImg.src, $sImgToLookFor) Then; or to use a partial string: If $oImg.src = $sImgToLookFor Then $bImgIsThere = True ExitLoop EndIf Next If $bImgIsThere Then GTA() ElseIf $bImgIsThere = 0 Then $oSubmit1 = _IEGetObjByName($tmnx, "btncrime6") _IEAction($oSubmit1, "click") _IELoadWait($tmnx) ;end checking for crimes GTA() EndIf EndFunc ;==>MyFunction2 Func GTA() _IENavigate($tmnx, $url2) _IELoadWait($tmnx) _IEAction($tmnx, "refresh") _IELoadWait($tmnx) $sImgToLookFor = "wait.gif" ; Fill this in with whatever you're looking for $bImgIsThere = False $oImgs = _IEImgGetCollection($tmnx) For $oImg In $oImgs If StringInStr($oImg.src, $sImgToLookFor) Then; or to use a partial string: If $oImg.src = $sImgToLookFor Then $bImgIsThere = True ExitLoop EndIf Next If $bImgIsThere Then ElseIf $bImgIsThere = 0 Then $oSubmit2 = _IEGetObjById($tmnx, "carslist_2") _IEAction($oSubmit2, "click") $oSubmit = _IEGetObjByName($tmnx, "Submit1") _IEAction($oSubmit, "click") _IELoadWait($tmnx) EndIf EndFunc ;==>GTA Func Relog() $CaptchaCheck = _IEGetObjById($Tmnx,"txtusername") If IsObj($CaptchaCheck) = 1 Then Relogin() ElseIf IsObj($CaptchaCheck) = 0 Then EndIf EndFunc ;==>Relog Func Relogin() ;This si where i want the second script to go, anyone got any ideas on ebst way to impliment it? EndFunc Func TogglePause() $paused = Not $paused While $paused Sleep(100) ToolTip('Script is "Paused"', 0, 0) WEnd ToolTip("") EndFunc ;==>TogglePause Func Terminate() Exit EndFunc ;==>TerminateoÝ÷ Ù'¢wlr¸©·br°j{m¢ "Ø^Eéh)ߺw-ÚºÚ"µÍÚ[ÛYH ÚYK]LÉÝÂÝÙ^TÙ] ][ÝÞÑ_I][ÝË ][ÝÚYÚÝÌI][ÝÊBÝÙ^TÙ] ][ÝÞÑI][ÝË ][ÝÚYÚÝÌ][ÝÊBÝÙ^TÙ] ][ÝÞÑßI][ÝË ][ÝÚYÚÝÌÉ][ÝÊBÝÙ^TÙ] ][ÝÞÑI][ÝË ][ÝÚYÚÝÍ ][ÝÊBÛØ[ ÌÍÓHH ÌÎNÝ[] ÌÎNÂÛØ[ ÌÍÓH ÌÎNÝ[] ÌÎNÂÛØ[ ÌÍÓÈH ÌÎNÝ[] ÌÎNÂÛØ[ ÌÍÓ H ÌÎNÝ[] ÌÎNÂÛØ[ ÌÍÐLHH ][ÝÉ][ÝÂÛØ[ ÌÍÔHH ][ÝÉ][ÝÂÌÍÓRQHHÒQPÜX]J ÌÍÓKKK BÒQSØYØZ] ÌÍÓRQJBÌÍÛÕÙHÒQQÙ]ØS[YJ ÌÍÓRQK ][ÝÝÙ[YI][ÝÊBÒQQÜQ[[Y[Ù][YJ ÌÍÛÕÙ ÌÍÐLJBÌÍÛÔÜÈHÒQQÙ]ØS[YJ ÌÍÓRQK ][ÝÝÜÝÛÜ ][ÝÊBÒQQÜQ[[Y[Ù][YJ ÌÍÛÔÜË ÌÍÔJBÌÍÓQHHÒQPÜX]J ÌÍÓKK BÒQSØYØZ] ÌÍÓQJBÌÍÛÕÙHÒQQÙ]ØS[YJ ÌÍÓQK ][ÝÝÙ[YI][ÝÊBÒQQÜQ[[Y[Ù][YJ ÌÍÛÕÙ ÌÍÐLJBÌÍÛÔÜÈHÒQQÙ]ØS[YJ ÌÍÓQK ][ÝÝÜÝÛÜ ][ÝÊBÒQQÜQ[[Y[Ù][YJ ÌÍÛÔÜË ÌÍÔJBÌÍÓÒQHHÒQPÜX]J ÌÍÓËKK BÒQSØYØZ] ÌÍÓÒQJBÌÍÛÕÙHÒQQÙ]ØS[YJ ÌÍÓÒQK ][ÝÝÙ[YI][ÝÊBÒQQÜQ[[Y[Ù][YJ ÌÍÛÕÙ ÌÍÐLJBÌÍÛÔÜÈHÒQQÙ]ØS[YJ ÌÍÓÒQK ][ÝÝÜÝÛÜ ][ÝÊBÒQQÜQ[[Y[Ù][YJ ÌÍÛÔÜË ÌÍÔJBÌÍÓ QHHÒQPÜX]J ÌÍÓ KK BÒQSØYØZ] ÌÍÓ QJBÌÍÛÕÙHÒQQÙ]ØS[YJ ÌÍÓ QK ][ÝÝÙ[YI][ÝÊBÒQQÜQ[[Y[Ù][YJ ÌÍÛÕÙ ÌÍÐLJBÌÍÛÔÜÈHÒQQÙ]ØS[YJ ÌÍÓ QK ][ÝÝÜÝÛÜ ][ÝÊBÒQQÜQ[[Y[Ù][YJ ÌÍÛÔÜË ÌÍÔJBÛY M BÌÍÛÓÙÒ[HHÒQQÙ]ØS[YJ ÌÍÓRQK ][ÝØÙÚ[][ÝÊBWÒQPXÝ[Û ÌÍÛÓÙÒ[K ][ÝØÛXÚÉ][ÝÊBWÒQSØYØZ] ÌÍÓRQJBWÒQT]Z] ÌÍÓRQJBÛY M BÌÍÛÓÙÒ[HÒQQÙ]ØS[YJ ÌÍÓQK ][ÝØÙÚ[][ÝÊBWÒQPXÝ[Û ÌÍÛÓÙÒ[ ][ÝØÛXÚÉ][ÝÊBWÒQSØYØZ] ÌÍÓQJBWÒQT]Z] ÌÍÓQJBÛY M BÌÍÛÓÙÒ[ÈHÒQQÙ]ØS[YJ ÌÍÓÒQK ][ÝØÙÚ[][ÝÊBWÒQPXÝ[Û ÌÍÛÓÙÒ[Ë ][ÝØÛXÚÉ][ÝÊBWÒQSØYØZ] ÌÍÓÒQJBWÒQT]Z] ÌÍÓÒQJBÛY M BÌÍÛÓÙÒ[HÒQQÙ]ØS[YJ ÌÍÓ QK ][ÝØÙÚ[][ÝÊBWÒQPXÝ[Û ÌÍÛÓÙÒ[ ][ÝØÛXÚÉ][ÝÊBWÒQSØYØZ] ÌÍÓ QJBWÒQT]Z] ÌÍÓ QJB[ÈYÚÝÌJ BYÒQTÜQÙ] ÌÍÓRQK ][ÝÝÚXI][ÝÊH[ÒQPXÝ[Û ÌÍÓRQK ][ÝÚ[ÚXI][ÝÊB[ÙBÒQPXÝ[Û ÌÍÓRQK ][ÝÝÚXI][ÝÊB[Y[[ÈÏOIÝÚYÚÝÂ[ÈYÚÝÌ BYÒQTÜQÙ] ÌÍÓQK ][ÝÝÚXI][ÝÊH[ÒQPXÝ[Û ÌÍÓQK ][ÝÚ[ÚXI][ÝÊB[ÙBÒQPXÝ[Û ÌÍÓQK ][ÝÝÚXI][ÝÊB[Y[[ÈÏOIÝÚYÚÝÂ[ÈYÚÝÌÊ BYÒQTÜQÙ] ÌÍÓÒQK ][ÝÝÚXI][ÝÊH[ÒQPXÝ[Û ÌÍÓÒQK ][ÝÚ[ÚXI][ÝÊB[ÙBÒQPXÝ[Û ÌÍÓÒQK ][ÝÝÚXI][ÝÊB[Y[[ÈÏOIÝÚYÚÝÂ[ÈYÚÝÍ BYÒQTÜQÙ] ÌÍÓ QK ][ÝÝÚXI][ÝÊH[ÒQPXÝ[Û ÌÍÓ QK ][ÝÚ[ÚXI][ÝÊB[ÙBÒQPXÝ[Û ÌÍÓ QK ][ÝÝÚXI][ÝÊB[Y[[ÈÏOIÝÚYÚÝ Link to comment Share on other sites More sharing options...
qazwsx Posted April 16, 2009 Share Posted April 16, 2009 check the time in the main loop of your first script and when that time has been reached run the second script (after you have pasted over the functions). Link to comment Share on other sites More sharing options...
Regency Posted April 16, 2009 Author Share Posted April 16, 2009 Are we allowed to have 2 timers in a autoit script, for two different times? (been out of the game for a while, and just restarted) Link to comment Share on other sites More sharing options...
qazwsx Posted April 16, 2009 Share Posted April 16, 2009 Yeh, just use two different variables. Or you could check the same timer for two different times. Link to comment Share on other sites More sharing options...
Regency Posted April 16, 2009 Author Share Posted April 16, 2009 Check it for two different times? Do you have an example, so i can try and rewrite it? Btw, thanks Link to comment Share on other sites More sharing options...
qazwsx Posted April 16, 2009 Share Posted April 16, 2009 (edited) #include <Timers.au3> _Main() Func _Main() HotKeySet("{ESC}", "_Quit") Local $starttime = _Timer_Init() While 1 switch _Timer_Diff($starttime) case "some number" some stuff to do if this time has passed endswitch WEnd EndFunc ;==>_Main Func _Quit() Exit EndFunc ;==>_Quit There is some rough code. If you need more explanation just ask. Sorry for being unclear. Edited April 16, 2009 by qazwsx Link to comment Share on other sites More sharing options...
Regency Posted April 16, 2009 Author Share Posted April 16, 2009 Thank you, umm well you gave me the rough idea, and this is a help forum, so i need to write it i am just gald you took time to help me. Next delema lol, As you can see in the second script, there are 4 different IE windows, every hour and a hlaf, another one of the ie windows needs to be used, like, after 1.5 hours IE1 is used, then after another 1.5 hours, IE2 is used, any idea on how to do that? Array? Link to comment Share on other sites More sharing options...
qazwsx Posted April 16, 2009 Share Posted April 16, 2009 you could keep the timer for a really long time and keep track of that, or you could use the system time. Wouldn't it be easier to just create the windows as they are needed rather than creating 4 at a time? Link to comment Share on other sites More sharing options...
Regency Posted April 16, 2009 Author Share Posted April 16, 2009 Umm, well, they are preset, (Yes, there is captcha) and thats the reason, so i have them pre oppend and finished. So, no, not in this case i cant. Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now