On Mon, 05 Aug 2002 20:59:16 GMT, Chris Gehlker <gehlker / fastq.com>
wrote:

>2) How does the scripter know what capabilities the target application has
>under Windows? The example on page 168 of the PickAxe Book assumes a lot of
>knowledge on the part of the scripter about Excel's internal objects. Mac
>Excel has an object browser so it's easy to see what objects are inside
>Excel and to discover their methods. Does the same thing apply on Windows? I
>don't have Win Excel but I do have IE and it's supposedly scriptable. I just
>can't discover the vocabulary to script it.

~/data/rb/ole$ cat methods.rb

require 'win32ole'
object = WIN32OLE.new(ARGV[0])
puts object.ole_methods.sort

~/data/rb/ole$ ruby methods.rb InternetExplorer.Application

AddRef()
AddressBar
AddressBar=
Application
Busy
ClientToWindow()
Container
Document
ExecWB()
FullName
FullScreen
..
..
..

---

Unfortunately you don't get the expected number or types for the
arguments, its best to jump into a MS IDE to see what they do (or
search for code fragments on the web).

---

Here's an extract from a script which downloads stockmarket data from
a brokers site. (Unfortunately they charge for this now, so I don't
use it). Should help in getting you started.


ie = WIN32OLE.new('InternetExplorer.Application')
ie.visible = true
		
ie.navigate "https://www.sanford.com.au/sanford/Public/Home/Login.asp"

sleep 1 while ie.Busy == true
		
document = ie.Document
		
sleep 1 while ie.Busy == true

document.loginform.username.value="username"
document.loginform.password.value="password"
document.loginform.submit()


@startDate.upto(@endDate) { |date|

  sleep 1 while ie.Busy == true

  ie.navigate
"http://www.sanford.com.au/sanford/Members/Research/HistoricalData.asp"
..
..
..