myxomatosii Posted March 3, 2009 Posted March 3, 2009 (edited) [i realize this script will error if you don't have 6 cities lol... I'll be fixing that this weekend, pardon the newbie ;P ] This script is the beginning of a project I am undertaking, I am mostly using it as a training exercise to learn what I can do with the AutoIt language. Its the first part of many, and one of (at least two) alternative methods which I am going to write. I would just like a few users who either play Ikariam on the Alpha server or anyone who would like to test this out to make an account. All this script does is return the City ID's of all of the user's cities, nothing complex. If it succeeds it will return a Message Box at the end of the script with all of your town ID's listed. [The attached file is the code below, compressed in a folder with the .exe and the source.] expandcollapse popupAutoItSetOption("TrayIconHide",1) Func ikalaunch() Global $continuebutton,$ikabutton,$msg GuiCreate("Ikariam",150,100) GuiSetState(@sw_show) GuiCtrlCreateLabel("Please login to Ikariam,",10,10) GuiCtrlCreateLabel("click continue once the",10,25) GuiCtrlCreateLabel("page is loaded.",10,40) $continuebutton=GuiCtrlCreateButton("Continue",10,60,65,20) $ikabutton=GuiCtrlCreateButton("www.ikariam.com",10,80,115,20) While 1 $msg=GuiGetMsg() Select Case $msg=$continuebutton GuiSetState(@sw_hide) ExitLoop Case $msg=$ikabutton ShellExecuteWait("www.ikariam.com") EndSelect WEnd EndFunc Func ikasource() While 1 If WinActive("Ikariam - World Alpha ")Then BlockInput(1) Send("^u") WinActivate("Source of: http://") Send("^a") Sleep(300) Send("^c") Sleep(300) FileWrite("foop.ini",ClipGet()) WinClose("") BlockInput(0) ExitLoop EndIf WEnd EndFunc Func readwrite() ;add gui here to get city names $cityiduno=StringMid(FileReadLine("foop.ini",351),39+$lena,6) $cityiddos=StringMid(FileReadLine("foop.ini",351),141+$lena+$lenb,6) $cityidtres=StringMid(FileReadLine("foop.ini",351),224+$lena+$lenb+$lenc,6) $cityidcuatro=StringMid(FileReadLine("foop.ini",351),301+$lena+$lenb+$lenc+$lend,6) $cityidcinco=StringMid(FileReadLine("foop.ini",351),381+$lena+$lenb+$lenc+$lend+$lene,6) $cityidseis=StringMid(FileReadLine("foop.ini",351),465+$lena+$lenb+$lenc+$lend+$lene+$lenf,6) ;$cityidsiete=StringMid(FileReadLine("foop.ini",351),48,6) ;$cityidocho=StringMid(FileReadLine("foop.ini",351),48,6) ;$cityidnueve=StringMid(FileReadLine("foop.ini",351),48,6) ;$cityiddiez=StringMid(FileReadLine("foop.ini",351),48,6) MsgBox(0,"Test",$cityiduno&" "&$cityiddos&" "&$cityidtres&" "&$cityidcuatro&" "&$cityidcinco&" "&$cityidseis&".",0) FileDelete("foop.ini") ;FileRecycleEmpty("") EndFunc Func getNames() Global $lena,$lenb,$lenc,$lend,$lene,$lenf,$leng,$lenh global $a,$b,$c,$d,$e,$f,$g,$h GuiCreate("City Names",250,250) GuiSetState(@sw_show) GuiCtrlCreateLabel("Please input each of your city names here",10,10) GuiCtrlCreateLabel("Please leave any extra boxes blank",10,30) GuiCtrlCreateLabel("First City",100,50) GuiCtrlCreateLabel("Second City",100,70) GuiCtrlCreateLabel("Third City",100,90) GuiCtrlCreateLabel("Fourth City",100,110) GuiCtrlCreateLabel("Fifth City",100,130) GuiCtrlCreateLabel("Sixth City",100,150) GuiCtrlCreateLabel("Seventh City",100,170) GuiCtrlCreateLabel("Eighth City",100,190) $a=GuiCtrlCreateInput("",10,50,80,18) $b=GuiCtrlCreateInput("",10,70,80,18) $c=GuiCtrlCreateInput("",10,90,80,18) $d=GuiCtrlCreateInput("",10,110,80,18) $e=GuiCtrlCreateInput("",10,130,80,18) $f=GuiCtrlCreateInput("",10,150,80,18) $g=GuiCtrlCreateInput("",10,170,80,18) $h=GuiCtrlCreateInput("",10,190,80,18) $dbtn=GuiCtrlCreateButton("Done",100,210,60,25) While 1 Local $msg=GuiGetMsg() If GuiCtrlRead($a) <> "" Then $lena=StringLen(GuiCtrlRead($a)) EndIf If GuiCtrlRead($b) <> "" Then $lenb=StringLen(GuiCtrlRead($b)) EndIf If GuiCtrlRead($c) <> "" Then $lenc=StringLen(GuiCtrlRead($c)) EndIf If GuiCtrlRead($d) <> "" Then $lend=StringLen(GuiCtrlRead($d)) EndIf If GuiCtrlRead($e) <> "" Then $lene=StringLen(GuiCtrlRead($e)) EndIf If GuiCtrlRead($f) <> "" Then $lenf=StringLen(GuiCtrlRead($f)) EndIf If GuiCtrlRead($g) <> "" Then $leng=StringLen(GuiCtrlRead($g)) EndIf If GuiCtrlRead($h) <> "" Then $lenh=StringLen(GuiCtrlRead($h)) EndIf If $dbtn=$msg Then ExitLoop WEnd EndFunc ikalaunch() ikasource() getNames() readwrite()City_ID.rar Edited March 4, 2009 by myxomatosii
tmes Posted March 6, 2009 Posted March 6, 2009 [i realize this script will error if you don't have 6 cities lol... I'll be fixing that this weekend, pardon the newbie ;P ] This script is the beginning of a project I am undertaking, I am mostly using it as a training exercise to learn what I can do with the AutoIt language. Its the first part of many, and one of (at least two) alternative methods which I am going to write. I would just like a few users who either play Ikariam on the Alpha server or anyone who would like to test this out to make an account. All this script does is return the City ID's of all of the user's cities, nothing complex. If it succeeds it will return a Message Box at the end of the script with all of your town ID's listed. [The attached file is the code below, compressed in a folder with the .exe and the source.] expandcollapse popupAutoItSetOption("TrayIconHide",1) Func ikalaunch() Global $continuebutton,$ikabutton,$msg GuiCreate("Ikariam",150,100) GuiSetState(@sw_show) GuiCtrlCreateLabel("Please login to Ikariam,",10,10) GuiCtrlCreateLabel("click continue once the",10,25) GuiCtrlCreateLabel("page is loaded.",10,40) $continuebutton=GuiCtrlCreateButton("Continue",10,60,65,20) $ikabutton=GuiCtrlCreateButton("www.ikariam.com",10,80,115,20) While 1 $msg=GuiGetMsg() Select Case $msg=$continuebutton GuiSetState(@sw_hide) ExitLoop Case $msg=$ikabutton ShellExecuteWait("www.ikariam.com") EndSelect WEnd EndFunc Func ikasource() While 1 If WinActive("Ikariam - World Alpha ")Then BlockInput(1) Send("^u") WinActivate("Source of: http://") Send("^a") Sleep(300) Send("^c") Sleep(300) FileWrite("foop.ini",ClipGet()) WinClose("") BlockInput(0) ExitLoop EndIf WEnd EndFunc Func readwrite() ;add gui here to get city names $cityiduno=StringMid(FileReadLine("foop.ini",351),39+$lena,6) $cityiddos=StringMid(FileReadLine("foop.ini",351),141+$lena+$lenb,6) $cityidtres=StringMid(FileReadLine("foop.ini",351),224+$lena+$lenb+$lenc,6) $cityidcuatro=StringMid(FileReadLine("foop.ini",351),301+$lena+$lenb+$lenc+$lend,6) $cityidcinco=StringMid(FileReadLine("foop.ini",351),381+$lena+$lenb+$lenc+$lend+$lene,6) $cityidseis=StringMid(FileReadLine("foop.ini",351),465+$lena+$lenb+$lenc+$lend+$lene+$lenf,6) ;$cityidsiete=StringMid(FileReadLine("foop.ini",351),48,6) ;$cityidocho=StringMid(FileReadLine("foop.ini",351),48,6) ;$cityidnueve=StringMid(FileReadLine("foop.ini",351),48,6) ;$cityiddiez=StringMid(FileReadLine("foop.ini",351),48,6) MsgBox(0,"Test",$cityiduno&" "&$cityiddos&" "&$cityidtres&" "&$cityidcuatro&" "&$cityidcinco&" "&$cityidseis&".",0) FileDelete("foop.ini") ;FileRecycleEmpty("") EndFunc Func getNames() Global $lena,$lenb,$lenc,$lend,$lene,$lenf,$leng,$lenh global $a,$b,$c,$d,$e,$f,$g,$h GuiCreate("City Names",250,250) GuiSetState(@sw_show) GuiCtrlCreateLabel("Please input each of your city names here",10,10) GuiCtrlCreateLabel("Please leave any extra boxes blank",10,30) GuiCtrlCreateLabel("First City",100,50) GuiCtrlCreateLabel("Second City",100,70) GuiCtrlCreateLabel("Third City",100,90) GuiCtrlCreateLabel("Fourth City",100,110) GuiCtrlCreateLabel("Fifth City",100,130) GuiCtrlCreateLabel("Sixth City",100,150) GuiCtrlCreateLabel("Seventh City",100,170) GuiCtrlCreateLabel("Eighth City",100,190) $a=GuiCtrlCreateInput("",10,50,80,18) $b=GuiCtrlCreateInput("",10,70,80,18) $c=GuiCtrlCreateInput("",10,90,80,18) $d=GuiCtrlCreateInput("",10,110,80,18) $e=GuiCtrlCreateInput("",10,130,80,18) $f=GuiCtrlCreateInput("",10,150,80,18) $g=GuiCtrlCreateInput("",10,170,80,18) $h=GuiCtrlCreateInput("",10,190,80,18) $dbtn=GuiCtrlCreateButton("Done",100,210,60,25) While 1 Local $msg=GuiGetMsg() If GuiCtrlRead($a) <> "" Then $lena=StringLen(GuiCtrlRead($a)) EndIf If GuiCtrlRead($b) <> "" Then $lenb=StringLen(GuiCtrlRead($b)) EndIf If GuiCtrlRead($c) <> "" Then $lenc=StringLen(GuiCtrlRead($c)) EndIf If GuiCtrlRead($d) <> "" Then $lend=StringLen(GuiCtrlRead($d)) EndIf If GuiCtrlRead($e) <> "" Then $lene=StringLen(GuiCtrlRead($e)) EndIf If GuiCtrlRead($f) <> "" Then $lenf=StringLen(GuiCtrlRead($f)) EndIf If GuiCtrlRead($g) <> "" Then $leng=StringLen(GuiCtrlRead($g)) EndIf If GuiCtrlRead($h) <> "" Then $lenh=StringLen(GuiCtrlRead($h)) EndIf If $dbtn=$msg Then ExitLoop WEnd EndFunc ikalaunch() ikasource() getNames() readwrite()when i try to run the script i am getting this error: Line 18 (file "C:\douments and settings\userID\Desktop\City ID\Source.au3"): ShellExecuteWait("www.ikariam.com") ^ERROR Error: Unknown Function name. if i try to run the SOURCE.au3 files i get this the EXE worked fine for me. . i am wanting to change it from If WinActive("Ikariam - World Alpha ")Then to say If WinActive("Ikariam - World Gamma ")Then but i get the same error. i have also tried to compile it as an EXE and i get an error when i run my exe. yours works fine. any help with this would be great
tmes Posted March 9, 2009 Posted March 9, 2009 ok well i got one of my issues fixed now i get the script to run BUT when i run the script and then when it comes up with the city boxes i enter the names of the city in and then it pops up a box that says test with in that popup box it has just a . and that is it after you hit ok the script shuts down
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