$message = "Hold down Ctrl or Shift to choose multiple files."
$PstFilePath = "C:Mail"
$var = FileOpenDialog($message,$PstFilePath, "Images (*.pst)", 1 + 4 )
If @error Then
MsgBox(4096,"","No File(s) chosen")
Exit
Else
$var = StringReplace($var, "|", @CRLF)
MsgBox(4096,"","You chose " & $var)
EndIf
$mountpst=ControlCommand("郵件","","ListBox1","GetCurrentSelection","")
WinActivate("郵件","")
ControlFocus("郵件","下列設定檔建立在這個機器上","ListBox1")
send($mountpst)
sleep(500)
ControlClick("郵件","內容","Button3")
WinWait("郵件設定","電子郵件帳號")
WinActivate("郵件設定","電子郵件帳號")
ControlClick("郵件設定","資料檔","Button3")
While 1
;$PstFile = FileFindNextFile($searchPstFile)
$PstFile = FileFindNextFile($var)
msgbox(0,"",$PstFilePath&""&$PstFile)
;If @error Then ExitLoop
WinWait("Outlook 資料檔案","選取清單中的資料檔案")
WinActivate("Outlook 資料檔案","選取清單中的資料檔案")
ControlClick("Outlook 資料檔案","新增","Button4")
WinWait("新的 Outlook 資料檔","儲存類型")
WinActivate("新的 Outlook 資料檔","儲存類型")
ControlClick("新的 Outlook 資料檔","確定","Button1")
WinWait("建立或開啟 Outlook 資料檔","")
WinActivate("建立或開啟 Outlook 資料檔","")
ControlSetText("建立或開啟 Outlook 資料檔", "","RichEdit20W2", $PstFilePath&""&$PstFile)
sleep(300)
send("{ENTER}")
WinWait("個人資料夾","")
WinActivate("個人資料夾","")
ControlClick("個人資料夾","確定","Button3")
WEnd
FileClose($var)
WinWait("郵件設定","電子郵件帳號")
WinActivate("郵件設定","電子郵件帳號")
ControlClick("郵件設定","關閉","Button4")
Exit