Page 1 of 2 12>
Topic Options
#50019 - 2000-05-24 04:00 PM OLE in KiX
cj Offline
MM club member
*****

Registered: 2000-04-06
Posts: 1102
Loc: Brisbane, Australia
Ok, I am interested in OLE programming examples in KIX. To start the ball rolling, here is one that I found on this board.

code:

$word = olecreateobject ("word.application")
if $word=0
? "Failed to create object" ?
else
? "Object created. Handle= $word" ?
endif


$rs = oleputproperty ( $word, "visible", "b", "1" )


$docs = val("&"+olegetproperty ( $word, "documents" ))
$page = val("&"+olecallfunc ( $docs, "add" ))
$range = val("&"+olecallfunc ( $page, "range" ))
$rs = olecallfunc ( $range, "insertbefore", "s", "KIX RULES!!!" )


$rs = olereleaseobject($word)


I am interested in creating a form and buttons on that form. I am also interested in activating the File Open dialog box. Does anyone have any list of what objects are available in what DLLs and what properties those objects have?

There must be more usefull things in this OLE malarky than sending text to applications...

cj

Top
#50020 - 2000-05-25 07:07 AM Re: OLE in KiX
Shawn Administrator Offline
Administrator
*****

Registered: 1999-08-13
Posts: 8611
cj:

What have you heard my brother ?

Shawn.

[This message has been edited by Shawn (edited 25 May 2000).]

Top
#50021 - 2000-05-25 07:53 AM Re: OLE in KiX
cj Offline
MM club member
*****

Registered: 2000-04-06
Posts: 1102
Loc: Brisbane, Australia
This is taken from The Brain Buzz board:

Hi there,

I'm afraid the syntax you are attempting to use is not yet supported. It is scheduled for the next major update of KiXtart.

You can actually achieve the same results, but it will require you to use the OLEPutProperty function. An example of this is included in the latest zip. NB: these functions are ugly and clumsy to use, and this is exactly why I'm working on improving this right now.

Kind regards,

Ruud

creutz wrote:
>attn Ruud
>please could you look at my problem
>as I dont seem to get kix ole's right
>
>
>creutz wrote:
>>there seems to be a lot of questions about kix ole functions
>>and the only answer seems to be "try activex syntax", well
>>i have tried and got a lot of errors, so please
>>
>>can anybody translate this easy vbscript
>>to kix script, as I dont seem to get the
>>OLECALLFUNC/OLECALLPROC lines right
>>thank you
>>
>>set cd = createobject("MSComDlg.CommonDialog")
>>
>>cd.Filter = "All Files(*.*)|*.*"
>>cd.FilterIndex = 3
>>cd.MaxFileSize = 128
>>cd.ShowOpen()
>>
>>
Ruud van Velsen


cj

Top
#50022 - 2000-05-25 09:58 AM Re: OLE in KiX
Shawn Administrator Offline
Administrator
*****

Registered: 1999-08-13
Posts: 8611
cj:

ALL RIGHT !!!

If Ruud makes these improvements - get ready for a wild KiX ride !!!

This still leaves the question about what automation objects are available and usefull in a KiX script.

One of the ways I look for usefull objects is to start Visual Basic and create an empty project. Then from the "references" menu, add in interesting looking components. Then use the "object browser" to look at the implemented methods and properties. VB is also a create tool for prototyping your script. Get it to work in VB first - then write your KiX script !

I personally use C++ for building components. VB is nice but even a minimal (one method) automation object would build- up into a huge installation package. C++ components are tiny and ship in just one DLL !!!

