thrlride Posted April 21, 2009 Share Posted April 21, 2009 Hello! I'm hoping you guys can help me. I wrote a batch file that will open a new tab in firefox and open a certain website. It does this every 20 minutes scheduled by Scheduled Tasks in windows. It works fine except as it runs the open tabs keep piling up as I intend to run this script for 8 hour intervals. I'd like to get autoit to perform the same tasks but also send a ctrl+w to close each open tab it creates a few seconds after it creates it. START firefox.exe "http://www.autoitscript.com" ping 127.0.0.1 -n 5 > nul 2>&1 START firefox.exe "http://www.google.com" I imagine this is a simple process but I have no idea where to start. Thanks for any assistance you can give! Link to comment Share on other sites More sharing options...
Authenticity Posted April 21, 2009 Share Posted April 21, 2009 Run(@ProgramFilesDir& '\mozilla firefox\firefox.exe http://www.google.com/') WinWaitActive('[CLASS:MozillaUIWindowClass]') $hFF = WinGetHandle('[CLASS:MozillaUIWindowClass]') Sleep(2000) ControlSend($hFF, '', '', '^{F4}') Just send ctrl+tab to switch tabs. ^{F4} means send ctrl+F4. ;] Link to comment Share on other sites More sharing options...
Juvigy Posted April 21, 2009 Share Posted April 21, 2009 RunWait(@COMSPEC & " /c dir") This way you can execute any batch command. Just replace "dir" with what you want , ex. RunWait(@COMSPEC & " /c ping 127.0.0.1 -n 5 > nul 2>&1") Link to comment Share on other sites More sharing options...
thrlride Posted April 23, 2009 Author Share Posted April 23, 2009 (edited) Hello! I'm hoping you guys can help me. I wrote a batch file that will open a new tab in firefox and open a certain website. It does this every 20 minutes scheduled by Scheduled Tasks in windows. It works fine except as it runs the open tabs keep piling up as I intend to run this script for 8 hour intervals. I'd like to get autoit to perform the same tasks but also send a ctrl+w to close each open tab it creates a few seconds after it creates it. START firefox.exe "http://www.autoitscript.com" ping 127.0.0.1 -n 5 > nul 2>&1 START firefox.exe "http://www.google.com" I imagine this is a simple process but I have no idea where to start. Thanks for any assistance you can give! Thanks for your help on this and I apologize for the delay in my response! This script works great for my needs but I have an additional need now. I'd also like to add another variable, a for loop. I have a text file named C:\Backup\invite.txt with a bunch of numbers in it. I want a loop to read this file substituting the numbers in this file in a web address. Here is the batch version I wrote: SET BROWSER=firefox.exe for /f %%A in (C:\Backup\invite.txt) DO (START %BROWSER% -new-tab "http://www.website.com/send_invite?user_code=%%A" ping 127.0.0.1 -n 2 > nul 2>&1) Thanks again! Edited April 23, 2009 by thrlride 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