DeFirence Posted March 15, 2007 Share Posted March 15, 2007 (edited) Hello First of all i wanna say im totally new to autoit but im loving it Now, this may be a little confusing for me to explain what i need but ill try my best. I want to write 2 scripts or 2 parts of a script that are slightly different. When i run it the first time it must run the first script and when run the second time, it must run the second script. So it must alternate between the two scripts each time it is run. Ie: First time: Script 1 Second: Script 2 Third time: Script 1 Forth time: Script 2 and so on... I have no clue where to start, i have looked in the forums but im not too sure what to search for... Thanks alot DeFirence Edited March 15, 2007 by DeFirence Link to comment Share on other sites More sharing options...
EndFunc Posted March 15, 2007 Share Posted March 15, 2007 HelloFirst of all i wanna say im totally new to autoit but im loving it Now, this may be a little confusing for me to explain what i need but ill try my best.I want to write 2 scripts or 2 parts of a script that are slightly different.When i run it the first time it must run the first script and when run the second time, it must run the second script.So it must alternate between the two scripts each time it is run.Ie: First time: Script 1Second: Script 2Third time: Script 1Forth time: Script 2and so on...I have no clue where to start, i have looked in the forums but im not too sure what to search for...Thanks alotDeFirencei think in order to be helped you need to explain what you are needing the scripts to do. There are conditions that can be met and if they are they can run the 1st part, then the 2nd and so on. There are so many ways to do this you need to elaborate more on what you are trying to do. EndFuncAutoIt is the shiznit. I love it. Link to comment Share on other sites More sharing options...
DeFirence Posted March 15, 2007 Author Share Posted March 15, 2007 Ok, thanks for the quick reply, i really wanna get this working In short, its gonna automate hosting warcraft III dedicated servers, however if Game 3 was created with name: Game3 Then after the game has ended, the new game cant have the same name as the old game otherwise it doesnt show up on battle.net . thats basically what it needs to do, thats why i said alternate the name each time it hosts. Thanks again DeFirence Link to comment Share on other sites More sharing options...
DeFirence Posted March 15, 2007 Author Share Posted March 15, 2007 Anyone got ideas? Link to comment Share on other sites More sharing options...
seandisanti Posted March 15, 2007 Share Posted March 15, 2007 (edited) Anyone got ideas?just have one script use ProcessExists() to detect the other, and run the second instead if the first is running***edit***sorry, i misunderstood and hadn't read all of your explanation. you could use an external file to save and check the name each time it's run. Edited March 15, 2007 by cameronsdad Link to comment Share on other sites More sharing options...
DeFirence Posted March 15, 2007 Author Share Posted March 15, 2007 Wow, that is exactly what i was thinking! Only thing is I have no idea how, could some1 help me with the script required please? DeFirence Link to comment Share on other sites More sharing options...
seandisanti Posted March 15, 2007 Share Posted March 15, 2007 Wow, that is exactly what i was thinking!Only thing is I have no idea how, could some1 help me with the script required please?DeFirenceSure thing man, check in your helpfile for FileWrite(),FileRead(),IniRead(),IniWrite().Some people like the ini functions better, i typically just use a plain text file or a registry entry Link to comment Share on other sites More sharing options...
DeFirence Posted March 15, 2007 Author Share Posted March 15, 2007 Could you please tell me what thre difference is between the ini and the file functions and also how to use it roughly, ive read the functions and Im guessing you gotta use and IF statement, but im still very new to it. DeFirence Link to comment Share on other sites More sharing options...
seandisanti Posted March 15, 2007 Share Posted March 15, 2007 Could you please tell me what thre difference is between the ini and the file functions and also how to use it roughly, ive read the functions and Im guessing you gotta use and IF statement, but im still very new to it.DeFirencebecause your file is probably going to contain only a single entry, the difference is just preference. ini files have sections with values, and alot of people use them for settings etc. Link to comment Share on other sites More sharing options...
seandisanti Posted March 15, 2007 Share Posted March 15, 2007 Could you please tell me what thre difference is between the ini and the file functions and also how to use it roughly, ive read the functions and Im guessing you gotta use and IF statement, but im still very new to it.DeFirenceThe help file has examples for each function Link to comment Share on other sites More sharing options...
DeFirence Posted March 15, 2007 Author Share Posted March 15, 2007 The help file has examples for each function*sigh*Dude. the help file does, and i can use them, but u need more then those 2 functions to make what i want to do to work.I have no idea what other commands you use, im guessing, IF readini1 = 2 then goto Procedure3But obviously thats wrong.Please man, help me out here, i cant find help on howto do this!!!DeFirence Link to comment Share on other sites More sharing options...
seandisanti Posted March 15, 2007 Share Posted March 15, 2007 *sigh*Dude. the help file does, and i can use them, but u need more then those 2 functions to make what i want to do to work.I have no idea what other commands you use, im guessing, IF readini1 = 2 then goto Procedure3But obviously thats wrong.Please man, help me out here, i cant find help on howto do this!!!DeFirencei'm sorry, i wanted to give you a chance to figure it out yourself before doing it for you.what are the files that you are running, and the possible values uponwhich to base the decision of which to run... Link to comment Share on other sites More sharing options...
DeFirence Posted March 15, 2007 Author Share Posted March 15, 2007 Its ok man and thanx for ur help so far Heres my code (sorry if its messy): expandcollapse popup;Create game on bnet RunAsSet("1", "DeFirence", "1") Run("J:\war3z\w3l.exe", "J:\war3z") WinWaitActive("Warcraft III") Sleep(3000) Send("{ENTER}") Send("{LCTRL}b") Sleep(4500) Send("password{ENTER}") Sleep(4100) Send("!g") Sleep(2500) Send("!c") Sleep(2500) Send("!o") Sleep(1500) MouseClickDrag("left", 543, 194, 529, 240, 10) Sleep(1000) *** *** *** Check INI File *** *** *** *** If ini=2 goto here *** Send("DotA Dedicated Host 1{ENTER}") IniWrite that gamename 1 was used *** end of procedure *** *** If ini=1 goto here *** Send("DotA Dedicated ONE{ENTER}") IniWrite that gamename 2 was used *** end of procedure *** Sleep(4500) MouseMove(32, 252, 1) MouseClick("left") MouseMove(81, 286, 1) MouseClick("left") MouseMove(52, 321, 1) MouseClick("left") Link to comment Share on other sites More sharing options...
Bert Posted March 15, 2007 Share Posted March 15, 2007 It looks like you are trying to learn how to run a marathon, and you still need to learn to walk. My advice, slow down, and start small. You should first try Valuater's AutoIt 123. Do that, then take a look at the help file. Try the examples in the there, and see how they work. Once you get a feel for it, try to do what you want to do. It will make it MUCH easier for you if you take this approach. Also, if you want, take a look at this link: Learning to Script with AutoIt 3 By LxP. It may be of help to you. It is much better to try to learn how to fish, instead of asking for fish. We are more than happy to teach you to fish. We do not however like someone trying to ask for fish.... The Vollatran project My blog: http://www.vollysinterestingshit.com/ Link to comment Share on other sites More sharing options...
DeFirence Posted March 15, 2007 Author Share Posted March 15, 2007 It looks like you are trying to learn how to run a marathon, and you still need to learn to walk. My advice, slow down, and start small. You should first try Valuater's AutoIt 123. Do that, then take a look at the help file. Try the examples in the there, and see how they work. Once you get a feel for it, try to do what you want to do. It will make it MUCH easier for you if you take this approach. Also, if you want, take a look at this link: Learning to Script with AutoIt 3 By LxP. It may be of help to you. It is much better to try to learn how to fish, instead of asking for fish. We are more than happy to teach you to fish. We do not however like someone trying to ask for fish....Hi man,I hear what youre saying but i would just like to get this script done, im going to learn and that myself but i need this done asap...If anyone could help me with my script it would be greatly appreciated Thanks againDeFirence Link to comment Share on other sites More sharing options...
Bert Posted March 15, 2007 Share Posted March 15, 2007 I was writing my response when you posted again. To check a ini = inireadYou will also need a "while" loop to keep your script running.Instead of using send, use controlsend - more stableAlso, you use a bunch of sleep statements - what happens when you remove them? Does it mess up? This is where controlsend mak make it more stable.Mouseclickdrag? wondering about that one. Is the GUI you are working with have a item you have to move? You also used 10 for the speed. You can drop that off for that is the default speed. What do you plan to use for a screen event or process event to trigger what function you want to use? You would need to be specific. Look on using the AutoIt window info tool if needed. It is part of the full download of AutoIt.Whats with the mouseclicks at the end? You may want to use controlclick. more stable, and if the window isn't active, it still works. The Vollatran project My blog: http://www.vollysinterestingshit.com/ Link to comment Share on other sites More sharing options...
DeFirence Posted March 15, 2007 Author Share Posted March 15, 2007 I was writing my response when you posted again. To check a ini = inireadYou will also need a "while" loop to keep your script running. im not quite sure where to put itInstead of using send, use controlsend - more stableAlso, you use a bunch of sleep statements - what happens when you remove them? Does it mess up? This is where controlsend mak make it more stable. i need the sleep statements cause on warcraft's menu there is animation when u choose an optionMouseclickdrag? wondering about that one. Is the GUI you are working with have a item you have to move? You also used 10 for the speed. You can drop that off for that is the default speed. i used mouseclickdrag instead of click move click :SWhat do you plan to use for a screen event or process event to trigger what function you want to use? You would need to be specific. Look on using the AutoIt window info tool if needed. It is part of the full download of AutoIt. The way i plan to do this isnt with a trigger but rather a mirc script i wrote that will start the autoit script when a player whispers the botWhats with the mouseclicks at the end? You may want to use controlclick. more stable, and if the window isn't active, it still works.I will look into it, i have never used control :SIf you could at all, please help me with the code once you understand everything.Ask anymore questions u need, ill reply asap as i want this soon DeFirence Link to comment Share on other sites More sharing options...
Bert Posted March 15, 2007 Share Posted March 15, 2007 (edited) It is MUCH faster for you to do what I suggested at first, then come back and try again. Your code will be much better, and MUCH closer to just what you need. Again, you are trying to learn to run, and you don't have much of a idea on how to walk. Have you tried AutoIt 123 yet? It takes a hour to do at most, but it will address most of the issues you have. Trust me on this. It is well worth your time to take the course, (it will take a hour and a halve at most) then try tweaking your code. edit: Sorry if I'm seeming to be somewhat harsh. I'm not meaning to be. I understand you would like to get this done as fast as possible, but it is quite hard to do when I'm not in front of the PC in question. If we can get you up to speed faster, then we can solve your issue faster. My post was not meant to be mean. It was meant to be directive. Edited March 15, 2007 by Volly The Vollatran project My blog: http://www.vollysinterestingshit.com/ Link to comment Share on other sites More sharing options...
DeFirence Posted March 15, 2007 Author Share Posted March 15, 2007 hehe, its cool man, as long as youre there to help me alone However it seems like im going to be up all night again, i slept 2 hours today and nothing last nite, its now 10:16pm... Heres the deal now, ive done the AutoIt 123 and it is quite good, im still pretty much lost as hell tho. I cant get the control id for warcraft and i would like to use controlsend. Is there any other way to get it, the window info thing only gives the title =\ DeFirence 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