Page 1 of 1 1
Topic Options
#77254 - 2003-10-26 08:59 AM Best method/code to check for KiXtart and KiXforms versions
NTDOC Administrator Offline
Administrator
*****

Registered: 2000-07-28
Posts: 11629
Loc: CA
Okay all you elite coders out there.

I know this has been talked about before, but since the weekend appears slow again.

Here is your chance to show off your ideas.

What is the best method to ensure that a minimum version of KiXtart and KiXforms are on the system before launching the KiXform.

Here is an example of code to check, but I don't think it is the optimal bullet proof solution.

This is NOT a Golf game, but rather a best of breed code to guarantee KiXtart and KiXforms are at a set/given level and alert the user if one or the other do no meet the set/given criteria.

So post your ideas and code please.

debug off
break on
dim $iRC
$iRC=setoption('Explicit','ON')
$iRC=setoption('NoVarsInStrings','ON')
$iRC=setoption('WrapAtEOL','ON')

dim $ASCII,$ReqForms,$KixVersion,$MB,$frm,$KFCheck,$MBText,$KiXFound,$KiXMin
$ASCII = setoption(ascii,'on')
$ReqForms = 41
$KixVersion = @KIX
$KiXMin = '4.21'
select
case instr($KixVersion,'4.21') $KiXFound='4.21'
case instr($KixVersion,'4.22') $KiXFound='4.22'
case 1 $KiXFound=0
endselect
if $KiXFound < '4.21'
$MBText='This Script requires at least KiXtart version '+$KiXMin+@CRLF
$MBText=$MBText+'The latest version can be downloaded from'+@CRLF+@CRLF
$MBText=$MBText+'http://www.kixtart.org '
$MB=messagebox($MBTEXT,'Version Check',4112)
quit()
endif
$KFCheck=iif(readvalue('HKLM\SOFTWARE\CLASSES\KIXTART.FORM','')<>"",1,0)
if $KFCheck
$frm = createobject("Kixtart.Form")
if val($frm.Build) < $ReqForms
$MBText='This Script requires Kixforms build '
$MBText=$MBText+$ReqForms+@CRLF+@CRLF
$MBText=$MBText+'The latest version can be downloaded from'+@CRLF+@CRLF
$MBText=$MBText+'http://www.kixforms.com'
$MB=messagebox($MBText,'Version check',4112)
quit()
endif
else
$MBText='Unable to locate KiXforms on this computer. '
$MBText=$MBText+'This Script requires Kixforms build '
$MBText=$MBText+$ReqForms+@CRLF+@CRLF
$MBText=$MBText+'Please download and install the latest version of KiXforms from'+@CRLF
$MBText=$MBText+'http://www.kixforms.com '
$MB=messagebox($MBText,'Version check',4112)
endif

? 'Your KiX32 is: '+$KiXFound
? 'Okay to run your form now'

Top
#77255 - 2003-10-26 04:30 PM Re: Best method/code to check for KiXtart and KiXforms versions
Everyone Offline
Getting the hang of it

Registered: 2003-10-19
Posts: 81
Loc: Beale Air Force Base, CA
Seems like you could trim off this section:
code:
$KixVersion  = @KIX
$KiXMin = '4.21'
select
case instr($KixVersion,'4.21') $KiXFound='4.21'
case instr($KixVersion,'4.22') $KiXFound='4.22'
case 1 $KiXFound=0
endselect

Replace $KixFound with @Kix
I only saw $KixFound in 2 places below that chunk of code.

Top
#77256 - 2003-10-27 07:02 AM Re: Best method/code to check for KiXtart and KiXforms versions
NTDOC Administrator Offline
Administrator
*****

Registered: 2000-07-28
Posts: 11629
Loc: CA
Everyone,

That would not work very well as you would then have no solid method of determining the version of KiXtart itself.

I hear tell from Lonkero that Shawn may be moving away from the KiXtart CLASS, and be implementing something else. However that may still be a long time off and I would like to hear more details directly from Shawn about that.

Top
#77257 - 2003-10-27 10:26 AM Re: Best method/code to check for KiXtart and KiXforms versions
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
uhm?
think you got it vice-versa there boy [Wink]
_________________________
!

download KiXnet

Top
#77258 - 2003-10-27 02:49 PM Re: Best method/code to check for KiXtart and KiXforms versions
Kdyer Offline
KiX Supporter
*****

Registered: 2001-01-03
Posts: 6241
Loc: Tigard, OR
Doc,

Did you get a chance to look a Glenn's script to check for a minimum version of KiXtart?
KixVer() - Die or Carp if not at specific Kix version
Anyway, tookd your code an simplified is some for you.
code:
debug off
break on
dim $iRC,$opt,$ReqForms,$KixVersion,$frm,$KFCheck,$KiXFound,$KiXMin
for each $opt in split('ascii Explicit NoVarsInStrings WrapAtEOL')
$iRC=setoption($opt,'ON')
next