In terms of KiX - be carefull - automation supports a wide array of variable types (roughly 38 of them and generically called "variants" ). Kix only supports 9 of them. You might also find that alot of the components require that you pass array arguments ( which KiX doesn't support (yet) ).

Even if Rudd does imbed automation support into the KiX language itself, I think there will still be a place for building a "useful" "KiXfriendly" snapin.

This is the sample driver script that I am using right now ...

code:

break on


$klib = olecreateobject ( "KiXtart.Library" )


if olecallfunc ( $klib, "GetTotalPhysicalMemory" ) > 64000000

?"All right my brother!"

else

?"Sorry to hear that"

endif

exit


Right now ( as we speak) and am coding the "return value" part of the GetTotalPhysicalMemory method - then I'll be done with the component infrastructure. From there it's easy stretch to build up functionality by adding new methods to new and wonderful Windows API's ...

Why am I doing all this ?

At the end of the day - I want to be able to include a Windows progress (status) bar in some KiX scripted installation packages that I have. Thought it would be a nice touch.

Has anybody been able to implement one with pure KiX OLE functions ? I think the problem is that the Progress Bar is a "control" and is meant to be run in the context of a pure "Windows" application. It think KiX is what they call a "Win32 Console Application" !


Shawn.

[This message has been edited by Shawn (edited 25 May 2000).]

Top
#50023 - 2000-05-25 10:56 AM Re: OLE in KiX
Bryce Offline
KiX Supporter
*****

Registered: 2000-02-29
Posts: 3167
Loc: Houston TX
Ok this sounds exciting! Don't know what i could use it for but i am sure that i could find something

Bryce

Top
#50024 - 2000-05-25 11:12 AM Re: OLE in KiX
Shawn Administrator Offline
Administrator
*****

Registered: 1999-08-13
Posts: 8611
Bryce:

Wanna try it out ?

I'll mail it to you right now if you want !

I promise that's there no worms or trojans in it !

Shawn.

Top
#50025 - 2000-05-25 01:22 PM Re: OLE in KiX
Bryce Offline
KiX Supporter
*****

Registered: 2000-02-29
Posts: 3167
Loc: Houston TX
Sure i will give it a shot.

Bryce

Top
#50026 - 2000-05-25 01:36 PM Re: OLE in KiX
Shawn Administrator Offline
Administrator
*****

Registered: 1999-08-13
Posts: 8611
COM on baby light my fire ...

Try to set the night on fire !

ok - I'll stop now !

Shawn.

Top
#50027 - 2000-05-25 01:56 PM Re: OLE in KiX
Bryce Offline
KiX Supporter
*****

Registered: 2000-02-29
Posts: 3167
Loc: Houston TX
well it looked like it worked.... I got the following.


code:

Right on my brother, thanks for trying ...

KiXtart Library Extentions (Version 0.1)

Feedback: http://www.kixtart.to/script/board/

Total available physical memory = 200859648

Hit any key to continue ...


Bryce

Top
#50028 - 2000-05-25 02:18 PM Re: OLE in KiX
Shawn Administrator Offline
Administrator
*****

Registered: 1999-08-13
Posts: 8611
Bryce:

Thanks Bryce for giving it a try.

Nice to see that it works on someone else's machine. Better than that VB crap eh ?

VB would have polluted your machine with dll's and type libraries and all kinds of junk.

The one thing I haven't tested yet is whether a ordinary user has "priviledge" to register the KixLib32.dll ??? All COM components ( ALL OF THEM ) register themselves in HKCR under CLSID, APPID, and under their component name. Check it out !

KixLib32 will "unregister" itself from your machine by saying ...

regsvr32 /u kixlib32

Clean huh ?

As I said before - I'm currently working on getting the return values from OLE working. Will keep you posted. Then I can use KiX OLE functions in a more "natural" code flow like in the script above ^

Thanks again !

Shawn.

p.s.

Did you notice the version number ?

And nice memory config you got there !

Shawn..

[This message has been edited by Shawn (edited 25 May 2000).]

Top
#50029 - 2000-05-25 03:18 PM Re: OLE in KiX
Anonymous
Unregistered


it is not so deficult I think to make mem calculations or progress bars with "common" kix commands.
Top
#50030 - 2000-05-25 03:43 PM Re: OLE in KiX
Bryce Offline
KiX Supporter
*****

Registered: 2000-02-29
Posts: 3167
Loc: Houston TX
Saw the total memory thing, and i was wondering about that.....

Everything that tells me total memory is saying 196,152k. with current mem in use being arround 115meg.

Bryce


Top
#50031 - 2000-05-26 09:53 AM Re: OLE in KiX
Shawn Administrator Offline
Administrator
*****

Registered: 1999-08-13
Posts: 8611
Bryce:

It's just a rounding thingy ...

Most other tools report memory in kbytes. We can get a little more accuracy than that with Kix ...

Take 200,859,648 / 1,024 = 196,152 kb

Novastar:

I agree !

Gang:

<rant on>

[Oh god - here he goes again ! Skip to <rant off> if not interested]

I think one could go so far as to say that "anything can be done by everything" ( or vice-versa - I don't know)

Having lived by that rule though - we'd probably still be writting logon scripts with .bat files and Rudd would never have blessed us with this wonderful tool we call "KiXtart".

Let's put it this way - Rudd is (supposedly) going to integrate Automation into KiXtart ( at the raw "language" level - and not just through function calls). Calling it "Object Oriented KiX" would probably be a stretch but I think this is vital because Perl and wsh already support it and unless one wants to be left in the dust (like a fossil), one has to let evolution take it's course.

However, adding Automation (in and by itself) doesn't really mean very much. Automation is just a vehicle (a transport)that allows one to talk to Automation Servers (like Microsoft Word, Excel and PowerPoint). Unless one has something worth automating (KiX-worthy), one has to be content with writing scripts that build nice PowerPoint presentations (over and over again). It's like getting the keys to a brand new car and then not having anywhere to go (doh!)

I imagine that Rudd gave us the OLE functions ( way back in version 3.46) for a reason. OLE's sole purpose is to allow programs and scripts to talk with one another. It allows developers/scripters to quickly buildup functionality by "snapping togther" components from many different vendors.

But it's up to us as "KiXters" to decide whats possible and whats needed. Then having made these determinations - to develop the servers (components) that implement the possibilties !

If one looks far down the road - say version 5 or 6 of KiXtart - one might invision a "DOS-free" logon process that runs in a pure Windows context - complete with dialogue boxes, progress bars and tight integration with things like Active Directory, Internet Explorer, ODBC/SQL and other "Automationable" objects !

I don't know about you, but I feel like I've written my last "net use" and "if ingroup()" for my liking !

<rant off>

Sorry if I'm rambling on here guys ! Does anyone have any thoughts/feelings or differences of opinions about the KiX OLE functions ? I mean - that's why we have this board - is it not ?

Shawn.

[This message has been edited by Shawn (edited 26 May 2000).]

Top
#50032 - 2000-05-26 10:17 AM Re: OLE in KiX
Bryce Offline
KiX Supporter
*****

Registered: 2000-02-29
Posts: 3167
Loc: Houston TX
Just that fact that you will be able to use a graphic interface, is enough for me.

Right now the majority of kix scripts are going to be logon scripts/admin scripts. very few people are writing scripts for the end users ( well i am but I'm weird like that ).

I think OLE in kix is just the next step.

Bryce


Top
#50033 - 2000-05-26 11:06 AM Re: OLE in KiX
Shawn Administrator Offline
Administrator
*****

Registered: 1999-08-13
Posts: 8611
Gang:

If that doesn't convince you, maybe this will...

code:

break on


$cd = olecreateobject("MSComDlg.CommonDialog")


$rs = oleputproperty ( $cd, "Filter", "s", "All Files(*.*)|*.*" )
$rs = oleputproperty ( $cd, "FilterIndex", "s", "3")
$rs = oleputproperty ( $cd, "MaxFileSize", "s", "128")


$rs = olecallfunc ( $cd, "ShowOpen" )


exit



Shawn.

[This message has been edited by Shawn (edited 26 May 2000).]

Top
#50034 - 2000-05-27 12:13 AM Re: OLE in KiX
Shawn Administrator Offline
Administrator
*****

Registered: 1999-08-13
Posts: 8611
Gang:

Damn those Visual Basic runtimes. In order to use this one needs the common dialogue components ( comes with the VB runtimes I think ) ... working ....

If you have the following key in your registry ...

HKEY_CLASSES_ROOT\MSComDlg.CommonDialog

Then you can use these features...

Shawn.

[This message has been edited by Shawn (edited 26 May 2000).]

Top
#50035 - 2000-05-27 12:59 AM Re: OLE in KiX
Shawn Administrator Offline
Administrator
*****

Registered: 1999-08-13
Posts: 8611
Friends:

Has anybody been able to get this puppy to run on their workstation ?

Shawn.

p.s. Works great on my workstation. Must be some kind of Microsoft conspiracy ! I'll keep working on it though !

Shawn..

[This message has been edited by Shawn (edited 26 May 2000).]

Top
#50036 - 2000-05-26 01:58 PM Re: OLE in KiX
Bryce Offline
KiX Supporter
*****

Registered: 2000-02-29
Posts: 3167
Loc: Houston TX
Nope, don't have MSComDlg.CommonDialog, sorry.

Bryce

Top
#50037 - 2000-05-26 05:32 PM Re: OLE in KiX
Anonymous
Unregistered


shawn :

You are right and wrong at the same time. If you want all these gui goodies why don't use visual basic ? For me kixtart should be a non interactive string and command interpreter. What I want is more string processing functions and file read/write capabilities. I want also to take stdout and pass it directly to variables and arrays.

The scripts are easily editing pieces of text that everyone can make corrections changes and fit ot its needs. I also want some more macros and some winsock functions to create start and stop tcp servers !

There are cases would need much more time and effort to write a visual basic or c++ program in order to do the same things with a clever and small kix or perl script.

PS. whats wrong with dos ?! I am still using it and love it! Many times windows problems can be corrected only from dos mode. By the way I also preffer the old dos games and coin up emulators than windows 3d bloody craps : )

[This message has been edited by novastar (edited 26 May 2000).]

Top
#50038 - 2000-05-30 11:55 AM Re: OLE in KiX
Shawn Administrator Offline
Administrator
*****

Registered: 1999-08-13
Posts: 8611
Novastar:

Don't get me wrong - I agree with you mostly !

I don't want the GUI goodies either. When I'm developing an end-user application, KiXtart is my last choice.

I wish VB was my last choice too - but it's just so damn nice to develop with VB. But those friggin runtimes ! Arrrgh !!!

What I am after is the Windows NT internal stuff (the API's) that would be so nice to get at from within KiX. Imagine if one could roll all those ResKit and DOS commands into a single KiX library DLL ! A common interface and a common way of returning values to one's script !

No more would we have to shell-out to a program, pipe the output to file - then read (parse) it back in. What a Kludge !

Here's the driver for the current incarnation of the library ...

code:

break on

;--------------------------------------------------------
; Create the kixtart.library object ...
;--------------------------------------------------------


$lib = olecreateobject ( "kixtart.library" )


if $lib = 0
?"Error creating kixtart.library"
exit
endif


;--------------------------------------------------------
; Get the current millisecond counter from Windows NT ...
;--------------------------------------------------------


$start = val(olecallfunc ( $lib, "GetTickCount" ))


;--------------------------------------------------------
; Set the console window title to something else ...
;--------------------------------------------------------


olecallfunc ( $lib, "SetConsoleTitle", "s", "Kixtart.Library Driver Script" )


;--------------------------------------------------------
; Check if console cursor is currently visible ...
;--------------------------------------------------------


if olecallfunc ( $lib, "GetCursorVisible" )


;--------------------------------------------------------
; Make console cursor invisible ...
;--------------------------------------------------------


olecallfunc ( $lib, "SetCursorVisible", "i", "0" )


? ?"Enter an invisible cursor string > " gets $c


;--------------------------------------------------------
; Set console cursor back to visible ...
;--------------------------------------------------------


olecallfunc ( $lib, "SetCursorVisible", "i", "1" )


endif


;--------------------------------------------------------
; Get the current millisecond counter from Windows NT ...
;--------------------------------------------------------


$end = val(olecallfunc ( $lib, "GetTickCount" ))


;--------------------------------------------------------
; Display elapsed milliseconds (runtime) for script ...
;--------------------------------------------------------


? ?"Elapsed milliseconds = " $end - $start


;--------------------------------------------------------
; Release the kixtart.library object
;--------------------------------------------------------


$rs = olereleaseobject ( $lib )


exit



I use this tool just for the GetTickCount function when benchmarking my scripts to see how long certain kix commands (ingroup) and programs (shells) take to execute !

Anyway - I don't know if this kind of library has any general use within the KiX community or not ! Might make an interesting debugging tool though !

Shawn.

[This message has been edited by Shawn (edited 30 May 2000).]

Top
Page 1 of 2 12>


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

Who's Online
1 registered (Allen) and 1198 anonymous users online.
Newest Members
M_Moore, BeeEm, min_seow, Audio, Hoschi
17883 Registered Users

Generated in 0.073 seconds in which 0.027 seconds were spent on a total of 13 queries. Zlib compression enabled.

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