KiXforms Forum Index KiXforms
The Forum for the KiXforms Community
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 
 Quick Links 
Site News
Downloads
Documentation
Donations
Script Archive
Tracking Systems

Kixforms.dll Setup
Goto page Previous  1, 2, 3, 4, 5  Next
 
Post new topic   Reply to topic    KiXforms Forum Index -> Advanced Scripting
View previous topic :: View next topic  
Author Message
ntdoc
KiXforms Supporter
KiXforms Supporter


Joined: 05 Mar 2003
Posts: 77
Location: Mouse Country

PostPosted: Sat Jan 15, 2005 10:26 pm    Post subject: Reply with quote

Les is correct, I was going to edit but was be cooerced into shutting down the computer from the better half Wink
Back to top
View user's profile Send private message Visit poster's website AIM Address MSN Messenger
krabourn
KiXforms Aficionado
KiXforms Aficionado


Joined: 05 Mar 2003
Posts: 273
Location: San Antonio. TX

PostPosted: Sat Jan 15, 2005 10:41 pm    Post subject: Reply with quote

Make a variable to hold the @Error and exit the function with it.

I usually call mine $ErrorCode and exit with "Exit $ErrorCode". Just look at the code I posted earlier. That way the calling code can just check @Error after the function.

_________________
Kelly
Back to top
View user's profile Send private message Send e-mail MSN Messenger
Jochen
KiXforms Devotee
KiXforms Devotee


Joined: 05 Mar 2003
Posts: 1204
Location: Stuttgart, Germany

PostPosted: Thu Jan 20, 2005 3:51 pm    Post subject: Reply with quote

Aplogizes ... have updated my first reply in this topic to include val() in checking for special builds as the string reply failed on comparing two digit build against one digit builds Embarassed
_________________
Jochen

Tell me, and I will forget.
Show me, and I may remember.
Involve me, and I will understand.
Back to top
View user's profile Send private message MSN Messenger
benny69
KiXforms Advocate
KiXforms Advocate


Joined: 30 Oct 2003
Posts: 567
Location: Lincoln, Ne

PostPosted: Thu Jan 20, 2005 8:53 pm    Post subject: Reply with quote

Ok here is another look,
I have removed the min_dll and min_SB because I felt that what ever version was packaged would be the min_dll and or min_SB.
I have added what I think Jochen was talking about {val()}
and have changed the $ErrorCode/Exit.

Have I changed things correctly?
Is there anything else that should be considered?

Code:
;contributors Jochen,ntDoc,Les,krabourn,benny69

;Example Definitions
;$Min_dll = "2.4.0.46"
;$Min_SB = "10"

