Kenneth Posted January 11, 2007 Share Posted January 11, 2007 I would like do a script to shift between program that is running. The shift should do every 10 seconds. I have 3 programs running. P1 P2 P3 I have tried to do this, but it dosen't work. It only change between P1 and P2. Do you have another solution? Global $hTimer = TimerStart() While 1 If TimerStop($hTimer) >= (10000) Then Reconnect() WEnd ;Code Func Reconnect() Send("!{TAB}") $hTimer = TimerStart(); Reset EndFunc Link to comment Share on other sites More sharing options...
Wooltown Posted January 11, 2007 Share Posted January 11, 2007 Try to use ProcessList, see the helpfile, where you can get a list of all running programs, thwn you can use WinActivate to put the program in focus. Link to comment Share on other sites More sharing options...
Kenneth Posted January 12, 2007 Author Share Posted January 12, 2007 Try to use ProcessList, see the helpfile, where you can get a list of all running programs, thwn you can use WinActivate to put the program in focus.But this show me all tasks in the tasklist. I'm only interested in those programs that is active in taskbar.How can this me done? Link to comment Share on other sites More sharing options...
NeoFoX Posted January 12, 2007 Share Posted January 12, 2007 If you have all the three WinTitles... you can use those in combination with WinSetState Neo [center][font="Arial"]--- The Neo and Only --- [/font][font="Arial"]--Projects---[/font]Image to Text converterText to ASCII converter[/center] Link to comment Share on other sites More sharing options...
Kenneth Posted January 12, 2007 Author Share Posted January 12, 2007 If you have all the three WinTitles... you can use those in combination with WinSetState NeoHow can this be done? Link to comment Share on other sites More sharing options...
Wooltown Posted January 12, 2007 Share Posted January 12, 2007 While 1 WinActivate ("Program1") Sleep (20000) WinActivate ("Program2") Sleep (20000) WinActivate ("Program3") Sleep (20000) Wend An example of how to use WinActivate Link to comment Share on other sites More sharing options...
Kenneth Posted January 12, 2007 Author Share Posted January 12, 2007 While 1 WinActivate ("Program1") Sleep (20000) WinActivate ("Program2") Sleep (20000) WinActivate ("Program3") Sleep (20000) Wend An example of how to use WinActivateYes, that seems to very easy. But IF there was a new program we should watch, then I need to rewrite the code and I would like not to that. Link to comment Share on other sites More sharing options...
NeoFoX Posted January 12, 2007 Share Posted January 12, 2007 (edited) $var = WinList() while 1 $var = Winlist() sleep(1000) activate() WEnd func activate() For $i = 1 to $var[0][0] If $var[$i][0] <> "" AND IsVisible($var[$i][1]) Then WinActivate($var[$i][0],"") sleep(10000) EndIf Next EndFunc Func IsVisible($handle) If BitAnd( WinGetState($handle), 2 ) Then Return 1 Else Return 0 EndIf EndFunc This... ? *Edit: Now keeps on running and checking for new windows... (if there is 1 window more, it will take that one too in the loop.. I missed that part of your quest) Neo Edited January 12, 2007 by NeoFoX [center][font="Arial"]--- The Neo and Only --- [/font][font="Arial"]--Projects---[/font]Image to Text converterText to ASCII converter[/center] Link to comment Share on other sites More sharing options...
Wooltown Posted January 12, 2007 Share Posted January 12, 2007 (edited) $NumOfPrograms = $CmdLine[0] While 1 For $x = 1 to $NumOfPrograms WinActivate ($CmdLine[$x]) Sleep (20000) Next Wend Something like this...... Send the Title of the programs as parameters to the program ... ShowProg "Program 1" "Program 2" "Program 3" Edited January 12, 2007 by Wooltown 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