21

When I open IE on different days of the week, I want different tabs to be opened automatically.

I have to run different reports for work each day of the week and it takes a lot of time to open the 5-10 tabs to run the reports. It would be a lot faster if, when I open IE, the tabs I needed would automatically be loaded and ready for me to use.

Is there a way to open 5-10 different tabs, in IE, depending on the day of the week?

Example:
Monday - 6 Accounting pages
Tuesday - 7 Billing pages
Wednesday - 5 HR pages
Thursday - 10 Schedule pages
Friday - 8 Work Summary/Order pages

5
  • 1
    What's your operating system? Which IE version are you using?
    – and31415
    May 9, 2014 at 15:57
  • @and31415 look the tag! it says IE 11 ;)
    – Braiam
    May 10, 2014 at 13:38
  • 2
    @Braiam It hasn't been always like that.
    – and31415
    May 10, 2014 at 13:51
  • 4
    "I open IE" whyyyyy
    – Tortoise
    May 11, 2014 at 5:02
  • 2
    @Tortoise Apparently it's at work and there is no choice.
    – LWZ
    May 15, 2014 at 21:58

4 Answers 4

34

Rather than trying the brute force method, how about a work around?

Open up each set of tabs either in different windows or one set at a time and save all tabs to bookmark folders. Put the folders on the bookmark toolbar for ease of access.

On each day, right-click on the folder and open all tabs with one click.

You could put all the day folders into a top-level folder to save space if you want at the expense of an extra click to get to them.

If you really must go further, you need to write a program or script to drive IE. The easiest way is probably to write a PowerShell script.

4
  • 3
    "The easiest way is probably to write a PowerShell script." I agree, so I busted one out in my answer. :) May 9, 2014 at 16:34
  • 2
    I really love PowerShell. Great scripting environment. May 9, 2014 at 16:45
  • Nice one, I did start to look at doing one but work got in the way! May 9, 2014 at 16:45
  • 1
    +1 Perfect solution that keeps things simple. Bookmark folders are also ideal as you can middle-click the folder to open all the bookmarks in new tabs, and it's easy to drag-and-drop new sites into them from the address bar. The behavior also works the same in most other browsers -- handy for if/when the corporate policy drones get smart and move everyone to a different browser :)
    – Nick
    May 9, 2014 at 21:43
34

You can use PowerShell to automate IE:

This example script I shoved together will figure out which day it is, and open IE with a set of tabs for that day:

# Arrays of sites to open; one for each day of the week.
$mondaySites = @("http://www.google.com", "http://www.yahoo.com", "http://www.bing.com")
$tuesdaySites = @("http://www.intel.com","http://www.apple.com","http://www.ubuntu.com/","http://www.android.com/", "http://www.microsoft.com")
$fridaySites = @("http://www.superuser.com", "http://www.cnn.com","http://www.bbc.com/news/world/","http://www.reddit.com/r/funny/")

$sitesToOpen = @()

# Get the day of the week
$today = (get-date).DayOfWeek

# Depending on the day of the week discovered, assign the right day's array into the sitesToOpen array.
switch ($today) { 
        "Monday" {$sitesToOpen = $mondaySites} 
        "Tuesday" {$sitesToOpen = $tuesdaySites} 
        "Friday" {$sitesToOpen = $fridaySites}
    }

# Use COM to create a new IE instance.    
$ie = new-object -com "InternetExplorer.Application"

$isFirstSite = $true

# Loop through the array of sites, and navigate our IE instance to them.
foreach ($site in $sitesToOpen) {
        If ($isFirstSite) {
            $ie.Navigate2($site)
            $isFirstSite = $false
        } else {
            # If it's not the first site, then include the flag to open the site in a new tab.
            $ie.Navigate2($site, 0x10000)
        }
    }

# Show the IE window.    
$ie.Visible = $true

Note: I only did site arrays for three days, you'll want to add others for other days you need to work on. :)

4
  • I'm sure that's a better way than the one I outlined. May 9, 2014 at 16:46
  • 2
    @JulianKnight Personally, I think your approach is much better. Even as a developer, I would prefer to main a folder of bookmarks for each day which can be easily managed in IE rather than a script that needs to be edited and stored somewhere. The Powershell approach would be perfect if the list were dynamic, but I don't think this request needs that.
    – Nick
    May 9, 2014 at 21:38
  • Kudos for the awesome script though. +1
    – khaverim
    May 10, 2014 at 0:43
  • I do like this answer, but it I'm not too proficient at scripting and it would take me longer to add or remove sites from the script than from a bookmark folder
    – user304064
    May 15, 2014 at 20:43
7

I don't advise it with IE since it's not built in... You will need a work around or similar.

With FireFox, you could do by writing a small bat file. Instead of opening the browser, you'd have to run the .bat file which will open FireFox with the chosen tabs

@ECHO OFF