Function CheckAndUpdateKixformsVersion()
   Dim $i
   Dim $TargetDir,$SourceDir,$System
   Dim $Inst_dll,$Pack_dll,$Inst_dll_SB,$Pack_dll_SB
   
   $TargetFile = ReadValue("HKCR\CLSID\" + ReadValue("HKCR\Kixtart.Form\CLSID","") + "\InprocServer32","")
   ;if $TargetFile = "" then $TargetDir = "SystemDirectory"
   ;else $TargetDir = path of $TargetFile (where ever kixforms.dll is installed)
   If Not $TargetFile
      $TargetDir = ExpandEnvironmentVars(ReadValue("HKLM\SYSTEM\CurrentControlSet\Control\Windows","SystemDirectory"))
   Else
      For $i = 1 to (Len($TargetFile))
         If SubStr($TargetFile, $i, 1) = Chr(92)
            $TargetFileNameLength = Len($TargetFile) - ($i - 1)
        $TargetDir = SubStr($TargetFile, 1, (Len($TargetFile) - $TargetFileNameLength + 1))
         EndIf
      Next
   EndIf

   $SourceDir = %ASESCRIPTPATH%
   ;if $SourceDir = "" then $SourceDir = $EXECmdLine (what ever Directory this compiled file executes from.)
   ;else $SourceDir = %ASESCRIPTPATH% (what ever Temp Directory this compiled ASE file executes from.)
   If Not $SourceDir
      For $i = 1 to (Len($EXECmdLine))
         If SubStr($EXECmdLine, $i, 1) = Chr(92)
            $SourceFileNameLength = Len($EXECmdLine) - ($i - 1) 
        $SourceDir = SubStr($EXECmdLine, 1, (Len($EXECmdLine) - $SourceFileNameLength + 1))
         EndIf
      Next
   EndIf
   ;Installed kixforms.dll file version
   $Inst_dll = GetFileVersion("$TargetDir\kixforms.dll")
   ;Packaged kixforms.dll file version
   $Pack_dll = GetFileVersion("$SourceDir\kixforms.dll")
   ;Installed kixforms.dll SpecialBuild number
   $Inst_dll_SB = Val(GetFileVersion("$TargetDir\kixforms.dll","SpecialBuild"))
   ;Packaged kixforms.dll SpecialBuild number
   $Pack_dll_SB = Val(GetFileVersion("$SourceDir\kixforms.dll","SpecialBuild"))
   
   ;if kixforms.dll does not exist Install Packaged version and register kixforms.dll in the System Directory
   ;else offer to install newer version and register kixforms.dll in the System Directory or where ever kixforms.dll is installed
   If Not Exist("$TargetDir\kixforms.dll")
      Copy "$SourceDir\kixforms.dll" "$TargetDir\"
      Shell "REGSVR32.EXE /s KIXFORMS.DLL"
   Else
    If $Pack_dll > $Inst_dll Or ($Pack_dll = $Inst_dll And $Pack_dll_SB > $Inst_dll_SB)
         $Msg = MessageBox("This Script requires at least KiXforms v" + $Pack_dll + " " + $Pack_dll_SB + "." + @CRLF + "This Folder already contains a file named 'kixforms.dll'." + @CRLF + "" + @CRLF + "Would you like to replace the existing file:" + @CRLF + @CRLF + "File Version: " + $Inst_dll + " " + $Inst_dll_SB + @CRLF + @CRLF + "with this one?" + @CRLF + @CRLF + "File Version: " + $Pack_dll + " " + $Pack_dll_SB + @CRLF + "","Confirm FileReplace",52)
         If $Msg = 6
            Shell "REGSVR32.EXE /s /U KIXFORMS.DLL"
            Copy "$SourceDir\kixforms.dll" "$TargetDir\"
            Shell "REGSVR32.EXE /s KIXFORMS.DLL"
         EndIf
      EndIf
   
   EndIf
   ;if kixforms.dll is not registered give error message and quit
   ;else exit normally
   $System = CreateObject("KiXtart.System")
   If @error > 0
      $ErrorCode = @Error
      Exit $ErrorCode
   EndIf
EndFunction

_________________
Wait don't order yet,... get KiXforms Designer .NET 2.0 (Beta)
KiXforms Designer .NET 2.0 (Beta)
Back to top
View user's profile Send private message Send e-mail
ntdoc
KiXforms Supporter
KiXforms Supporter


Joined: 05 Mar 2003
Posts: 77
Location: Mouse Country

PostPosted: Thu Jan 20, 2005 10:40 pm    Post subject: Reply with quote

Nice Benny,

Couple other items.

1. Consensus is that $msgbox or other feedback should not be in the actual UDF, but have sufficient code to allow the return values to decide in the main calling script what to do for specific errors.

2. In the line Shell "REGSVR32.EXE /s KIXFORMS.DLL"
you don't check for any error value. If it failed for some reason the call to the UDF would not know.
Back to top
View user's profile Send private message Visit poster's website AIM Address MSN Messenger
Les
KiXforms Aficionado
KiXforms Aficionado


Joined: 24 Dec 2003
Posts: 317

PostPosted: Fri Jan 21, 2005 1:23 am    Post subject: Reply with quote

You embed vars in strings so if someone does SetOption('NoVarsInStrings','On') then the function would fail.
_________________
The Repro Man
Stealing for a living!
Back to top
View user's profile Send private message
AlexW
KiXforms Dabbler
KiXforms Dabbler


Joined: 02 Feb 2005
Posts: 7

PostPosted: Thu Feb 03, 2005 7:48 pm    Post subject: Reply with quote

This is the script i use. You specified the version, and it tries to unregister all "invalid" once's. It quicker then searching a folder structure.
You can modify what the script should do, add maybe an admin check of check the errorlevel of regsvr32.


[
Code:
DetectKixForms("2.3.0.45")


Function DetectKixForms($tmpver)

   $KeyIndex = 0
   :KeyLoop1
   $KeyName = ENUMKEY("HKCR\CLSID\", $KeyIndex)
   If @error = 0
      $kixformssource=lcase(readvalue("HKCR\CLSID\$KeyName\InprocServer32",""))
      if instr("$kixformssource","kixforms.dll")>0
         $kixformsver=GetFileVersion ("$kixformssource","BinProductVersion")
         if "$kixformsver"<>"$tmpver"
            ?"Wrong kixforms version $kixformsver found in $kixformssource"
            ?"Trying to unregister dll"
            shell "regsvr32 /s /u $kixformssource"
            if @error=0
               ?"Unregister succesful"
            else
               ?"Unregister failed"
            endif
         else
            ?"Correct kixforms version $kixformsver found."
         endif
      endif   
      $KeyIndex = $KeyIndex + 1
      goto KeyLoop1
   Endif
EndFunction
Back to top
View user's profile Send private message
Les
KiXforms Aficionado
KiXforms Aficionado


Joined: 24 Dec 2003
Posts: 317

PostPosted: Thu Feb 03, 2005 11:34 pm    Post subject: Reply with quote

You should not wrap vars in quotes as in:
if "$kixformsver"<>"$tmpver"

You should not use vars in strings:
shell "regsvr32 /s /u $kixformssource"

If there is a space in the path, it would fail for lack of quotes.

You should not use GOTO.

_________________
The Repro Man
Stealing for a living!
Back to top
View user's profile Send private message
ntdoc
KiXforms Supporter
KiXforms Supporter


Joined: 05 Mar 2003
Posts: 77
Location: Mouse Country

PostPosted: Sat Oct 15, 2005 1:33 am    Post subject: Reply with quote

Benny,

Did you ever finalize this code yet?

Please don't forget to remove the GOTO and to also set these options

Dim $SO
$SO=SetOption('Explicit','On')
$SO=SetOption('NoVarsInStrings','On')
$SO=SetOption('NoMacrosInStrings','On')
 
Back to top
View user's profile Send private message Visit poster's website AIM Address MSN Messenger
Lonkero
KiXforms Devotee
KiXforms Devotee


Joined: 13 Mar 2003
Posts: 1022
Location: Espoo, Finland

PostPosted: Sat Oct 15, 2005 4:33 pm    Post subject: Reply with quote

so...
what's the point in pulling the dll version?
why not just pull the kixforms version from the object?

I wrapped this up during the last kixgolf:
Code:
Function KiXformsVer(optional $n)
;a short UDF that retrieves the version of KF2 or KF3
;0 or without = both (kf 2 and 3). 2 for kf2 and 3 for kf3.

dim $,$kf2,$kf3
 $kf3=createObject("KiXforms.system")
 $kf2=createObject("KiXtart.system")
 if vartype($kf2) = 9  $kf2 = $kf2.version endif
 if vartype($kf3) = 9  $kf3 = $kf3.productVersion endif
 select
  case 2 = $n
   $KiXFormsVer = $kf2
  case 3 = $n
   $KiXFormsVer = $kf3
  case 1
   $KiXFormsVer = $kf2 + iif(len($kf2) AND len($kf3)," / ","") + $kf3
 endselect
  exit @error
endfunction

_________________
Hammer
Back to top
View user's profile Send private message Visit poster's website MSN Messenger
ntdoc
KiXforms Supporter
KiXforms Supporter


Joined: 05 Mar 2003
Posts: 77
Location: Mouse Country

PostPosted: Mon Oct 17, 2005 3:56 am    Post subject: Reply with quote

Doesn't support remote checking
Back to top
View user's profile Send private message Visit poster's website AIM Address MSN Messenger
masken
KiXforms Enthusiast
KiXforms Enthusiast


Joined: 14 Mar 2003
Posts: 202
Location: Gothenburg, Sweden

PostPosted: Tue Oct 18, 2005 1:53 pm    Post subject: Reply with quote

Why not simply compare filetimes and replace/re-register if they don't match?
Back to top
View user's profile Send private message MSN Messenger
Shaba1
KiXforms Dabbler
KiXforms Dabbler


Joined: 24 Aug 2005
Posts: 6

PostPosted: Tue Oct 25, 2005 9:58 pm    Post subject: Reply with quote

Ok As a new kixfroms user let me just say. I AM CONFUSED!!!! there are three pages to this post and I do not know how many different code post. Is there one definative way of after checking which version of windows is running on workstation:

#1 checking if kixforms.dll is on the workstation.And if it is not going to #5
#2 Checking if it is the latest version off the dll. and if it is not going to #5
#3 Seeing If the dll is registered and if not going to #6
#4 Ending the check here if 1,2,and 3 fall thru
#5 copying the dll to the windows/systems directory if it is a win98 or winNT machine and to windows/system32 if it is a win2k/xp machine.
#6 Registering the dll.
#7 going back to the calling script or line.

I think my logic is correct. Please correct it if it is not.

_________________
At some point in his life an man stops being the man he is and starts being the man he always wanted to be-----Bruce Springsteen(I think)
Back to top
View user's profile Send private message Visit poster's website
Lonkero
KiXforms Devotee
KiXforms Devotee


Joined: 13 Mar 2003
Posts: 1022
Location: Espoo, Finland

PostPosted: Thu Oct 27, 2005 1:27 pm    Post subject: Reply with quote

well, not sure about correct or not but surely is way too complicated.

if not found or wrong version
drop into system and reg
endif

should take care of it.

_________________
Hammer
Back to top
View user's profile Send private message Visit poster's website MSN Messenger
Shaba1
KiXforms Dabbler
KiXforms Dabbler


Joined: 24 Aug 2005
Posts: 6

PostPosted: Thu Oct 27, 2005 3:32 pm    Post subject: Reply with quote

Benny: Why do you use %ASESCRIPTPATH% I do not use ASE If I put your most recent script on my netlogon share it would fail becasue I do not have ASE installed. Why not make it generic?
Back to top
View user's profile Send private message Visit poster's website
Display posts from previous:   
Post new topic   Reply to topic    KiXforms Forum Index -> Advanced Scripting All times are GMT
Goto page Previous  1, 2, 3, 4, 5  Next
Page 3 of 5

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Powered by phpBB © 2001, 2005 phpBB Group