$ReqForms=41
$KiXMin='4.21'
$KiXFound=@kix
if $KiXFound<$KiXMin
$MBText='This Script requires at least KiXtart version '+$KiXMin+@CRLF
$MBText=$MBText+'The latest version can be downloaded from'+@CRLF+@CRLF
$MBText=$MBText+'http://www.kixtart.org '
$MB=messagebox($MBTEXT,'Version Check',4112)
quit()
endif
$frm=createobject("Kixtart.Form")
If @error=0
if val($frm.Build) < $ReqForms
$MBText='This Script requires Kixforms build '
$MBText=$MBText+$ReqForms+@CRLF+@CRLF
$MBText=$MBText+'The latest version can be downloaded from'+@CRLF+@CRLF
$MBText=$MBText+'http://www.kixforms.com'
$MB=messagebox($MBText,'Version check',4112)
quit()
endif
else
$MBText='Unable to locate KiXforms on this computer. '
$MBText=$MBText+'This Script requires Kixforms build '
$MBText=$MBText+$ReqForms+@CRLF+@CRLF
$MBText=$MBText+'Please download and install the latest version of KiXforms from'+@CRLF
$MBText=$MBText+'http://www.kixforms.com '
$MB=messagebox($MBText,'Version check',4112)
endif

? 'Your KiX32 version is: '+$KiXFound
? 'Okay to run your form now with '+$frm.build
$frm=0 ; you may want to release KiXForms
sleep 2

We maybe able to distill this down a bit further using functions for KIX32, KIXFORMS, and MESSAGEBOX.

HTH,

Kent
_________________________
Utilize these resources:
UDFs (Full List)
KiXtart FAQ & How to's

Top
#77259 - 2003-10-27 07:36 PM Re: Best method/code to check for KiXtart and KiXforms versions
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK

$KiXMin='4.21'
$KiXFound=@kix
if $KiXFound<$KiXMin

will not work.
you forgot that 4.22 has different string.

anyways:

$KixVersion = @KIX
$KiXMin = '4.21'
select
case instr($KixVersion,'4.21') $KiXFound='4.21'
case instr($KixVersion,'4.22') $KiXFound='4.22'
case 1 $KiXFound=0
endselect
if $KiXFound < '4.21'


is overshooting. and does only work for 4.21 as it's hard-coded and... and...

something like:

$KiXMin = '4.21'
$KixVersion = @KIX

$KiXFound=split($KixVersion,'.')
$KixFound=substr($KixFound[0],instrrev($KixFound[0], )+1)+'.'+$KixFound[1]

if $KiXFound < $KixMin


or?

[ 27. October 2003, 19:37: Message edited by: Lonkero ]
_________________________
!

download KiXnet

Top
#77260 - 2003-10-31 05:28 PM Re: Best method/code to check for KiXtart and KiXforms versions
Glenn Barnas Administrator Offline
KiX Supporter
*****

Registered: 2003-01-28
Posts: 4401
Loc: New Jersey
Doc:

I've updated the KixVer function to support the new values returned by 4.22.

Calling:
code:
KixVer(4.22)

causes the script to terminate with an error if you're running the 4.22 beta or RC version.

Calling:
code:
KixVer(4.22,0,1)

causes the script to continue quietly if you're running the 4.22 beta or RC version. The third arg, when true, permits beta and RC versions.

Calling:
code:
KixVer(4.22,1)

causes the script to continue, but return an error if you're running the 4.22 beta or RC version. The second option, when true, allows your script to handle "outdated version" issues.

Calling:
code:
KixVer(4)

Allows the script to continue if you're running any (non-beta/RC) version of Kix that's 4.0 or higher.

Here's the UDF: KixVer() function

Glenn
_________________________
Actually I am a Rocket Scientist! \:D

Top
#77261 - 2003-10-31 05:31 PM Re: Best method/code to check for KiXtart and KiXforms versions
Sealeopard Offline
KiX Master
*****

Registered: 2001-04-25
Posts: 11165
Loc: Boston, MA, USA
Glenn:

Can you please remove the preceeding text in the KiXver() UDF so that there's only the UDF itself. This will simplify automatic UDF Library parsing.

[ 31. October 2003, 22:03: Message edited by: sealeopard ]
_________________________
There are two types of vessels, submarines and targets.

Top
#77262 - 2003-10-31 05:41 PM Re: Best method/code to check for KiXtart and KiXforms versions
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
glenn, my code didn't work?
looking at your code, it's little... complex [Wink]
_________________________
!

download KiXnet

Top
#77263 - 2003-10-31 08:48 PM Re: Best method/code to check for KiXtart and KiXforms versions
Glenn Barnas Administrator Offline
KiX Supporter
*****

Registered: 2003-01-28
Posts: 4401
Loc: New Jersey
Jens:

Post was changed..

Lonk:

It may be complex, but the example you presented only works with 4.21 & 4.22, and needs to be updated to work with other versions. Remember, this isn't KixGolf! [Wink]

Glenn
_________________________
Actually I am a Rocket Scientist! \:D

Top
Page 1 of 1 1


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

Who's Online
0 registered and 2419 anonymous users online.
Newest Members
batdk82, StuTheCoder, M_Moore, BeeEm, min_seow
17885 Registered Users

Generated in 0.067 seconds in which 0.032 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