如何运行 Microsoft Outlook 2010 的多个实例,每个实例都有一个特定的配置文件?

如何运行 Microsoft Outlook 2010 的多个实例,每个实例都有一个特定的配置文件?

我有 2 个邮件配置文件 - 一个配置文件有一个 Exchange 2010 帐户,另一个配置文件有一个 IMAP 帐户。我想为每个配置文件打开一个 Outlook 实例。

outlook.exe /profile MyExchangeProfile我针对 Exchange 配置文件和 IMAP 配置文件执行outlook.exe /profile MyIMAPProfile,结果是我获得 2 个 Outlook 实例,每个实例都有 MyExchangeProfile。

事实上,无论我在单独执行时指定什么配置文件,我首先加载的配置文件始终是被加载的配置文件。

答案1

答案2

我强烈推荐你不是这样做。运行多个 Outlook 实例是不受支持的情况,会导致配置文件和存储损坏(相信我,我见过很多这种情况)。

相反,将您的 IMAP 帐户作为第二个帐户添加到您的 Exchange 配置文件中。

答案3

Extraoutlook 运行良好,事实上,我为命令行编写了一个界面,我目前使用它同时打开 22 个 Exchange 配置文件并更新它们的 ost 文件以保留本地备份

在 Autoit 中编译的代码 https://www.autoitscript.com/site/autoit/

该计划有四种选择

  1. 运行单个配置文件(一次运行一个配置文件)
  2. 添加自动启动(添加配置文件,用户并传递到 ini 文件)
  3. 运行自动启动(连续打开多个 Outlook 实例)
  4. 运行自动关闭(关闭 Outlook 的所有实例)

代码:

;************************************************************
#RequireAdmin

#include <MsgBoxConstants.au3>
#include <guiconstants.au3>
#include <string.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#include <Misc.au3>

Global $Font = 'Verdana'
Global $Outlook = 'C:\Program Files (x86)\Microsoft Office\Office14\OUTLOOK.EXE' ;Office 2010
Global $ExtraOutlook = @SystemDir & "\Extraoutlook.exe"
Global $Process = "OUTLOOK.exe"
Global $IniFile = "outlookprofiles.ini"

Global $Radio[4]