SET BROWSER=firefox.exe
START %BROWSER% -new-tab "google.com"
START %BROWSER% -new-tab "http://superuser.com"
START %BROWSER% -new-tab "stackexchange.com" 

Personally, I'd save several different versions (for each of the week). You could even have a script to open the page when you first log on in the morning.

If you must use IE, you'd use a similar concept in that every day, when you first log on, you'll run a script which will update the registry for you. Save the below as a .reg file and run it (remember, take a back up first just in case)

Windows Registry Editor Version 5.00

[HKEY_CURRENT_USER\Software\Microsoft\Internet Explorer\Main]
"Start Page"="http://www.yahoo.com"
reg add "HKEY_CURRENT_USER\Software\Microsoft\Internet Explorer\Main" /t REG_MULTI_SZ /v "Secondary Start Pages" /d "http://www.bbc.co.uk\0http://www.superuser.com\0" /f

So, you will have 5 of these files and for the entire day, when you open IE it will have the settings you want.

6
  • 1
    You should be able to do with IE also: start iexplore.exe -new http://yahoo.com
    – ek9
    May 9, 2014 at 13:01
  • Now you only need to add day of the week and a few if statements to run appropriate commands based on which day of the week it is.
    – ek9
    May 9, 2014 at 13:02
  • 1
    This. It'll be nice when a browser implements a similar feature. Been wanting that a while now.
    – nerdwaller
    May 9, 2014 at 13:04
  • 3
    @edvinas.me The -new parameter is obsolete as of IE 7. Source
    – and31415
    May 9, 2014 at 13:26
  • 1
    All of IE is obsolete since Chrome version 1. :P
    – Lzh
    May 10, 2014 at 11:48
5

Preliminary steps

  1. Create an AutoLoad folder in your Internet Explorer (IE) favorites.

  2. Create seven subfolders in the folder you just created, numbered from 0 to 6. The end result should look like this:

    Favorites

    Each number corresponds to a day of the week:

    • 0 - Sunday
    • 1 - Monday
    • 2 - Tuesday
    • 3 - Wednesday
    • 4 - Thursday
    • 5 - Friday
    • 6 - Saturday

  3. Put the pages you want to open in each subfolder, as needed.

Batch script

Copy the following code and paste it in a new file called SetIEPages.cmd:

@echo off
setlocal
setlocal enabledelayedexpansion

call :getWeekday

REM set the working directory
set dir=%userprofile%\Favorites\AutoLoad\%weekday%

REM ensure the directory exists
if not exist "%dir%\" exit /b 2

pushd "%dir%"

set pages=
set /a counter=1
set key=HKCU\Software\Microsoft\Internet Explorer\Main

REM loop through all favorites links
for %%A in (*.url) do (

REM get the URL
for /f "usebackq delims=" %%B in (
`type "%%~A" ^| find /i "URL="`
) do (

set url=%%~B
set url=!url:~4!

REM check whether the URL is empty
if defined url (

if !counter! geq 2 (
set pages=!pages!"!url!"\0
) else (

REM set the start page
reg add "%key%" /v "Start Page" /t REG_SZ /d "!url!" /f >nul

REM clear the secondary pages
reg delete "%key%" /v "Secondary Start Pages" /f >nul 2>&1
)

REM increase the URL counter
set /a counter += 1
)))

if defined pages (
set pages=!pages:~0,-2!

REM set the seconday pages
reg add "%key%" /v "Secondary Start Pages" /t REG_MULTI_SZ /d "!pages!" /f >nul
)

popd
endlocal & exit /b

:getWeekday
for /f "usebackq tokens=2 delims==" %%G in (
`wmic path Win32_LocalTime get dayofweek /value ^| findstr /c:"="`
) do set weekday=%%G
exit /b

How it works

The script retrieves the current day of week, which is then used to build the path containing the daily pages. It then scan all favorite links available in the target folder, getting the URL of each. Finally the IE start page(s) are set. As soon as the browser is started, the selected pages will load automatically. Along with the scheduled task below, this make things work in a set-and-forget fashion.

Scheduled task

  1. Press Win+R, type or paste taskschd.msc, and press Enter.
  2. Click Action > Create Task. Name it SetIEPages.
  3. While in the General tab, click Change User or Group.
  4. Type your user account name, click Check Names, and then click OK.
  5. Select the Run whether user is logged on or not option, and check the Do not store password option.
  6. Select the Triggers tab, and click New.
  7. Change the Begin the task to At log on.
  8. Click the Specific user option, and make sure your user account is selected. Then click OK.
  9. Switch to the Actions tab, and click New.
  10. Type "X:\Path\to\SetIEPages.cmd" in the Program/script textbox, replacing it with the actual file path.
  11. Click the Conditions tab, and uncheck Start the task only if the computer is on AC power option.
  12. Enable the Run task as soon as possible after a scheduled start is missed option.
  13. Leave all other settings to default values, and click OK.

You must log in to answer this question.