newb_powa' Posted June 22, 2006 Posted June 22, 2006 First: Sorry for my bad english, my first language is French. Second: This is my first script so don't laught at my question. Then, my problem ... What i want to do is a drop-down menu (combo) and when i choose different subject on it it will do different action. I don't know if I well explain my problem ... But there's my script (Possibly long for nothing but this is my first try :"> ) There it is: expandcollapse popup;================================================================================= ; ; AutoIt Version: 3.1.0 ; Author: Nick255 <nick255sim@hotmail.com> ; ; Script Function: ; Auto-connect to travian.fr ; ;================================================================================= #region --- GuiBuilder code Start --- ; Script generated by AutoBuilder 0.6 Prototype #include <GuiConstants.au3> ;================================================================================= GuiCreate("Travian", 290, 320,-1, -1 , BitOR($WS_OVERLAPPEDWINDOW, $WS_CLIPSIBLINGS)) ;================================================================================= $Group_1 = GuiCtrlCreateGroup("Login Name", 10, 10, 170, 90) $Group_2 = GuiCtrlCreateGroup("Password", 10, 110, 170, 90) $Group_3 = GuiCtrlCreateGroup("Forum", 10, 240, 270, 75) $Group_4 = GuiCtrlCreateGroup("Monde", 185, 10, 95, 190) $monde = GuiCtrlCreateCombo("Monde 1", 195, 30, 75, 20) GUICtrlSetData($monde ,"Monde 2|Monde 3|Monde 4|Monde 5|Monde 6|Monde 7|Monde 9|Monde 10|Monde 11|Monde 12|","Monde 3") $Label_1 = GuiCtrlCreateLabel("< Modifier >", 212, 295, 55, 16) GUICtrlSetColor ( $Label_1, 0x0000ff) $continue = GuiCtrlCreateButton("Log on Travian", 10, 207, 130, 30) GUICtrlSetState(-1,$GUI_DEFBUTTON) $close = GuiCtrlCreateButton("Exit", 150, 207, 130, 30) $Forumoff = GuiCtrlCreateButton("Forum Officiel", 20, 265, 120, 30) $ForumG = GuiCtrlCreateButton("Forum de Guilde", 150, 265, 120, 30) ;~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ $Inputname=GuiCtrlCreateInput("",20,40,150,20) $Inputpass=GuiCtrlCreateInput("",20,140,150,20,$ES_PASSWORD) ;~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ $Checkbox_7 = GuiCtrlCreateCheckbox("Remember", 20, 70, 70, 20) $Checkbox_8 = GuiCtrlCreateCheckbox("Remember", 20, 170, 70, 20) ;================================================================================= GuiSetState() MouseMove (415,305,0) MouseClick ("left") $msg = 0 While 1 $msg = GuiGetMsg() Select Case $msg = $GUI_EVENT_CLOSE Exit EndSelect Select Case $msg = $close Exit EndSelect Select Case $msg = $continue IniWrite ( "C:\Program Files\Travian\Name.ini","Name","key", GUICtrlRead($Inputname) ) IniWrite ("C:\Program Files\Travian\Pass.ini","Password","key", GUICtrlRead($Inputpass) ) WinClose ("Travian") Sleep (500) ExitLoop EndSelect Select Case $msg = $Forumoff ; Create a browser window and navigate to a website Run("C:\Program Files\Internet Explorer\iexplore.exe -nohome");opens a blank page in IE WinWaitActive("Microsoft Internet Explorer");waits for the page to open WinSetState("Microsoft Internet Explorer", "", @SW_MAXIMIZE);maximizes the page for precise mouse control MouseClick("left", 215, 130, 2); Put the forum at URL Send ("http://forum.travian.fr/"); Put the forum at URL Send ("{ENTER}",0); Put the forum at URL Exit EndSelect Select Case $msg = $Checkbox_7 $Ininame = IniRead ( "C:\Program Files\Travian\Name.ini","Name","key", "") MouseMove (415,305,0) MouseClick ("left") Send ($Ininame) EndSelect Select Case $msg = $Checkbox_8 $Inipass = IniRead ("C:\Program Files\Travian\Pass.ini","Password","key", "") MouseMove (415,405,0) MouseClick ("left") Send ($Inipass) EndSelect Select Case $msg = $Label_1 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; $Gforum = InputBox ("Forum de Guilde", "Entrez ici l'URL du forum.", "http://www. .com", "", 211,120,-1,-1) IniWrite ( "C:\Program Files\Travian\GForum.ini","Forum","key", ($Gforum) ) EndSelect ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; $ForumGuile = (IniRead ("C:\Program Files\Travian\Gforum.ini","Forum","key", "")) Select Case $msg = ($ForumG) ; Create a browser window and navigate to a website Run("C:\Program Files\Internet Explorer\iexplore.exe -nohome");opens a blank page in IE WinWaitActive("Microsoft Internet Explorer");waits for the page to open WinSetState("Microsoft Internet Explorer", "", @SW_MAXIMIZE);maximizes the page for precise mouse control MouseClick("left", 215, 130, 2); Put the forum at URL Send ($ForumGuile); Put the forum at URL Send ("{ENTER}",0); Put the forum at URL Exit EndSelect WEnd ;================================================================================= #endregion --- GuiBuilder generated code End --- ;================================================================================= #region --- Identifiants --- $Name = GUICtrlRead($Inputname) $Pass = GUICtrlRead($Inputpass) #endregion ;================================================================================= #region --- Choisir le Monde --- If $monde = ("Monde 1") Then $mondechoisi = ("http://s1.travian.fr/login.php" ) If $monde = ("Monde 2") Then $mondechoisi = ("http://s2.travian.fr/login.php" ) If $monde = ("Monde 3") Then $mondechoisi = ("http://s3.travian.fr/login.php" ) If $monde = ("Monde 4") Then $mondechoisi = ("http://s4.travian.fr/login.php" ) If $monde = ("Monde 5") Then $mondechoisi = ("http://s5.travian.fr/login.php" ) If $monde = ("Monde 6") Then $mondechoisi = ("http://s6.travian.fr/login.php" ) If $monde = ("Monde 7") Then $mondechoisi = ("http://s7.travian.fr/login.php" ) If $monde = ("Monde 8") Then $mondechoisi = ("http://s8.travian.fr/login.php" ) If $monde = ("Monde 9") Then $mondechoisi = ("http://s9.travian.fr/login.php" ) If $monde = ("Monde 10") Then $mondechoisi = ("http://s10.travian.fr/login.php") If $monde = ("Monde 11") Then $mondechoisi = ("http://s11.travian.fr/login.php") If $monde = ("Monde 12") Then $mondechoisi = ("http://s12.travian.fr/login.php") #endregion ;================================================================================= #region --- Web Login --- ; Create a browser window and navigate to a website Run("C:\Program Files\Internet Explorer\iexplore.exe -nohome");opens a blank page in IE WinWaitActive("Microsoft Internet Explorer");waits for the page to open WinSetState("Microsoft Internet Explorer", "", @SW_MAXIMIZE);maximizes the page for precise mouse control MouseClick("left", 215, 130, 2); Put travian at URL Send ($mondechoisi); Put travian at URL Send ("{ENTER}",0); Put travian at URL Sleep (800) ;================================================================================= ; Click on "Password" MouseMove (345, 480, 10) MouseClick("left") Sleep (250) MouseClick("left") Send ("{DEL}") ;~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Send ($Pass) ;~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ; Click on "Username" MouseMove (345, 455, 10) MouseClick("left") Sleep (250) MouseClick("left") Send ("{DEL}") ;~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Send ($Name) ;~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ; Uncheck the box MouseMove (305, 550, 10) MouseClick("left") ; Click on "Login final" MouseMove (407, 527, 10) MouseClick("left") ;================================================================================= #endregion ;=================================================================================
Valuater Posted June 22, 2006 Posted June 22, 2006 (edited) Welcome to the forums... not bad for a first post *********** not tested expandcollapse popup;================================================================================= ; ; AutoIt Version: 3.1.0 ; Author: Nick255 <nick255sim@hotmail.com> ; ; Script Function: ; Auto-connect to travian.fr ; ;================================================================================= #region --- GuiBuilder code Start --- ; Script generated by AutoBuilder 0.6 Prototype #include <GuiConstants.au3> ;================================================================================= GUICreate("Travian", 290, 320, -1, -1, BitOR($WS_OVERLAPPEDWINDOW, $WS_CLIPSIBLINGS)) ;================================================================================= $Group_1 = GUICtrlCreateGroup("Login Name", 10, 10, 170, 90) $Group_2 = GUICtrlCreateGroup("Password", 10, 110, 170, 90) $Group_3 = GUICtrlCreateGroup("Forum", 10, 240, 270, 75) $Group_4 = GUICtrlCreateGroup("Monde", 185, 10, 95, 190) $monde = GUICtrlCreateCombo("Monde 1", 195, 30, 75, 20) GUICtrlSetData($monde, "Monde 2|Monde 3|Monde 4|Monde 5|Monde 6|Monde 7|Monde 9|Monde 10|Monde 11|Monde 12|", "Monde 3") $Label_1 = GUICtrlCreateLabel("< Modifier >", 212, 295, 55, 16) GUICtrlSetColor($Label_1, 0x0000ff) $continue = GUICtrlCreateButton("Log on Travian", 10, 207, 130, 30) GUICtrlSetState(-1, $GUI_DEFBUTTON) $close = GUICtrlCreateButton("Exit", 150, 207, 130, 30) $Forumoff = GUICtrlCreateButton("Forum Officiel", 20, 265, 120, 30) $ForumG = GUICtrlCreateButton("Forum de Guilde", 150, 265, 120, 30) ;~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ $Inputname = GUICtrlCreateInput("", 20, 40, 150, 20) $Inputpass = GUICtrlCreateInput("", 20, 140, 150, 20, $ES_PASSWORD) ;~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ $Checkbox_7 = GUICtrlCreateCheckbox("Remember", 20, 70, 70, 20) $Checkbox_8 = GUICtrlCreateCheckbox("Remember", 20, 170, 70, 20) ;================================================================================= GUISetState() MouseMove(415, 305, 0) MouseClick("left") $msg = 0 While 1 $msg = GUIGetMsg() Select Case $msg = $GUI_EVENT_CLOSE Exit Case $msg = $close Exit Case $msg = $continue IniWrite("C:\Program Files\Travian\Name.ini", "Name", "key", GUICtrlRead($Inputname)) IniWrite("C:\Program Files\Travian\Pass.ini", "Password", "key", GUICtrlRead($Inputpass)) WinClose("Travian") Sleep(500) ExitLoop Case $msg = $Forumoff ; Create a browser window and navigate to a website Run("iexplore.exe " & "http://forum.travian.fr/", "", @SW_MAXIMIZE) ;Run("C:\Program Files\Internet Explorer\iexplore.exe -nohome");opens a blank page in IE ;WinWaitActive("Microsoft Internet Explorer");waits for the page to open ;WinSetState("Microsoft Internet Explorer", "", @SW_MAXIMIZE);maximizes the page for precise mouse control ;MouseClick("left", 215, 130, 2); Put the forum at URL ;Send("http://forum.travian.fr/"); Put the forum at URL ;Send("{ENTER}", 0); Put the forum at URL Exit Case $msg = $Checkbox_7 $Ininame = IniRead("C:\Program Files\Travian\Name.ini", "Name", "key", "") MouseMove(415, 305, 0) MouseClick("left") Send($Ininame) Case $msg = $Checkbox_8 $Inipass = IniRead("C:\Program Files\Travian\Pass.ini", "Password", "key", "") MouseMove(415, 405, 0) MouseClick("left") Send($Inipass) Case $msg = $Label_1 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; $Gforum = InputBox("Forum de Guilde", "Entrez ici l'URL du forum.", "http://www. .com", "", 211, 120, -1, -1) IniWrite("C:\Program Files\Travian\GForum.ini", "Forum", "key", ($Gforum)) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; $ForumGuile = (IniRead("C:\Program Files\Travian\Gforum.ini", "Forum", "key", "")) Case $msg = ($ForumG) ; Create a browser window and navigate to a website Run("C:\Program Files\Internet Explorer\iexplore.exe -nohome");opens a blank page in IE WinWaitActive("Microsoft Internet Explorer");waits for the page to open WinSetState("Microsoft Internet Explorer", "", @SW_MAXIMIZE);maximizes the page for precise mouse control MouseClick("left", 215, 130, 2); Put the forum at URL Send($ForumGuile); Put the forum at URL Send("{ENTER}", 0); Put the forum at URL Exit EndSelect WEnd ;================================================================================= #endregion --- GuiBuilder generated code End --- ;================================================================================= #region --- Identifiants --- $Name = GUICtrlRead($Inputname) $Pass = GUICtrlRead($Inputpass) #endregion ;================================================================================= #region --- Choisir le Monde --- $ck_monde = GUICtrlRead($monde) If $ck_monde = ("Monde 1") Then $mondechoisi = ("http://s1.travian.fr/login.php") If $ck_monde = ("Monde 2") Then $mondechoisi = ("http://s2.travian.fr/login.php") If $ck_monde = ("Monde 3") Then $mondechoisi = ("http://s3.travian.fr/login.php") If $ck_monde = ("Monde 4") Then $mondechoisi = ("http://s4.travian.fr/login.php") If $ck_monde = ("Monde 5") Then $mondechoisi = ("http://s5.travian.fr/login.php") If $ck_monde = ("Monde 6") Then $mondechoisi = ("http://s6.travian.fr/login.php") If $ck_monde = ("Monde 7") Then $mondechoisi = ("http://s7.travian.fr/login.php") If $ck_monde = ("Monde 8") Then $mondechoisi = ("http://s8.travian.fr/login.php") If $ck_monde = ("Monde 9") Then $mondechoisi = ("http://s9.travian.fr/login.php") If $ck_monde = ("Monde 10") Then $mondechoisi = ("http://s10.travian.fr/login.php") If $ck_monde = ("Monde 11") Then $mondechoisi = ("http://s11.travian.fr/login.php") If $ck_monde = ("Monde 12") Then $mondechoisi = ("http://s12.travian.fr/login.php") #endregion ;================================================================================= #region --- Web Login --- ; Create a browser window and navigate to a website Run("iexplore.exe " & $mondechoisi, "", @SW_MAXIMIZE);opens a blank page in IE ;WinWaitActive("Microsoft Internet Explorer");waits for the page to open ;WinSetState("Microsoft Internet Explorer", "", @SW_MAXIMIZE);maximizes the page for precise mouse control ;MouseClick("left", 215, 130, 2); Put travian at URL ;Send (); Put travian at URL ;Send ("{ENTER}",0); Put travian at URL Sleep(800) ;================================================================================= ; Click on "Password" MouseMove(345, 480, 10) MouseClick("left") Sleep(250) MouseClick("left") Send("{DEL}") ;~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Send($Pass) ;~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ; Click on "Username" MouseMove(345, 455, 10) MouseClick("left") Sleep(250) MouseClick("left") Send("{DEL}") ;~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Send($Name) ;~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ; Uncheck the box MouseMove(305, 550, 10) MouseClick("left") ; Click on "Login final" MouseMove(407, 527, 10) MouseClick("left") ;================================================================================= #endregion ;================================================================================= EDIT - maximize iexplorer 8) Edited June 22, 2006 by Valuater
newb_powa' Posted June 22, 2006 Author Posted June 22, 2006 I will try it now ! Thank you very much for fast answer
newb_powa' Posted June 22, 2006 Author Posted June 22, 2006 I only change Run("iexplore.exe")... for Run("C:\Program Files\Internet Explorer\iexplore.exe -nohome")... and now it's perfect ! thanks Valuater
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