K3vin Posted May 1, 2005 Share Posted May 1, 2005 Hello, I'm totally new to AutoIt and it seems really interesting but I need to understand the logic on how I can make it work as I want. So I'd like to make a script from an online game : sometimes when you wanna join a server, it's full and you gotta click on that server till there's a free place in it! And I know I can make a script with AutoIt to do it auto with AutoIt . So I'd like to know three things : 1)I will need to know how to send a message to a window, especially where do I say that I want a message for a specific window. 2)The coordinates of the button I'd like to click. 3)How to say in the script : "Keep it on until you joined the server!" I'm taking any help, any tutorials, anything ;-) Thanks for that w00t program. Link to comment Share on other sites More sharing options...
herewasplato Posted May 1, 2005 Share Posted May 1, 2005 Hello,I'm totally new to AutoIt and it seems really interesting but I need to understand the logic on how I can make it work as I want.So I'd like to make a script from an online game : sometimes when you wanna join a server, it's full and you gotta click on that server till there's a free place in it! And I know I can make a script with AutoIt to do it auto with AutoIt .So I'd like to know three things :1)I will need to know how to send a message to a window, especially where do I say that I want a message for a specific window.2)The coordinates of the button I'd like to click.3)How to say in the script : "Keep it on until you joined the server!"I'm taking any help, any tutorials, anything ;-)Thanks for that w00t program. <{POST_SNAPBACK}>Read the help file for each of these functions:AutoItSetOption - WinTitleMatchMode and MouseCoordModeWhile 1 WinWait WinActivate WinWaitActive MouseClick or maybe Send Sleep If WinExists Then ExitLoopWEndUse the AutoIt Window Info tools to get the mouse coordinate - but set it for relative to window if that is what you want.....Then structure your script something like the outline above [size="1"][font="Arial"].[u].[/u][/font][/size] Link to comment Share on other sites More sharing options...
jpm Posted May 1, 2005 Share Posted May 1, 2005 In your case you want to read first the tutorial of the help doc. You will learn that AutoIt will communicate with windows profided you now the title winwaitactive is key communication by send for click why don't you type click on the search mechanism I think you will find how to communicate with your window. The last point can be more complicated because you need to find a way to have a specific title/text window active. That depend your application. It is the real beauty of making a script working Good learning Link to comment Share on other sites More sharing options...
K3vin Posted May 1, 2005 Author Share Posted May 1, 2005 Cool, thanks for answering, I looked at the help files globally but didn't read it. I'll do that then :-) thanks for answering. Link to comment Share on other sites More sharing options...
K3vin Posted May 1, 2005 Author Share Posted May 1, 2005 (edited) Hum, sorry for double posting but I don't understand everything! :-( I started with that WinActivate ("ROSE online") ;doubleclick on "join channel 1" MouseClick ("left", 781, 346, 2) ;click on "server full, ok" MouseClick ("left", 500, 371, 1) And then, even if I read all those commands, I dunno how to say to my script that if the answer to the double click on "join channel 1" is a no it has to loop until it says yes... I keep reading to understand what you were planning to do though :-s EDIT : ok, I think there's a problem : what if the window for joining the name and the one once you joined got the same name? Edited May 2, 2005 by K3vin Link to comment Share on other sites More sharing options...
Just_Plain_Cool Posted May 2, 2005 Share Posted May 2, 2005 Hum, sorry for double posting but I don't understand everything! :-(I started with that WinActivate ("ROSE online") ;doubleclick on "join channel 1" MouseClick ("left", 781, 346, 2) ;click on "server full, ok" MouseClick ("left", 500, 371, 1)And then, even if I read all those commands, I dunno how to say to my script that if the answer to the double click on "join channel 1" is a no it has to loop until it says yes...I keep reading to understand what you were planning to do though :-sEDIT : ok, I think there's a problem : what if the window for joining the name and the one once you joined got the same name?<{POST_SNAPBACK}>When you use the AutoIt Window Info tool, does it also show text in the window? Is this text different before and after joining the game? If it is, then you can use the second argument in the WinActivate command to tell the difference. For example:WinActivate ("ROSE online", "Join Game?")andWinActivate ("ROSE online", "Game Joined Successfully")Would activate two different windows...Hope this helps,JPC Link to comment Share on other sites More sharing options...
K3vin Posted May 2, 2005 Author Share Posted May 2, 2005 (edited) Argh, thanks for the idea but there is no text Alright, I think I understood the way you think herewasplato!!! AutoItSetOption ("WinTitleMatchMode", 4 ) AutoItSetOption ("MouseCoordMode", 0 ) While >IDUNNOWHATTOPUTHERE< WinWait ("ROSE online", "Unknown" ) WinActivate ("ROSE online") WinWaitActive ("ROSE online", "Unknown" ) MouseClick ("left", 781, 346, 2) Sleep (5000) If WinExists ("ROSE online" , "unknown" ) Then ExitLoop WEnd I tried to follow exactly what you said but there's a problem : what can I do when the name of the windows are the same and when I can't see their text with the au3 tool? Edited May 3, 2005 by K3vin Link to comment Share on other sites More sharing options...
herewasplato Posted May 2, 2005 Share Posted May 2, 2005 (edited) Argh, thanks for the idea but there is no text Alright, I think I understood the way you think herewasplato!!!AutoItSetOption ("WinTitleMatchMode", 4 ) AutoItSetOption ("MouseCoordMode", 0 ) While >IDUNNOWHATTOPUTHERE< WinWait ("ROSE online", "Unknown" ) WinActivate ("ROSE online") WinWaitActive ("ROSE online", "Unknown" ) MouseClick ("left", 781, 346, 2) Sleep (5000) If WinExists ("ROSE online" , "unknown" ) Then ExitLoop WEndI tried to follow exactly what you said but there's a problem : what can I do when the name of the windows are the same and when I can see their text with the au3 tool?<{POST_SNAPBACK}>That looks pretty good. You are pretty far along in your learning.Frankly, I know very little about WinTitleMatchMode mode 4 and you might need it for this script; but for now, let's stick with mode 3 (exact match).Do me a favor and copy the window title from the window info tool and paste it into the commands - do not try to type it in. You may have it typed in correctly, but humor me for a while.Now, do me a second favor - Do not get offended with the info that I am about to type. I'm going to write a bunch of stuff in such a way that might seem insulting - you might think to yourself, "I already know all of that!" Be patient with me, I'm not positive of all that you know/understand... and I'm not that great at teaching... so, this is what you get:AutoItSetOption ("WinTitleMatchMode", 3) ;exact matchAutoItSetOption ("MouseCoordMode", 0) ;relative to windowWhile 1 = 1; If it helps you to understand, use 1 = 1; the script will just keep running the code between; the While function and the WEnd (While End) function; as long as 1 equals 1 is TRUE... Get it?; Well I did not get this when I first started; I just stole the code/concept from this forumWinWait ("ROSE online"); let's not worry with the "text" part of the window for now; unless you have more than one window with the exact same title; if you do - then we will deal with that laterWinActivate ("ROSE online"); in case the window is there - but not active; this functions should make it activeWinWaitActive ("ROSE online") ; in case your computer is real busy doing something else; this waits for the window to become active - ; you probably do not need this line, but I like itMouseClick ("left", 781, 346, 2, 25) ; I added the 25 at the end to slow things down; not to insult you - I do not know the game's interface, but; the line of code that you have written here clicks twice; are you sure that you need two clicks? - if you only need one; try changing the 2 to 1 as in MouseClick ("left", 781, 346, 1)MouseMove (0, 0, 25); let's add this one line to move the mouse; maybe this will help us later on; moving the mouse off of a "place to click"; can sometimes change the "Window text"Sleep (5000); aaah - sleep - that ever elusive commodity - but I digress; this should make the script wait 5 seconds - but you knew that; the script waits for an answer from the server before starting the; entire While/WEnd loop again...If WinExists ("ROSE online" , "unknown") Then ExitLoop; you can have this all on one line in your script and; that way you will not need the "EndIf" - but that was probably; really bad teaching on my part... normally you would have If WinExists ("ROSE online" , "unknown") Then ExitLoopEndIfThose three lines of code (or one line - if you wish) are where we hope to tell the script that it can stop that infinate While/WEnd loop. Hopefully you will connected to a server at some point and the script needs to know when to exit. The game's window title might stay the same - but we really hope that you (and the "AutoIt v3 Active Window Info" tool) can find some difference between the first window and the window that tells you that you are connected.Now I'm a bit confused, you said, "...but there is no text..."And you said, "...and when I can see their text with the au3 tool?"Since I cannot be sure that I understanding you right... please try these steps:1. Start the window info tool2. Start the game - but do not click on anything.......be sure that the game window is in focus (active)3. Press CTRL-ALT-F to pause the display of the info tool4. You click as much as is needed to get connected to a game server5. Move the mouse into upper left part of your desktop6. Start a second copy of the window info tool7. Be sure that the game window is in focus8. Compare the info below this line in each "tool window":>>>>>>>>>>> Visible Window Text <<<<<<<<<<<9. Compare the info below this line in each "tool window":>>>>>>>>>>> Hidden Window Text <<<<<<<<<<<If you can find some text that only shows up once you are connected to a game server, then you can replace the word unknown with that text and the script should exit when it "sees" the *combination* of that window's title and window's text.If that "Window text" is from the "Hidden" section of the tool, then you will need to add AutoItSetOption ("WinDetectHiddenText", 1) to the top part of your script.To borrow (ok, steal) from JPC, perhaps the "Window text" will change to Game Joined Successfully, then you can use a line of code like:If WinExists ("ROSE online", "Game Joined Successfully") ThenIf there is not any text (hidden or otherwise) that is unique to the game's window once it has connected to the server, then you will need to seek the help of someone who knows more about the game and/or AutoIt. Perhaps connecting to the server sets a cookie or in some way changes/adds a file to your computer that the script can "look at" to know that you are connected and it can quit working so hard. Someone who knows "netstat" real well might be able to help out if needed. BUT, we really hope that you can locate some text differences once connected.I might not be around for a little while, but you are in good hands in this forum - lots of better teachers that I.EDIT: typo Edited May 2, 2005 by herewasplato [size="1"][font="Arial"].[u].[/u][/font][/size] Link to comment Share on other sites More sharing options...
jpm Posted May 2, 2005 Share Posted May 2, 2005 @herewasplato You are ready to improve the tutorial!!! Are you a teacher? Very good to have you in the forum Link to comment Share on other sites More sharing options...
K3vin Posted May 2, 2005 Author Share Posted May 2, 2005 Thanks herewasplato :-) you are the best teacher I could have ;-) Don't worry, what you say can't offend me as I'm a newbie! So I can only take what you say; and even if I know some little things, it's always good to keep saying things are like that etc. Like "Sleep (5000) ; this should make the script wait 5 seconds - but you knew that" It's all good ;-) Ok, now I'm gonna read again and again your post to catch the way on how to make my script; thanks again Link to comment Share on other sites More sharing options...
herewasplato Posted May 2, 2005 Share Posted May 2, 2005 (edited) @herewasplatoYou are ready to improve the tutorial!!!Are you a teacher?Very good to have you in the forum <{POST_SNAPBACK}>Nope - not a teacher, but thanks for such a compliment.[i feared that today and tonight would be too busy to get back to this forum, hence the comment that I might be away for awhile.]Tutorial: The ones that are in the help file are great, but I have a question about the MsgBox flag. The last sentence of the "Hello Word" tutorial states, "Remember, if you want to use more than one flag value then simply add the required values together." The "manual page" for MsgBox states, "The flag parameter can be a combination of the following values:""add"... as in 1 + 6 = 7?MsgBox(1, "Tutorial", "Hello World!") ; okayMsgBox(6, "Tutorial", "Hello World!") ; okayMsgBox(7, "Tutorial", "Hello World!") ; added = yuck(I assume that one should not add numbers fromthe same section of the table on the "manual page".)MsgBox(2, "Tutorial", "Hello World!") ; okayMsgBox(512, "Tutorial", "Hello World!") ; okayMsgBox(514, "Tutorial", "Hello World!") ; okay - I think"combination"... as in concatenate?MsgBox(0, "Tutorial", "Hello World!") ; okayMsgBox(64, "Tutorial", "Hello World!") ; okayMsgBox(640, "Tutorial", "Hello World!")MsgBox(064, "Tutorial", "Hello World!")I know that we do not want a manual with every possible tidbit of information in it, but my question is, could the "manual page" be changed to read more like this? "The flag parameter can be a combination (summation) of the following values:"Maybe someone can come up with a term that is more universally understood and maybe some wording explaining what numbers can and cannot go together. I do not have a good understanding of the MsgBox flag... just never needed to dig into it. MsgBox(0,"",$var) has served me well for debugs - until SciTE came along and spoiled me with that great line of code via Ctrl-Shift-D.Edit: Removed old ramblings. Edited May 30, 2006 by herewasplato [size="1"][font="Arial"].[u].[/u][/font][/size] Link to comment Share on other sites More sharing options...
K3vin Posted May 3, 2005 Author Share Posted May 3, 2005 (edited) Hehe lol nice history of your nickname :-) Yeah, I did a mistake, I wrote "I can" but I meant to write "I cant", sorry; so I can't see the texts :-( I changed the script according to what you wrote : AutoItSetOption ("WinDetectHiddenText", 1) AutoItSetOption ("WinTitleMatchMode", 3 ) AutoItSetOption ("MouseCoordMode", 0 ) While 1 = 1 WinWait ("ROSE online") WinActivate ("ROSE online") WinWaitActive ("ROSE online") MouseClick ("left", 781, 346, 2, 25) MouseClick ("left", 507, 367, 1, 25) MouseMove (0, 0, 25) Sleep (5000) If WinExists ("ROSE online" , "unknown" ) Then ExitLoop EndIf WEnd >>MouseClick ("left", 507, 367, 1, 25) that line is a necessary line to join the server, forgot to add it first! >>An error told me that the While didn't have a Wend, so I added it. >>I compared the screens of the AutoIt tools and unfortunately, there's no text nor hidden text But to help you understanding my case, I must say that there are four steps to play that game : -1)Launch the game by clicking "play online" (checks updates and stuff). -2)Fill in my password and my ID and then enter. -3)Joining a server by clicking on one of them. -4)Choose your character And then you are ingame! From 2) to 4), windows' names are the same and I can't see any text :-( >>I added the AutoItSetOption ("WinDetectHiddenText", 1) to the top part of my script but couldn't figure how it works :-s Anyway, I'm gonna try again. Edited May 3, 2005 by K3vin Link to comment Share on other sites More sharing options...
herewasplato Posted May 3, 2005 Share Posted May 3, 2005 Great catch on adding the WEnd - I would say that I left that for you to find, but that would be a lie :-) [My keyboard just started giving me extra "e"s - if you find them, you can keep them, I have lots of theeeeem now. I'll try to edit them out.] MouseClick ("left", 781, 346, 2, 25) MouseClick ("left", 507, 367, 1, 25) If the "507" click joins the server, then what does the "781" double-click do and should you really be repeating that double-click over and over? Thanks for the steps... I'm going to add some comments: -1)Launch the game by clicking "play online" (checks updates and stuff). ......you should do this yourself - for now -2)Fill in my password and my ID and then enter. ......you should do this yourself - for now -3)Joining a server by clicking on one of them. ......you should do this yourself once and if you cannot get in, start your script to perform this step over and over... -4)Choose your character ......you should do this yourself - for now Answer me this: While this script is running, do you plan on sitting there and watching it so that as soon as it is connected you can do step 4 - or do you plan on walking away from the computer and you will do step 4 whenever you check back. If you plan to stay around, then you do not need the script to know when to exit, you can stop it by pressing one key called a hotkey (see the manual). AutoItSetOption ("WinDetectHiddenText", 1) this just tells the script to look at any hidden text that may or may not be in the window. I think that it is correct to say that if the info tool cannot display any hidden text for the windows that you are intersted in, then the script does not need to look for it. That line can be removed or left in - it probably will not matter for this script since you said that you did not see any hidden text via the tool. More questions for you, but let me repeat the ones above so that they are all in one place: 1. reason for the double-click 2. should that double-click be repeated 3. run script and walk away or stay 4. Is this a game that you download and play (online) 5. ...or is it played inside a web browser like Internet Explorer 6. either way, what is the URL to get to this game later..... [size="1"][font="Arial"].[u].[/u][/font][/size] Link to comment Share on other sites More sharing options...
K3vin Posted May 3, 2005 Author Share Posted May 3, 2005 (edited) Thanks for answering that fast ;-)-The "781 click" is used to click on a channel. There are three channels and I set it to the first which is the "781 click"^^. You need to double click one of those channels, once that double click is done, it says "server full" and then "cancel" OR "downloading avatar list" which means "connection successful". So that double click is necessary if I want to join a server!-The "507 click" is used to close the "server full-cancel" button. But the problem is that the "downloading avatar list" and the "server full-cancel" buttons are are the same place!! But the script we made works for now, it has enough time to let the "downloading avatar list" to download the avatar list.-Yeah right, I only want to join a server automatically when I can't do it manually (The -3) step).-When the script is running, I'd like to go eat or something like that^^.I would walk away :-)-This is a game that you download, install and play online : a MMORPG called ROSE online. (get it there, it's a free beta http://www.roseon.com )EDIT : Maybe I didn't use the AutoItSetOption ("WinDetectHiddenText", 1) like I should, can you tell me how you make it work with the AutoIt tool so that I can say if I used it badly. (sry for bad english) Edited May 3, 2005 by K3vin Link to comment Share on other sites More sharing options...
herewasplato Posted May 3, 2005 Share Posted May 3, 2005 The AutoItSetOption ("WinDetectHiddenText", 1) code does not change the way that the tool sees the window... it only changes the way that the script sees the window. I you as a human cannot see any info below the >>>>>>>>>>> Hidden Window Text <<<<<<<<<<< line as shown by the tool, then the script will not be able to "see" line. (At least I think that this is a true statement.) If you as a human saw some text below the >>>>>>>>>>> Hidden Window Text <<<<<<<<<<< line, then (for this script) you would want to include the line AutoItSetOption ("WinDetectHiddenText", 1) to use that hidden text to help the script distinguish one window from another window. Last thing that I know to try is pixelsearch. Sort of like reading the screen like a human might... but before we do that, post the info from the tool for some of the screens and lets see if anyone has any ideas. 1. start the tool 2. start the game 3. move mouse over first place you would click 4. freeze tool 5. copy/paste all info from the tool into a post... 6. connect to a server 7. unfreeze tool 8. activate game 9. freeze tool 10. copy/paste all info from the tool into a post... Try moving your mouse over the buttons of interest and see if the info in the tool changes (besides the mouse position and pixel color under mouse info) later [size="1"][font="Arial"].[u].[/u][/font][/size] Link to comment Share on other sites More sharing options...
jonnybravo Posted May 3, 2005 Share Posted May 3, 2005 (edited) Press CTRL-ALT-F to pause the display. >>>>>>>>>>>> Window Details <<<<<<<<<<<<< Title: ROSE online Class: classCLIENT Size: X: 0 Y: 0 W: 1032 H: 780 >>>>>>>>>>> Mouse Details <<<<<<<<<<< Client: X: 760 Y: 372 Cursor ID: 0 >>>>>>>>>>> Pixel Color Under Mouse <<<<<<<<<<< RGB: Hex: 0xFBFB00 Dec: 16513792 >>>>>>>>>>> Control Under Mouse <<<<<<<<<<< Size: Control ID: ClassNameNN: Text: >>>>>>>>>>> Status Bar Text <<<<<<<<<<< >>>>>>>>>>> Visible Window Text <<<<<<<<<<< >>>>>>>>>>> Hidden Window Text <<<<<<<<<<< this is for Channel-3 is (full) Color Yellow when mouse is on it it will change to brown when u click on it to access it. here is window funtion too... WinWait("ROSE online","") If Not WinActive("ROSE online","") Then WinActivate("ROSE online","") WinWaitActive("ROSE online","") Send("'{ENTER}") when u click to server to connect u can click enter can u clip a .img .bmp .jpg of what it would look like and have it click then image when it sees it. what if u use somthing like this SetActiveWindow ROSE Online Loop 99999999 keys {return} IsWhite 789, 544 //***Commands IF true*** MousePos 800, 580 delay 100 LeftClick //****End**** Else //***Commands IF false*** //****End**** End End Edited May 3, 2005 by jonnybravo Link to comment Share on other sites More sharing options...
K3vin Posted May 3, 2005 Author Share Posted May 3, 2005 (edited) Ok, thanks, I wanted a confirmation, wasn't sure if I did the good things to make my script seeing hidden text.So now I can say there is no hidden text! 1) This is when I have to select a server.2) Choosing my character (choosing your character means that you successfully joined a server).To jonnybravo : I think using the pixel color is a great idea as the color of the button to click to join a server changes of color due to its status (red = exceeded; yellow = full...).EDIT : errrr I'm wrong, it doesn't change! You gotta click on exceeded till you can join :-(Thanks for your help.I know someone made a AutoIt script to join ROSE online without hammering his left click :-s I'm gonna change the title of my post, maybe he'll come! EDIT 2 : too bad, we can't change it :-s Edited May 3, 2005 by K3vin Link to comment Share on other sites More sharing options...
herewasplato Posted May 3, 2005 Share Posted May 3, 2005 I lost my last post to this topic into the preview post abyss... Here is a shorter version. A while back you said: "...it says "server full" and then "cancel" OR "downloading avatar list"..." Watch for a place on the screen where some part of "downloading avatar list" shows up - but nothing else appears. We might be able to use one of the Pixel functions on that area. Maybe something like: If PixelGetColor(777,333) = 16513792 Then ExitLoop 16513792 is just a sample..... Or maybe PixelSearch would be better........later [size="1"][font="Arial"].[u].[/u][/font][/size] Link to comment Share on other sites More sharing options...
K3vin Posted May 4, 2005 Author Share Posted May 4, 2005 (edited) Yeah, well, I tried to do that but the problem is that the "downloading avatar list" is a bit short to do a ctrl+alt+f lol but anyway, I think I'm gonna try again, I got an idea to succeed:-)Ok, I wasn't sure about the screenshot I took about the "downloading avatar list" button so I didn't post it. Now that I confirmed it taking another one (they really look like the same except one number...), I think we are almost done :-) there we go :-Button server full : -Button downloading avatar list 1 :-Button downloading avatar list 2 :I really think we can make it now ! Edited May 4, 2005 by K3vin Link to comment Share on other sites More sharing options...
herewasplato Posted May 4, 2005 Share Posted May 4, 2005 (edited) @jonnybravo Thanks - I had a note of thanks for your post in the post that I lost and failed to include it again in my shorten version. Hang around - we will want you to try this code on your system - if you are willing... jump in anytime. @K3vin We need to revisit the statements that I've sort of re-quoted below - since the info comes and goes that quick, then we should address an issue now - one that I was saving for later: Those two clicks ("781" and "507") with no decision being made by the script as to the need for the "507" click. K3vin>> "...the problem is that the "downloading avatar list" is a bit short to do a ctrl+alt+f lol but anyway..." K3vin>> -The "781 click" is used to click on a channel. There are three channels and I set it to the first which is the "781 click"^^. You need to double click one of those channels, once that double click is done, it says "server full" and then "cancel" OR "downloading avatar list" which means "connection successful". So that double click is necessary if I want to join a server! K3vin>> -The "507 click" is used to close the "server full-cancel" button. But the problem is that the "downloading avatar list" and the "server full-cancel" buttons are are the same place!! But the script we made works for now, it has enough time to let the "downloading avatar list" to download the avatar list. It sounds like the word "cancel" will not go away unless you click on it - right? If so, then how about pseudo-code like this: the "781" click to ask to connect sleep (1000) ---- adjust as needed If PixelGetColor(507, 367) = ?????? Then ;cancel button is present MouseClick ("left", 507, 367, 1, 25) Else Exit EndIf Edit2: .......................sample only.................................... >>>>>>>>>>> Pixel Color Under Mouse <<<<<<<<<<< RGB: Hex: 0x1A3EA9 Dec: 1719977 ?????? from here...............^^^^^ .......................sample only.................................... [We might move to PixelChecksum if PixelGetColor is too hard to use for this.] Eidt: Your images are nice. Are you using Print Screen or some utility? (If just Print Screen, try Alt-Print Screen) later Edited May 4, 2005 by herewasplato [size="1"][font="Arial"].[u].[/u][/font][/size] 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