Sign in to follow this  
Followers 0
bdrephal

Help

3 posts in this topic

Hello,

I'v e very new to the suto it application. I was trying to create a script that would Alt-Tab between two IE browsers every 1 min. Does any happen to have the code already developed for it? or somethign close that I could tweak. I'm guessign it isn;t that hard, some sort of for loop witha timer or something along those lines. Or perhaps there is even an easier way. Please help.

what would the syntex be?

Share this post


Link to post
Share on other sites



Modify this script with the exact wording in the titlebar. As you can see, I use Firefox. But it will work in Internet Explorer, too.

While 1
    WinActivate("Google - Mozilla Firefox")
    Sleep (60000) ; 60000 ms = 1 minute
    WinActivate("Help - AutoIt Forums - Mozilla Firefox")
    Sleep(60000)
WEnd

#include <ByteMe.au3>

Share this post


Link to post
Share on other sites

#3 ·  Posted (edited)

This should do what you want (works with any number of IE windows, though not tabs)

AutoItSetOption("trayicondebug", 1) ;lets you mouse over tray icon to see what line of the code the script is on
HotKeySet('{esc}',"Terminate") ;sets esc key to function
AutoItSetOption("WinTitleMatchMode",2) ;sets window search to part of window name instead of full match
$IE_List = WinList("Windows Internet Explorer") ;creates an array with all windows matching "Windows Internet Explorer"
$i = 1
$timer = TimerInit() ;starts a timer
WinActivate($IE_List[$i][1]) ;activates the first match in the array
$i+=1 ;increases $i by 1
While 1 ;starts unending loop
 If $i > Int($IE_List[0][0]) Then ;checks if $i is greater than total number of IE windows
  $i = 1 ;sets$i back to 1 if it is
 EndIf
 If TimerDiff($timer) > 60000 Then ;checks the timer if 1 minute has passed
  WinActivate($IE_List[$i][1]) ;if yes, activate the next IE window
  $i += 1 ;add 1 to $i
  $timer = TimerInit() ;reset the timer
 EndIf
WEnd
Func Terminate() ;if esc is pressed
 Exit ;exit the script
EndFunc

**edit**

for some reason, I thought it was every 2 minutes

**edit 2**

added comments to the code so you knnow what it is doing

Edited by kaotkbliss

010101000110100001101001011100110010000001101001011100110010000

001101101011110010010000001110011011010010110011100100001

My Android cat and mouse game
https://play.google.com/store/apps/details?id=com.KaosVisions.WhiskersNSqueek

We're gonna need another Timmy!

Share this post


Link to post
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
Sign in to follow this  
Followers 0