allywilson Posted November 18, 2006 Share Posted November 18, 2006 hi guys, am having horrible results when trying to setup an array in autoit :-( Basically, my company is having small recurring issues with users and certain apps. i've created a simple little script that checks for an active window with the title of e.g. Windows Media Player then shuts it straightaway and loops. While 1 = 1 WinWaitActive("Windows Media Player") WinKill("") Wend What I'd like to do is have something like Dim $AnArray $AnArray[1] = "Solitaire" $AnArray[2] = "Windows Media Player" $AnArray[3] = "Calculator" While 1 = 1 IF WinWaitActive("$AnArray") THEN WinKill("") ENDIF Wend But I cannot get the syntax correct. I've tried pretty much every format I can think of (I'm not too clued up on AutoIT). The above probably looks like complete gibberish really...The only reference in the autoit handbook isn't very detailed. Can anyone help? :-( Ally Link to comment Share on other sites More sharing options...
Developers Jos Posted November 18, 2006 Developers Share Posted November 18, 2006 Dim $AnArray[4] $AnArray[1] = "Solitaire" $AnArray[2] = "Windows Media Player" $AnArray[3] = "Calculator" While 1 = 1 For $x = 1 To 3 If WinWaitActive($AnArray[$x]) Then WinKill($AnArray[$x]) Next Sleep(500) WEnd SciTE4AutoIt3 Full installer Download page - Beta files Read before posting How to post scriptsource Forum etiquette Forum Rules Live for the present, Dream of the future, Learn from the past. Link to comment Share on other sites More sharing options...
allywilson Posted November 18, 2006 Author Share Posted November 18, 2006 Dim $AnArray[4] $AnArray[1] = "Solitaire" $AnArray[2] = "Windows Media Player" $AnArray[3] = "Calculator" While 1 = 1 For $x = 1 To 3 If WinWaitActive($AnArray[$x]) Then WinKill($AnArray[$x]) Next Sleep(500) WEnd Excellent thanks very much! Another problem though... The above script doesn't run unless the first window title is activated. If I open calculator first it won't kill it, if I then open solitaire it'll start killing the windows. Any way to change that? Thanks! Link to comment Share on other sites More sharing options...
allywilson Posted November 18, 2006 Author Share Posted November 18, 2006 Excellent thanks very much! Another problem though...The above script doesn't run unless the first window title is activated. If I open calculator first it won't kill it, if I then open solitaire it'll start killing the windows. Any way to change that?Thanks!Don't worry! Seemed to get around it by changing WinWaitActive to WinActive.Cheers for the help! Link to comment Share on other sites More sharing options...
Developers Jos Posted November 18, 2006 Developers Share Posted November 18, 2006 Don't worry! Seemed to get around it by changing WinWaitActive to WinActive.Cheers for the help!Correct ... didn't concentrate on the Win command... just the array question .. SciTE4AutoIt3 Full installer Download page - Beta files Read before posting How to post scriptsource Forum etiquette Forum Rules Live for the present, Dream of the future, Learn from the past. 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