Page 1 of 1 1
Topic Options
#85073 - 2002-02-02 05:57 AM COM Scripting Problem
craigk Offline
Fresh Scripter

Registered: 2001-12-06
Posts: 6
Our logon scripts currently open up Internet Explorer going to our company's intranet site. Everything works but in the never ending quest to make things cooler I want to change the loading of IE from the "start http://www.webpage.com" to COM scripting.

I'm having a problem with KiXtart's implementation of COM scripting. I wrote the same code in VBS and in KiXtart but I can't get the KiXtart code to work correctly. In both languages IE pops up and I wanted to turn off any Explorer Bars that might be open. Well no problem, I thought, IE has a COM parameter for that and everything works in VBS but not in KiXtart. You'll see from my scripts that I'm trying to get the Search Explorer Bar to show up.. but once I get that to work then I'll change the value to False.

I'd also like to make IE pop up maximized (not fullscreen mode) but there is no COM parameter for that so any suggestions would be nice.. maybe the .height, .width, .left, and .top parameters but they need to be adjustable for different screen resolutions.

Anyhow here is the KiXtart code:
$ie = createobject("internetexplorer.application")
$ie.navigate("http://www.kixtart.org")
while $ie.busy and not @error loop
$ie.visible = 1

$ie.ShowBrowserBar "{30D02401-6A81-11D0-8274-00C04FD5AE38}", true

$ie = Nothing

And here is the VBS:
set ie = createobject("internetexplorer.application")
ie.navigate("http://www.kixtart.org")
while ie.busy and not err.number
wend
ie.visible = 1

ie.ShowBrowserBar "{30D02401-6A81-11D0-8274-00C04FD5AE38}", true

set ie = Nothing

Any help would be nice.. thanks guys.

craig

Top
#85074 - 2002-02-02 07:02 AM Re: COM Scripting Problem
Shawn Administrator Offline
Administrator
*****

Registered: 1999-08-13
Posts: 8611
craig,

I think you hit on a buggy-boo or at least, a deficiency in the way kixtart handles COM calls in 4.0

Based on my testing of your script, it would appear that the webbrowser object is expecting a VARIANT BOOL passed as the second parameter. Most COM objects will try to coerce the passed value to a required value. For example, the string "1" becomes true as does "this" or 1 is true.

My guess is that kixtart 4.0 passes all numbers as VARIANT INTS or LONGS ... but the webbrowser isn't doing the conversion in this particular method call.

Just as a test, I converted your script to kixtart 3.63 OLE calls, where one can explicitly specify the parameter types. And sure enough, when forced to BOOL (b), the method call works, heres that script. This script determines which version of kixtart is being used and makes the appropriate COM/OLE calls ... try it with 3.63 and it works great:


break on


if (@kix < "4.00")


?"OLD OLE FUNCTIONS:"

$ie= olecreateobject("internetexplorer.application")

$= olecallfunc($ie,"navigate","s","http://www.kixtart.org")

while olegetproperty($ie,"busy") <> "0" and @error = 0 loop

$= oleputproperty($ie,"visible","s","1")

; $= olecallfunc($ie,"showbrowserbar","sb","{EFA24E62-B078-11D0-89E4-00C04FC9E26E}","1")

$= olecallfunc($ie,"showbrowserbar","sb","{30D02401-6A81-11D0-8274-00C04FD5AE38}","1")

?"@ERROR rs=$rs"

$ = olereleaseobject($ie)


else


?"NEW COM FUNCTIONS:"

$ie = createobject("internetexplorer.application")

$ie.navigate("http://www.kixtart.org")

while $ie.busy and not @error loop

$ie.visible = 1

$ie.showbrowserbar("{EFA24E62-B078-11D0-89E4-00C04FC9E26E}","1")

$ie = 0


endif

exit 1

I think you/we should flag this as a potential kixtart 4.0 COM issue .. what you think ?

-Shawn

[ 02 February 2002: Message edited by: Shawn ]

Top
#85075 - 2002-02-02 07:43 AM Re: COM Scripting Problem
Shawn Administrator Offline
Administrator
*****

Registered: 1999-08-13
Posts: 8611
Here's a work-around for you

Before your call to ShowBrowserBar, fetch the value of the WebBrowser "Visible" property, which we know should return as BOOLEAN TRUE ... then turn it around and recycle it as your second parameter to ShowBrowserBar method call ... i couldn't believe this actually worked the first time i tried it too !


break on


$ie = createobject("internetexplorer.application")


$ie.navigate("http://www.kixtart.org")


while $ie.busy and not @error loop


$ie.visible = 1


$true = $ie.visible


$ie.showbrowserbar("{EFA24E62-B078-11D0-89E4-00C04FC9E26E}",$true)


$ie = 0


exit 1

-Shawn

Top
#85076 - 2002-02-02 03:03 PM Re: COM Scripting Problem
Alex.H Offline
Seasoned Scripter

Registered: 2001-04-10
Posts: 406
Loc: France
Shawn,
Maybe it's time to ask Ruud for a @true and @false macros ?
_________________________
? getobject(Kixtart.org.Signature)

Top
#85077 - 2002-02-02 08:37 PM Re: COM Scripting Problem
Shawn Administrator Offline
Administrator
*****

Registered: 1999-08-13
Posts: 8611
alex, great idea !

These macro's would fix this variant_bool thingy plus standardize the value of TRUE ... which could be anything that's nonzero i guess.

-Shawn

Top
#85078 - 2002-02-04 01:09 AM Re: COM Scripting Problem
craigk Offline
Fresh Scripter

Registered: 2001-12-06
Posts: 6
It worked perfectly. Thanks guys!
Top
Page 1 of 1 1


Moderator:  Shawn, ShaneEP, Ruud van Velsen, Arend_, Jochen, Radimus, Glenn Barnas, Allen, Mart 
Hop to:
Shout Box

Who's Online
0 registered and 2312 anonymous users online.
Newest Members
fgarcia, Viginette, ManuvdWielNL, Sir_Barrington, batdk82
17889 Registered Users

Generated in 0.124 seconds in which 0.067 seconds were spent on a total of 12 queries. Zlib compression enabled.

Search the board with:
superb Board Search
or try with google:
Google
Web kixtart.org