Win32OLE help

Can someone point me to some more information on using Win32OLE. I
have looked for several hours and can’t seem to find what should be
an obvious answer. I should mention that I have never used OLE
before.

What I want to do is launch InternetExplorer in such a way that it
will open the same window if called more than once and the command is
a Post command.

it is very easy to do a GET in a new IE window such as the following:

require 'win32ole’
ie = WIN32OLE.new(‘InternetExplorer.Application’)
ie.visible = true
ie.navigate(‘http://url?field=data&field2=data2’)

The OLE docs state that navigate will take optional parameters that
are of type VARIANT. One is used to name the window, another is used
to set the Post Data. The problem is I just do not know how to set
them. It seems so trivial, and yet I am just missing something.

Any insight into this would be greatly appreciated.

Thanks in advance,

Walt

···

Walter Szewelanczyk
IS Director
M.W. Sewall & CO. email : walter@mwsewall.com
259 Front St. Phone : (207) 442-7994 x 128
Bath, ME 04530 Fax : (207) 443-6284


In article 3EA01D2E.7412.18CD4BB@localhost, walter@mwsewall.com
says…

Can someone point me to some more information on using Win32OLE. I
have looked for several hours and can’t seem to find what should be
an obvious answer. I should mention that I have never used OLE
before.

What I want to do is launch InternetExplorer in such a way that it
will open the same window if called more than once and the command is
a Post command.

it is very easy to do a GET in a new IE window such as the following:

require ‘win32ole’
ie = WIN32OLE.new(‘InternetExplorer.Application’)
ie.visible = true
ie.navigate(‘http://url?field=data&field2=data2’)

The OLE docs state that navigate will take optional parameters that
are of type VARIANT. One is used to name the window, another is used
to set the Post Data. The problem is I just do not know how to set
them. It seems so trivial, and yet I am just missing something.

Any insight into this would be greatly appreciated.

Thanks in advance,

Walt


Walter Szewelanczyk
IS Director
M.W. Sewall & CO. email : walter@mwsewall.com
259 Front St. Phone : (207) 442-7994 x 128
Bath, ME 04530 Fax : (207) 443-6284


======================================================================

Hi. Her is th Ms Website describing the post method. I
I have done this in Vb but not Ruby.
Here is th MS website describing the use of Post.
Microsoft Support

Here is some VB code if it helps a bit:

inUrl as String = “http://www.zargon12.com
inFlags As Long = 0
inTargetFrame As String = “”
inPostData As Variant = “Start=0&Count=None&State=No&City=Detroit”
inHeaders as String = “Content-Type: application/x-www-form-
urlencoded” & vbCrLf

x.navigate inUrl, inFlags, inTargetFrame, BuildPostData(inPostData),
inHeaders

Private Function BuildPostData(ByVal inPostData As String) As Byte()
BuildPostData = StrConv(inPostData, vbFromUnicode)
End Function

There is a Unicode concern as well in VB.

Hope this helps some
Murray

···

========================================================================

In article 3EA01D2E.7412.18CD4BB@localhost, walter@mwsewall.com
says…

···

Can someone point me to some more information on using Win32OLE. I
have looked for several hours and can’t seem to find what should be
an obvious answer. I should mention that I have never used OLE
before.

What I want to do is launch InternetExplorer in such a way that it
will open the same window if called more than once and the command is
a Post command.

it is very easy to do a GET in a new IE window such as the following:

require ‘win32ole’
ie = WIN32OLE.new(‘InternetExplorer.Application’)
ie.visible = true
ie.navigate(‘http://url?field=data&field2=data2’)

The OLE docs state that navigate will take optional parameters that
are of type VARIANT. One is used to name the window, another is used
to set the Post Data. The problem is I just do not know how to set
them. It seems so trivial, and yet I am just missing something.

Any insight into this would be greatly appreciated.

Thanks in advance,

Walt


Walter Szewelanczyk
IS Director
M.W. Sewall & CO. email : walter@mwsewall.com
259 Front St. Phone : (207) 442-7994 x 128
Bath, ME 04530 Fax : (207) 443-6284


===================================================================
THIS SAMPLE DOES NOT WORK BUT IT Should BE CLOSE.
As I am a Ruby newbie this is the best I can do.
This wworks in VB. Murray

Postdata sample

require ‘win32ole’
heading = “Content-Type: application/x-www-form-urlencoded\n”
url = “http://www.tyzo.com/cgi-bin/hotels.cgi
postData = “Start=0&Count=None&City=&Country=No&State=”
postData += ‘Hawaii’
frame = “”
zero = 0
puts postData
puts heading
puts url

ie = WIN32OLE.new(‘InternetExplorer.Application’)
ie.visible = true
ie.toolbar = false
ie.statusbar = false
ie.navigate(url,zero,frame,postData,heading)