Page 2 of 2 <12
Topic Options
#50127 - 2000-06-20 06:21 PM Re: Handling dates
Jochen Administrator Offline
KiX Supporter
*****

Registered: 2000-03-17
Posts: 6380
Loc: Stuttgart, Germany
done

father
[do as i say , not as i do]

_________________________



Top
#50128 - 2000-06-20 06:30 PM Re: Handling dates
Shawn Administrator Offline
Administrator
*****

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

Ok – here’s my un-orthodox approach to handling dates and floating-point math
in KiX

The following script instantiates an instance of Excel, prompts for a formula, plugs it into Excel, then displays the calculated value.

Note: the KiX OleReleaseObject() function doesn't seem to want to release out-of-proc servers (excel.exe). I think word.exe has the same problem. Not sure if this is a KiX OLE thing or an Office OLE thing but can anybody fix ?

Here's some relevant things to try:

Formula: 1+1

Formula: .001 + .00234 (for you math hounds)

Formula: text(datevalue("20-JUN-2000")-14,"dd-mmm-yyyy") (jochen hmmm ?)

Formula: datevalue("20-JUN-2000")-datevalue("03-JUL-1969") (days between)

If anyone has trouble cutting and pasting, please advise.

Anyway - here goes:

code:

break on cls


;------------------------------------------------
; OLE Formula 1 Driver (hehe)
;
; Enter "quit" to quit
;------------------------------------------------


; Create an instance of Excel (excel.exe)


$excel = olecreateobject ( "excel.application" )


if $excel = 0


?"Excel (ole) is not supported on this machine"


exit


endif


; Comment/Uncomment next line for the visuals
; Remember to re-focus back to your DOSBOX if you do


; $rs = oleputproperty ( $excel, "visible", "b", "1" )


; Disable alerts (i.e. don't ask if I want to save my work)


$rs = oleputproperty ( $excel, "displayalerts", "b", "0" )


; Get a handle to the workbooks object


$workbooks = val("&"+olegetproperty ( $excel, "workbooks" ))


; Open a new workbook & sheet


$rs = olecallfunc ( $workbooks, "add" )


; Get a handle to the default active cell (A1)


$cell = val("&"+olegetproperty ( $excel, "activecell" ))


while 1


?
?"Formula : " gets $formula


if $formula = "quit" goto finish endif


$rs = oleputproperty ( $cell, "formula", "s", "=$formula" )


?"Answer : " olegetproperty ( $cell, "value" )


loop


:finish


$rs = olecallfunc ( $excel, "exit" )


$rs = olereleaseobject ( $excel )


?
?"Use taskmgr.exe to manually terminate excel.exe"
?


exit


Shawn.

[This message has been edited by Shawn (edited 20 June 2000).]

Top
#50129 - 2000-06-20 06:45 PM Re: Handling dates
Jochen Administrator Offline
KiX Supporter
*****

Registered: 2000-03-17
Posts: 6380
Loc: Stuttgart, Germany
Shawn,

i knew it would be this kind of 'excel-OLE thing'
*COOL*

so , as edited in my 17th reply , it took me 2 minutes to create a worksheet with exact the same 'functionality' as the Kix-script should have (hardly remembered the '=NOW()'-thingy)
ok, i am not disillusioned and will work on,on that
'Monster-KIX-Script'

so long


_________________________



Top
#50130 - 2000-06-20 06:48 PM Re: Handling dates
Jochen Administrator Offline
KiX Supporter
*****

Registered: 2000-03-17
Posts: 6380
Loc: Stuttgart, Germany
ahh, by the way Henri!?!

What is the maximum amount of reply's on one single topic????

LD, are You with us ?????

Ciao a tutti a lei

_________________________



Top
#50131 - 2000-06-20 07:55 PM Re: Handling dates
BoxKite Offline
Da Box
*****

Registered: 2000-05-17
Posts: 282
Loc: Vacaville,CA,USA
Sir Perceval (Shawn), Sir Galahad (Jochen); we the Knights of King Authur's (Henri) Round Table acknowledge you deed with three cheers:
Hip-Hip-Hooray.
Hip-Hip-Hooray.
Hip-Hip-Hooray.

_________________________
Box
FACTA NON VERBA

Top
#50132 - 2000-06-20 09:10 PM Re: Handling dates
Shawn Administrator Offline
Administrator
*****

Registered: 1999-08-13
Posts: 8611
We're knights of the round table, we dance whene're we're able.
We do routines, and border scenes, and footwork imp-e-cable;
We dine well here in Camelot, we eat ham and jam and spamalot.

We're knights of the round table, our shows are for-mid-able
The many times, we're given rhymes, that are quite un-sing-able
We're often mad in Camelot, we sing from the lie of hamalot!

Though we're tough and able,
Quite in-de-fa-ti-gable,
Between our quests, we seek incest and impersonate Clark Gable,
It's a busy life in Camelot:

(Bass-Solo): I have to push the pram-a-lot!

Arthur: On second thought, let's not go to Camelot. It is a silly place.
Assorted Knights: (mumble) Yeah, let's go, agreed, etc...

Top
#50133 - 2000-06-21 10:20 AM Re: Handling dates
Jochen Administrator Offline
KiX Supporter
*****

Registered: 2000-03-17
Posts: 6380
Loc: Stuttgart, Germany
folks ,

this man knows his !flying Circus!

Jochen,

p.s.: finished the 'strip ip out of ping'-batch task [without need to use grep]
and therefore can now fully concentrate on 'Handling dates' .... ok i have a 'real' job
to do , incidentally

Yours etc.

John Cleese

[This message has been edited by jpols (edited 21 June 2000).]

_________________________



Top
#50134 - 2000-06-23 08:08 PM Re: Handling dates
Jochen Administrator Offline
KiX Supporter
*****

Registered: 2000-03-17
Posts: 6380
Loc: Stuttgart, Germany
gang:
please just give me a little bit more time!
there are possibilities in this script, i never thought of ...
WoW .. getting more and more 'Einsteinian'

Jochen

_________________________



Top
Page 2 of 2 <12


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

Who's Online
0 registered and 528 anonymous users online.
Newest Members
Timothy, Jojo67, MaikSimon, kvn317, kixtarts2025
17874 Registered Users

Generated in 0.061 seconds in which 0.026 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