[wtr-general] how ruby interacts with already opened powerpoint

2010-04-15 Thread arihan sinha
Hi,

In my application I've changed the setting so that the powerpoint would be
opened without file download prompt.

Now I need to focus on that already opened powerpoint and do some testing
through ruby.( say  count the no of slides)

earlier i was saving the powerpoint ( clicking the save button from that
file download prompt) and opening the same ppt as

 ppt = WIN32OLE.new('PowerPoint.Application')

ppt.Visible = true

   * **doc = ppt.Presentations.Open('C:\Documents and Settings\sinhaa\My
Documents\JHEPAT_2010_VOL51_PG845.ppt')*

slidecount = doc.Slides.Count
puts slidecount

but the problem happend that when the remote system ( build server) is
locked or minimised then it stuck in the file download prompt because it was
not sending the key stroke.

So after setting changed the ppt already opened so  i should be able to
directly count the slides on that ppt by focusing or activating the same
ppt.
i tried with below code but it seems not working. any thoughts???

$ie.goto(
http://www.thelancet.com/journals/lancet/article/PIIS0140-6736%2810%2960523-5/fulltext
)
 $ie.link(:text, Download to PowerPoint).click

###The ppt gets opened automatically as a separate ppt file without file
download prompt because settings changed.
ppt = WIN32OLE.new('PowerPoint.Application')

 ppt.Visible = true

 slidecount = * ppt.Presentations*.Slides.Count

puts slidecount

Regards

Arihan

-- 
Before posting, please read http://watir.com/support. In short: search before 
you ask, be nice.

You received this message because you are subscribed to 
http://groups.google.com/group/watir-general
To post: watir-general@googlegroups.com

To unsubscribe, reply using remove me as the subject.


Re: [wtr-general] how ruby interacts with already opened powerpoint

2010-04-15 Thread Ethan
This group is about Watir, not WIN32OLE. I would look for microsoft's
documentation on what powerpoint exposes for OLE automation.
You will probably have to iterate over open applications to detect the
existing powerpoint window. You might look at the source of Watir::IE.each
(ie-class.rb, line 236) for an example of iterating over application
windows, though that is of course for IE windows and not powerpoint, and
you'd have to adapt it heavily to get what you need out of it.


On Thu, Apr 15, 2010 at 09:59, arihan sinha arihan.si...@googlemail.comwrote:

 Hi,

 In my application I've changed the setting so that the powerpoint would be
 opened without file download prompt.

 Now I need to focus on that already opened powerpoint and do some testing
 through ruby.( say  count the no of slides)

 earlier i was saving the powerpoint ( clicking the save button from that
 file download prompt) and opening the same ppt as

  ppt = WIN32OLE.new('PowerPoint.Application')

 ppt.Visible = true

* **doc = ppt.Presentations.Open('C:\Documents and
 Settings\sinhaa\My Documents\JHEPAT_2010_VOL51_PG845.ppt')*

 slidecount = doc.Slides.Count
 puts slidecount

 but the problem happend that when the remote system ( build server) is
 locked or minimised then it stuck in the file download prompt because it was
 not sending the key stroke.

 So after setting changed the ppt already opened so  i should be able to
 directly count the slides on that ppt by focusing or activating the same
 ppt.
 i tried with below code but it seems not working. any thoughts???

 $ie.goto(
 http://www.thelancet.com/journals/lancet/article/PIIS0140-6736%2810%2960523-5/fulltext
 )
  $ie.link(:text, Download to PowerPoint).click

 ###The ppt gets opened automatically as a separate ppt file without file
 download prompt because settings changed.
 ppt = WIN32OLE.new('PowerPoint.Application')

  ppt.Visible = true

  slidecount = * ppt.Presentations*.Slides.Count

 puts slidecount

 Regards

 Arihan

 --
 Before posting, please read http://watir.com/support. In short: search
 before you ask, be nice.

 You received this message because you are subscribed to
 http://groups.google.com/group/watir-general
 To post: watir-general@googlegroups.com


-- 
Before posting, please read http://watir.com/support. In short: search before 
you ask, be nice.

You received this message because you are subscribed to 
http://groups.google.com/group/watir-general
To post: watir-general@googlegroups.com

To unsubscribe, reply using remove me as the subject.