Kapli Posted October 16, 2008 Share Posted October 16, 2008 Right, so what I want to do is run 3 programs. One of them is a bat program, one is a normal program that has a minimize button in the top right corner as a normal program has, and the third doesnt have a minimize like the second program but has a button that has the class Button and Instance 3. Of course I've used the AutoIt window tool to find the titles which i use in WinSetState and ControlClick. It works pretty well except that the two last functions i mentioned doesn't work. It doesn't minimize program2 and it doesnt click the button in program3. Could anyone point me in the right direction? Btw I just started with AutoIt 10min ago, I was thinking of doing all this in a bat file but yeah then someone told me I had to use AutoIt Thanks in advance. Run("C:\Users\Bla\Desktop\wc3\Program1.exe") WinActivate("C:\Users\Kim\Desktop\wc3\Program1.exe") Sleep(5000) WinClose("C:\Users\Bla\Desktop\wc3\Program1.exe") Run("C:\Program Files\WC3Banlist\Program2.exe") WinSetState("Program2", "", @SW_MINIMIZE) Sleep(15000) Run("C:\Users\BlaDesktop\wc3\Program3.exe") WinActivate("C:\Users\Bla\Desktop\wc3\Program3.exe") ControlClick("Program3","","Button3") Link to comment Share on other sites More sharing options...
Varian Posted October 16, 2008 Share Posted October 16, 2008 Try adding the WinWait() function after your Run statements to make sure that your windows exist before proceeding to minimize & sending clicks Link to comment Share on other sites More sharing options...
Kapli Posted October 16, 2008 Author Share Posted October 16, 2008 (edited) Yes, that was it! Works almost perfectly now, only thing is that the minimize isn't exactly what I thought it would be. It seems it just minimizes it to nowhere or something I'm not sure. See with the program I have, when I click the minimize button it minimizes to tray, so I wan't AutoIt to do the same. Also, just wondering. Let's say I use AutoIt to launch a game and then programs after it, will the game minimize when those other programs are launched and AutoIt does stuff with them or will everything run smoothly in the background while I play the game? Edit: Ah crap, the program is like weird now. If i maximize it it shows up on the whole screen but if i try to restore it to normal its just gone, and I can't change the size or anything of it's gone now and I can't get it back to normal even if I restart the program :S Edited October 16, 2008 by Kapli Link to comment Share on other sites More sharing options...
Varian Posted October 16, 2008 Share Posted October 16, 2008 Look at the WinMove() function. You can set the coordinates for the window and resize it. Make you code something like like this: CODERun('program.exe', '') WinWait('Program', '') WinMove('Program', '', 1, 1, 200, 200) This will set your malfunctioning program to the top left, i a 200 x 200 window. If you don't need to read or interact with the minimized program, why not hide it (@SW_HIDE)? As far as your game being interrupted by another program, I guess that depends on the game and the program running after it. You could always make a script that : Starts your game, normal window Starts program 1, hidden starts program 2, hidden This way it shouldn't disrupt your screen Link to comment Share on other sites More sharing options...
Kapli Posted October 17, 2008 Author Share Posted October 17, 2008 Ah thank you, that made the show normally again Well see I want to have the program in the tray because I might want to open it. And if i click on the minimize button in the program it minimizes to tray. So I need AutoIt to click on the minimize button so it gets minimized to tray and I can open it back up later. Link to comment Share on other sites More sharing options...
Kapli Posted October 17, 2008 Author Share Posted October 17, 2008 Nevermind, I just used Send("{ALT}") Sleep(3000) Send("{SPACE}") Sleep(3000) Send("N") Got my program working perfectly, thanks for the help 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