PCrane Posted March 14, 2008 Share Posted March 14, 2008 I am trying to put together a script to speed up my email sending process. I have come up with a little code that that i need some help with. Outlook opens another outlook even though outlook is already running. How can i get it to only use the current outlook that is already opened? Also, i would like to have a few boxes to popup. Like one for enter email address and ok and that places that information into the TO section. One for the CC and one for the Subject section? I am new to this. Please help me with this. ; Script Start - Add your code below here $g_szVersion = "Automated Email Send" If WinExists($g_szVersion) Then Exit; It's already running AutoItWinSetTitle($g_szVersion) Run("C:\Program Files\Microsoft Office\OFFICE11\outlook.exe") WinWaitActive("Inbox - Microsoft Outlook") Send("^n") WinWaitActive("Untitled - Message (Plain Text)") Send("email address") Send("{TAB 3}") Send("This is a test email") Send("{TAB}") Send("Hows it going? This is my script email!") Link to comment Share on other sites More sharing options...
Aassdd Posted March 14, 2008 Share Posted March 14, 2008 What's the use of this? $g_szVersion = "Automated Email Send" If WinExists($g_szVersion) Then Exit; It's already running AutoItWinSetTitle($g_szVersion) Link to comment Share on other sites More sharing options...
PCrane Posted March 14, 2008 Author Share Posted March 14, 2008 Script i found to make sure no other instance of the script will run at the same time. Link to comment Share on other sites More sharing options...
Aassdd Posted March 14, 2008 Share Posted March 14, 2008 (edited) You can use _Singleton instead. Look it in the help file. EDIT: If Not WinExists("Inbox - Microsoft Outlook") Then Run("C:\Program Files\Microsoft Office\OFFICE11\outlook.exe") Send("^n") WinWaitActive("Untitled - Message (Plain Text)") Send("email address") Send("{TAB 3}") Send("This is a test email") Send("{TAB}") Send("Hows it going? This is my script email!") EDIT: You can use If Not WinExists("Inbox - Microsoft Outlook") Then Run("C:\Program Files\Microsoft Office\OFFICE11\outlook.exe") or If WinExists("Inbox - Microsoft Outlook") = 0 Then Run("C:\Program Files\Microsoft Office\OFFICE11\outlook.exe") It's the same. Edited March 14, 2008 by Aassdd Link to comment Share on other sites More sharing options...
PCrane Posted March 14, 2008 Author Share Posted March 14, 2008 Ok thanks. Any ideas on the inputbox for the TO, CC and subject lines? Link to comment Share on other sites More sharing options...
Aassdd Posted March 14, 2008 Share Posted March 14, 2008 Try pressing alt when you are in the new email window. Or try ControlSend. Link to comment Share on other sites More sharing options...
PCrane Posted March 14, 2008 Author Share Posted March 14, 2008 Ok, what am i missing here, with outlook is already open on my machine, but when running the script it opens another outlook program? If WinExists("Inbox - Microsoft Outlook") = 0 Then Run("C:\Program Files\Microsoft Office\OFFICE11\outlook.exe") Run("C:\Program Files\Microsoft Office\OFFICE11\outlook.exe") WinWaitActive("Inbox - Microsoft Outlook") Send("^n") WinWaitActive("Untitled - Message (Plain Text)") $answer = InputBox("TO:","Enter Email Address") Sleep(200) Send($answer) Send("{TAB}") $answer = InputBox("CC:","Enter Email Address") Sleep(200) Send($answer) Send("{TAB}") $answer = InputBox("BCC:","Enter Email Address") Sleep(200) Send($answer) Send("{TAB}") $answer = InputBox("SUBJECT:","Enter Subject") Sleep(200) Send($answer) Send("{TAB}") Link to comment Share on other sites More sharing options...
madmikep Posted March 31, 2008 Share Posted March 31, 2008 If ProcessExists("Outlook.exe") Then MsgBox(4096,"", "Outlook is running") ; You can enter your code here Else MsgBox(4096,"","Outlook is not running, Now Open Outlook") $Outlook_Path = RegRead("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\App Paths\OUTLOOK.EXE", "") ; Read in the location of Outllook and us the deafult key MsgBox(4096,"",$Outlook_Path) Run($Outlook_Path) ; You can enter your code here EndIf Link to comment Share on other sites More sharing options...
Mini_Scripter Posted April 14, 2008 Share Posted April 14, 2008 If ProcessExists("Outlook.exe") Then MsgBox(4096,"", "Outlook is running") ; You can enter your code here Else MsgBox(4096,"","Outlook is not running, Now Open Outlook") $Outlook_Path = RegRead("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\App Paths\OUTLOOK.EXE", "") ; Read in the location of Outllook and us the deafult key MsgBox(4096,"",$Outlook_Path) Run($Outlook_Path) ; You can enter your code here EndIfWhy is the e-mail adress not coming up?Below is the code am I missing something?WinWaitActive("Inbox - Microsoft Outlook")Sleep(900)Send("+{UP 4}")Sleep(2000)Send("^n")WinWaitActive("Untitled - Message (Plain Text)")Sleep(900)$answer = InputBox("TO...:","Enter Email Address") Link to comment Share on other sites More sharing options...
nhalme Posted May 21, 2008 Share Posted May 21, 2008 I may not have understood your goal correctly, but I would use as simple script that makes the mail and send it like $myOlApp = ObjCreate("Outlook.Application") $myItem = $myOlApp.Application.CreateItem(0) $myItem.Display $myItem.To = "test@email.com" $myItem.Subject = "This is the subject" $myItem.Body = "Hello World!" This would speed up your email sending process and it would not open a new process for the outlook.exe. Link to comment Share on other sites More sharing options...
amokoura Posted May 21, 2008 Share Posted May 21, 2008 Using COM Outlokk will popup a security cuestion. It can be circumvented by Send commands on the security question or using 3rd party component that disables Outlook COM automation blockings. Link to comment Share on other sites More sharing options...
sachmizzle Posted May 21, 2008 Share Posted May 21, 2008 you could use the redemption outlook COM object, http://www.dimastr.com/redemption/Its able to get around the security popup just fine.CODE$olookApp = ObjCreate("Outlook.Application")$oItem = $olookApp.CreateItem(0)$SafeItem.Item = $oItem$SafeItem.Recipients.Add("email@address.com")$SafeItem.Subject = "Testing"$SafeItem.Body = "Body Text Here"$SafeItem.SendIve used it to make a script that checks for new mail, open the message, download attachment, reply to messages, etc 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