#77254 - 2003-10-26 08:59 AM
Best method/code to check for KiXtart and KiXforms versions
|
NTDOC
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
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
|
|
|
|
#77258 - 2003-10-27 02:49 PM
Re: Best method/code to check for KiXtart and KiXforms versions
|
Kdyer
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
|
|
Top
|
|
|
|
Moderator: Glenn Barnas, NTDOC, Arend_, Jochen, Radimus, Allen, ShaneEP, Ruud van Velsen, Mart
|
0 registered
and 2419 anonymous users online.
|
|
|