FileInstall("Extraoutlook.exe",@SystemDir & "\Extraoutlook.exe",0)

    If Not FileExists (@ScriptDir & '\' & $IniFile) Then
        Iniwrite($IniFile, "START","Count","0")
        Iniwrite($IniFile, "PROFILE","1","")
        Iniwrite($IniFile, "USER","1","")
        Iniwrite($IniFile, "PASS","1","")
    Else
        _Start()
    EndIf
        _Start()


Func _Start()

$WinMain = GuiCreate('Outlook', 180,215 )

GUISetFont(7,300,'' ,$font)

    $Input1 = GUICtrlCreateInput('Profile',5,15,165,25)
    $Input2 = GUICtrlCreateInput('User',5,45,165,25)
    $Input3 = GUICtrlCreateInput('Password',5,75,165,25)

    $Radio[0] = GUICtrlCreateRadio("", 5, 105, 15, 15)
    $Radio[1] = GUICtrlCreateRadio("", 5, 125, 15, 15)
    $Radio[2] = GUICtrlCreateRadio("", 5, 145, 15, 15)
    $Radio[3] = GUICtrlCreateRadio("", 5, 165, 15, 15)

    $label = GUICtrlCreateLabel("Start Outlook Profile", 25, 105,150,25);
    $label = GUICtrlCreateLabel("Add to Autostart", 25, 125,150,25)
    $label = GUICtrlCreateLabel("Run Autostart", 25, 145,150,25)
    $label = GUICtrlCreateLabel("Run Autoclose", 25, 165,150,25)

    $ButtonOK = GuiCtrlCreateButton('OK', 5,190,80,20)
    $ButtonCancel = GuiCtrlCreateButton('Cancel', 90,190,80,20)

    GUICtrlSetState($Radio[0],$GUI_CHECKED)
    GuiCtrlSetState($Input2,$GUI_DISABLE)
    GuiCtrlSetState($Input3,$GUI_DISABLE)

GUISetState(@SW_SHOW)

    Local $Count = IniRead($Inifile,"START","Count","")
    Local $a = 1
    Local $msg = GUIGetMsg()

    While  $a = 1  ;Infinite Loop

        Switch GUIGetMsg()

            Case $ButtonOK

                    If _IsChecked($Radio[1]) Then
                        IniWrite ($IniFile,"PROFILE",$Count +1,GUICtrlRead($Input1))
                        IniWrite ($IniFile,"USER",$Count +1,GUICtrlRead($Input2))
                        IniWrite ($IniFile,"PASS",$Count +1,GUICtrlRead($Input3))
                        IniWrite ($IniFile,"START","Count",$Count +1)
                        MsgBox(64,"New Profile Added","Profile Name: "  & GUICtrlRead($Input1) & @CRLF & "User: " & GUICtrlRead($Input2) & @CRLF & "Password: " & GUICtrlRead($Input3),10)
                    Else
                        If _IsChecked($Radio[0]) Then
                            If GUICtrlRead($Input1) <> "Profile" Then
                                Run(@ComSpec & " /c " & $ExtraOutlook & " " & '"' &  $Outlook & '"' & " " & "/profile " & $Input1, "", @SW_HIDE)
                            Else
                                MsgBox(64,"","Please Enter a valid Profile name.",5)
                            EndIf
                        Else
                            If _IsChecked($Radio[2]) Then
                                _Autostart()
                            Else
                                If _IsChecked($Radio[3]) Then
                                    _Autoclose()
                                EndIf
                            EndIf
                        EndIf
                    EndIf


            Case $Radio[0]
                    GuiCtrlSetState($Input1,$GUI_ENABLE)
                    GuiCtrlSetState($Input2,$GUI_DISABLE)
                    GuiCtrlSetState($Input3,$GUI_DISABLE)

            Case $Radio[1]
                    GuiCtrlSetState($Input1,$GUI_ENABLE)
                    GuiCtrlSetState($Input2,$GUI_ENABLE)
                    GuiCtrlSetState($Input3,$GUI_ENABLE)

            Case $Radio[2]
                    GuiCtrlSetState($Input1,$GUI_DISABLE)
                    GuiCtrlSetState($Input2,$GUI_DISABLE)
                    GuiCtrlSetState($Input3,$GUI_DISABLE)

            Case $Radio[3]
                    GuiCtrlSetState($Input1,$GUI_DISABLE)
                    GuiCtrlSetState($Input2,$GUI_DISABLE)
                    GuiCtrlSetState($Input3,$GUI_DISABLE)

            Case $ButtonCancel ; Exit the loop.
               Exit
        EndSwitch
    WEnd

EndFunc


Func _IsChecked($idControlID)
    Return BitAND(GUICtrlRead($idControlID), $GUI_CHECKED) = $GUI_CHECKED
EndFunc


Func _Autostart()

Local $a = 1

While $a > 0

    If IniRead($Inifile,"PROFILE",$a,"") <> "" Then
        Run(@ComSpec & " /c " & $ExtraOutlook & " " & '"' &  $Outlook & '"' & " " & "/profile " & IniRead($Inifile,"PROFILE",$a,""), "", @SW_HIDE)
        Sleep (15000)
        ;Msgbox(0,"",IniRead($Inifile,"PROFILE",$a,""),3)
        Send("{DOWN}")
        Send("{DOWN}")
        Send(IniRead($Inifile,"USER",$a,""))
        Send("{TAB}")
        Send(IniRead($Inifile,"PASS",$a,""),1)
        Send("{TAB}")
        Send("{TAB}")
        Send("{ENTER}")
        Sleep (25000) ;

        $a = $a +1
    Else
        Exit
    EndIf

WEnd

EndFunc

Func _AutoClose()
    $a = 1

    Do
        If ProcessExists($Process) Then
            ProcessClose($Process)
        Else
            Exit
        EndIf

        Sleep(1000)

    $a = $a +1

    Until $a = 64

EndFunc

;************************************************************

相关内容