[wtr-general] Re: Outlook recommendations
If you are expecting a link in the message you can use regex to parse the url and then Watir to open it in a browser. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Watir General" group. To post to this group, send email to watir-general@googlegroups.com Before posting, please read the following guidelines: http://wiki.openqa.org/display/WTR/Support To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/watir-general -~--~~~~--~~--~--~---
[wtr-general] Re: Outlook recommendations
Does anyone know how to click link from message? --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Watir General" group. To post to this group, send email to watir-general@googlegroups.com Before posting, please read the following guidelines: http://wiki.openqa.org/display/WTR/Support To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/watir-general -~--~~~~--~~--~--~---
[wtr-general] Re: Outlook recommendations
I started down the path of automating Outlook via com but ran into issues with security pop ups that discourage scripting. I was able to script past the pop ups (sometimes) but the behavior of the pop ups were not consistent. I've given up on this since then. Here's the code I had written in case someone is interested in breaking the security features. #http://snippets.dzone.com/posts/show/4232 require 'breakpoint' require 'win32ole' class Outlook DELETE_ITEMS = 3 OUTBOX = 4 SENT_MAIL= 5 INBOX= 6 CALENDAR = 9 CONTACTS = 10 JOURNAL = 11 def initialize() @outlook = WIN32OLE.new('Outlook.Application') @mapi = @outlook.GetNameSpace('MAPI') @dir = File.expand_path(__FILE__) @dir = @dir[0 .. @dir.rindex('/')-1] end def send(to, subject, body, attachment_path=nil) system("start ruby.exe [EMAIL PROTECTED]/email_security.rb send") message = @outlook.CreateItem(0) message.Subject = subject message.Body = body message.To = to message.Attachments.Add(attachment_path, 1) if attachment_path begin message.Send() rescue Exception => e puts "Send threw an exception" end end def get_unread(folder='Inbox') array = [] get_folder(folder).Items.each do |message| array << message end return array end def get_unread_count(folder='Inbox') return get_folder.UnreadItemCount end def get_folder(folder='Inbox') ofolder = @mapi.GetDefaultFolder(INBOX) ofolder = @mapi.GetDefaultFolder(INBOX).Folders.Item(folder) if folder!='Inbox' #folder = @mapi.Folders.Item('Archive Folders').Folders.Item('Inbox') return ofolder end # gets a message from a folder # - how to get the message [:from, :subject, :Body, :Attachments] # - what to use for searching (examples, Peter Chau, RE: Test email) def get_message(how, what, folder='Inbox') system("start ruby.exe [EMAIL PROTECTED]/email_security.rb read") get_folder(folder).Items.each do |message| begin case how# [receivedByName, senderName, .to] when :body (return message if message.body =~ what) if what.is_a?(Regexp) (return message if message.body == what) if what.is_a?(String) when :subject (return message if message.subject =~ what) if what.is_a?(Regexp) (return message if message.subject == what) if what.is_a?(String) when :senderName (return message if message.senderName =~ what) if what.is_a?(Regexp) (return message if message.senderName == what) if what.is_a?(String) end rescue Exception => e end end puts "did not find email with #{how} = '#{what}'" return nil end end --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Watir General" group. To post to this group, send email to watir-general@googlegroups.com Before posting, please read the following guidelines: http://wiki.openqa.org/display/WTR/Support To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/watir-general -~--~~~~--~~--~--~---
[wtr-general] Re: Outlook recommendations
Hi Moochie, On 15/10/2008, Moochie <[EMAIL PROTECTED]> wrote: > > I've got to automate a test script that opens outlook and emails a > message to our application. Then I verify the email appears within > the application. > > Has anyone done any scripting agains outlook? > > Does anyone have any ideas where I shouls start? > I automate Outlook through COM. Here is an example def verify_an_email_has_been_sent(subject_text) sleep 10 outlook = WIN32OLE.new('Outlook.Application') name_space = outlook.GetNameSpace("MAPI") inbox_folder = name_space.GetDefaultFolder(6) del_folder = name_space.GetDefaultFolder(3) message = nil inbox_folder.Items.each do |i| if (i.subject == subject_text ) if !message.nil? raise "found more than one message" end message = i end end if message.nil? raise "The message was not found" else # delete the message message.Move(del_folder) end Aidy --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Watir General" group. To post to this group, send email to watir-general@googlegroups.com Before posting, please read the following guidelines: http://wiki.openqa.org/display/WTR/Support To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/watir-general -~--~~~~--~~--~--~---
[wtr-general] Re: Outlook recommendations
On Wed, Oct 15, 2008 at 3:55 PM, Jason Trebilcock < [EMAIL PROTECTED]> wrote: > To that end, consider using a run-of-the-mill Ruby script to do it. If you decide not to automate outlook but to send mails from ruby, I would recommend tmail (I use it for that purpose). http://tmail.rubyforge.org/ Željko -- http://watirpodcast.com/bret-pettichord-on-firewatir/ --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Watir General" group. To post to this group, send email to watir-general@googlegroups.com Before posting, please read the following guidelines: http://wiki.openqa.org/display/WTR/Support To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/watir-general -~--~~~~--~~--~--~---
[wtr-general] Re: Outlook recommendations
This will definitely help me get started. Thanks, Darin From: watir-general@googlegroups.com [mailto:[EMAIL PROTECTED] On Behalf Of Lesha Tyschenko Sent: Wednesday, October 15, 2008 8:59 AM To: watir-general@googlegroups.com Subject: [wtr-general] Re: Outlook recommendations You can check out this articles http://rubyonwindows.blogspot.com/search/label/outlook --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Watir General" group. To post to this group, send email to watir-general@googlegroups.com Before posting, please read the following guidelines: http://wiki.openqa.org/display/WTR/Support To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/watir-general -~--~~~~--~~--~--~---
[wtr-general] Re: Outlook recommendations
You can check out this articles http://rubyonwindows.blogspot.com/search/label/outlook --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Watir General" group. To post to this group, send email to watir-general@googlegroups.com Before posting, please read the following guidelines: http://wiki.openqa.org/display/WTR/Support To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/watir-general -~--~~~~--~~--~--~---
[wtr-general] Re: Outlook recommendations
I was going to reply directly...but I'll do it here instead. Rather than worry about automating Outlook, consider what your real goal is – to send an email. To that end, consider using a run-of-the-mill Ruby script to do it. Something like the following: http://www.example-code.com/ruby/ruby-send-email.asp I do the same with Perl when I need to do something similar. Though, I don't worry so much about the validation of the email. On Wed, Oct 15, 2008 at 8:38 AM, Moochie <[EMAIL PROTECTED]>wrote: > > I've got to automate a test script that opens outlook and emails a > message to our application. Then I verify the email appears within > the application. > > Has anyone done any scripting agains outlook? > > Does anyone have any ideas where I shouls start? > > Thanks, > > DD > > > --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Watir General" group. To post to this group, send email to watir-general@googlegroups.com Before posting, please read the following guidelines: http://wiki.openqa.org/display/WTR/Support To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/watir-general -~--~~~~--~~--~--~---