Jump to content

A little help with a script


Kapli
 Share

Recommended Posts

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 :P

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

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 by Kapli
Link to comment
Share on other sites

Look at the WinMove() function. You can set the coordinates for the window and resize it. Make you code something like like this:

CODE
Run('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

Ah thank you, that made the show normally again :P

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

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...