当我在一周的不同天打开 IE 时,我希望自动打开不同的选项卡。
我必须为一周中的每一天运行不同的工作报告,打开 5-10 个选项卡来运行报告需要花费大量时间。如果当我打开 IE 时,我需要的选项卡会自动加载并准备好供我使用,那么速度会快很多。
有没有办法在 IE 中根据星期几打开 5-10 个不同的选项卡?
示例:
周一 - 6 个会计页面
周二 - 7 个计费页面
周三 - 5 个人力资源页面
周四 - 10 个计划页面
周五 - 8 个工作总结/订单页面
Jul*_*ght 34
与其尝试蛮力方法,不如另辟蹊径?
在不同的窗口中或一次打开一组选项卡,然后将所有选项卡保存到书签文件夹中。将文件夹放在书签工具栏上以便于访问。
在每一天,右键单击文件夹并单击打开所有选项卡。
如果您愿意,可以将所有日常文件夹放入顶级文件夹以节省空间,但需要额外单击才能访问它们。
如果你真的必须更进一步,你需要编写一个程序或脚本来驱动 IE。最简单的方法可能是编写一个 PowerShell 脚本。
Ƭᴇc*_*007 34
您可以使用 PowerShell 自动化 IE:
我推到一起的这个示例脚本会找出今天是哪一天,并用一组标签打开 IE:
# 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
Run Code Online (Sandbox Code Playgroud)
注意:我只做了三天的站点阵列,您需要在需要处理的其他日子添加其他站点阵列。:)
我不建议它与 IE 一起使用,因为它不是内置的......你需要一个解决方法或类似的方法。
使用 FireFox,您可以通过编写一个小的 bat 文件来完成。您不必打开浏览器,而是必须运行 .bat 文件,该文件将使用所选选项卡打开 FireFox
@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"
Run Code Online (Sandbox Code Playgroud)
就个人而言,我会保存几个不同的版本(每周)。您甚至可以有一个脚本来在早上第一次登录时打开页面。
如果您必须使用 IE,那么您每天都会使用类似的概念,当您第一次登录时,您将运行一个脚本来为您更新注册表。将以下内容另存为 .reg 文件并运行它(记住,先备份以防万一)
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
Run Code Online (Sandbox Code Playgroud)
因此,您将拥有其中 5 个文件,并且一整天,当您打开 IE 时,它将拥有您想要的设置。
AutoLoad在 Internet Explorer (IE) 收藏夹中创建一个文件夹。
在您刚刚创建的文件夹中创建七个子文件夹,编号从0到6。最终结果应如下所示:

每个数字对应一周中的一天:
0 - 星期日1 - 周一2 - 周二3 - 周三4 - 周四5 - 星期五6 - 周六
根据需要将要打开的页面放在每个子文件夹中。
复制以下代码并将其粘贴到名为 的新文件中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
Run Code Online (Sandbox Code Playgroud)
该脚本检索当前星期几,然后用于构建包含每日页面的路径。然后扫描目标文件夹中所有可用的收藏链接,获取每个链接的 URL。最后设置 IE 起始页。浏览器启动后,所选页面将自动加载。连同下面的计划任务,这使事情以一劳永逸的方式工作。
taskschd.msc,然后按Enter。SetIEPages。"X:\Path\to\SetIEPages.cmd"在Program/script文本框中键入,将其替换为实际文件路径。| 归档时间: |
|
| 查看次数: |
3090 次 |
| 最近记录: |