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 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
benny69
KiXforms Advocate
KiXforms Advocate


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

PostPosted: Mon Jan 03, 2005 3:04 pm    Post subject: Kixforms.dll Setup Reply with quote

This is the way I am checking the current Version of Kisforms.dll, but it is kinda bulky and clumbsy, how is everyone else doing it?

Code:
$SystemDir = %SystemROOT%
$InstallDirectory = "$SystemDir\System32"
$TempDir = %ASESCRIPTPATH%

If Exist($InstallDirectory + "\kixforms.dll")
   If Exist($InstallDirectory + "\kixforms.dll")
      $CurFileSize = GetFileSize ($InstallDirectory + "\kixforms.dll")
      $CurFileDate = GetFileTime($InstallDirectory + "\kixforms.dll")
      $NewFileSize = GetFileSize ($TempDir + "\kixforms.dll")
      $NewFileDate = GetFileTime($TempDir + "\kixforms.dll")
      $CurFileSize = $CurFileSize / 1024
      $NewFileSize = $NewFileSize / 1024
      If $CurFileSize <> $NewFileSize AND $CurFileDate <> $NewFileDate
         $MessageReturn = MessageBox("This Folder already contains a file named 'kixforms.dll'." + Chr(13) + Chr(10) + "" + Chr(13) + Chr(10) + "Would you like to replace the existing file:" + Chr(13) + Chr(10) + Chr(13) + Chr(10) + "Size: $CurFileSize Kb" + Chr(13) + Chr(10) + "Modified: $CurFileDate" + Chr(13) + Chr(10) + Chr(13) + Chr(10) + "with this one?" + Chr(13) + Chr(10) + Chr(13) + Chr(10) + "Size: $NewFileSize Kb" + Chr(13) + Chr(10) + "Modified: $NewFileDate" + Chr(13) + Chr(10) + "","Confirm FileReplace",52)
         If $MessageReturn = 6
            Sleep 2
            Run "%comspec% /c start REGSVR32.EXE /s /U KIXFORMS.DLL"
            CopyaFile($TempDir + "\kixforms.dll",$InstallDirectory)
            Run "%comspec% /c start REGSVR32.EXE /s KIXFORMS.DLL"
         EndIf
      EndIf
   EndIf
Else
   CopyaFile($TempDir + "\kixforms.dll",$InstallDirectory)
   Run "%COMSPEC% /c REGSVR32.EXE /s KIXFORMS.DLL"
EndIf

Function CopyaFile($Source,$Target)
   $objFSO = CreateObject("Scripting.FileSystemObject")
   $objFSO.CopyFile($Source,$Target+"\",TRUE)
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
Jochen
KiXforms Devotee
KiXforms Devotee


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

PostPosted: Mon Jan 03, 2005 3:09 pm    Post subject: Reply with quote

current project, current code (might be not enterprise ready Rolling Eyes )

Code:
;-------------------------------------------------------------------------------
;                   Update and Registration of kixforms.dll
;-------------------------------------------------------------------------------
if not exist("%SystemRoot%\system32\kixforms.dll")
    copy $bin + 'kixforms.dll' '%SystemRoot%\system32\'
else
    if getfileversion($bin + 'kixforms.dll') > getfileversion('%SystemRoot%\system32\kixforms.dll') or
       (getfileversion($bin + 'kixforms.dll') = getfileversion('%SystemRoot%\system32\kixforms.dll') and
       val(getfileversion($bin + 'kixforms.dll', "SpecialBuild")) > val(getfileversion('%SystemRoot%\system32\kixforms.dll', "SpecialBuild")) )
        copy $bin + 'kixforms.dll' '%SystemRoot%\system32\'
    endif
endif

$system = createobject("KiXtart.System")
if @error
    shell 'regsvr32 /s kixforms.dll'
    $system = createobject("KiXtart.System")
    if @error
        $_ = messagebox('You may not be a local administrator, make sure that you have appropriate rights on your system',
                        'Registration of Kixforms.dll failed',4112)
        quit 1
    endif
endif

_________________
Jochen

Tell me, and I will forget.
Show me, and I may remember.
Involve me, and I will understand.


Last edited by Jochen on Thu Jan 20, 2005 3:49 pm; edited 1 time in total
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: Mon Jan 03, 2005 3:18 pm    Post subject: Reply with quote

What are you defining $bin as? (%ASESCRIPTPATH%)
_________________
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
Jochen
KiXforms Devotee
KiXforms Devotee


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

PostPosted: Mon Jan 03, 2005 3:22 pm    Post subject: Reply with quote

Nay, I don't use ASE Wink
_________________
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: Mon Jan 03, 2005 3:36 pm    Post subject: Reply with quote

I just realized I have an extra 'If Exist' that I don't need.

I like the use of your 'Getfileversion()'

Before I changed to ASE I would have defined your $bin as:

Code:
TrimFileNameOffPath($EXECmdLine)
$bin = $FileNamePath

Function TrimFileNameOffPath($FullPath)

   Dim $i
   For $i = 1 to (Len($FullPath))
      If SubStr($FullPath, $i, 1) = Chr(92)
         $FileNameLength = Len($FullPath) - ($i - 1)
         $FileName = SubStr($FullPath, ($i + 1), $FileNameLength)
         $FileNamePath = SubStr($FullPath, 1, (Len($FullPath) - $FileNameLength + 1))
      EndIf
   Next

EndFunction



are you doing somthing similar?

_________________
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
Jochen
KiXforms Devotee
KiXforms Devotee


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

PostPosted: Tue Jan 04, 2005 10:45 am    Post subject: Reply with quote

Ja, this use of getfileversion has become neccessary with the development builds and depends on the accuracy of version numbers Wink

Some words to $bin ... The scripts I use this for (admin stuff) are placed on our Servers and are started by a shortcut to wkix32. The folder Structure looks like this :

Code:

root folder
     |
     |__ \bin (contains kixforms.dll and wkix32)
     |
     |__ \scripts (teh Script)
     |
     |__ \tmp (volatile things)
     |
     |__ \udf (speaking name)
     |
     |__ \...
     |
     |
   ShortcutToScript.lnk


The shortcut is set to start in \scripts and targets normally "path to bin\wkix32 %0\..\scriptname.kix ".

Finally: $bin = @scriptdir + '\..\bin\'

_________________
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: Tue Jan 04, 2005 1:27 pm    Post subject: Reply with quote

Nice, well organized.

Is there a reason that you don't compile those .kix?

_________________
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
Jochen
KiXforms Devotee
KiXforms Devotee


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

PostPosted: Tue Jan 04, 2005 3:13 pm    Post subject: Reply with quote

uh ... my fault.

It should've been "path to bin\wkix32 %0\..\scriptname.kx"
Err, you know ... >tokenized< Cunning

_________________
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
ntdoc
KiXforms Supporter
KiXforms Supporter


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

PostPosted: Fri Jan 14, 2005 7:14 am    Post subject: Reply with quote

Here is a version I posted on Korg for checking (not installing) KiXform.dll

Please comment

http://www.kixtart.org/ubbthreads/showflat.php?Cat=&Board=UBB13&Number=131596&Main=131596
Back to top
View user's profile Send private message Visit poster's website AIM Address MSN Messenger
benny69
KiXforms Advocate
KiXforms Advocate


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

PostPosted: Fri Jan 14, 2005 3:53 pm    Post subject: Reply with quote

Thanks Jochen, ntDoc
Here is what I have come up with, I tried to take into acount all the sugestions. What does everybody think?

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

Function CheckKixformsVersion(optional $Min_dll,optional $Min_SB)
   Dim $SystemDir,$TempDir,$Priv,$Domain,$System
   Dim $Inst_dll,$Pack_dll,$Inst_dll_SB,$Pack_dll_SB
   
   $SystemDir = "%SystemROOT%\System32"
   $TempDir = %ASESCRIPTPATH%
   $Priv = @PRIV
   $Domain = @Domain
   
   If Not $Min_dll
      $Min_dll="2.4.0.46"
   EndIf
   If Not $Min_SB
      $Min_SB="10"
   EndIf

   $Inst_dll = GetFileVersion('$SystemDir\kixforms.dll')
   $Pack_dll = GetFileVersion('$TempDir\kixforms.dll')
   $Inst_dll_SB = GetFileVersion('$SystemDir\kixforms.dll','SpecialBuild')
   $Pack_dll_SB = GetFileVersion('$TempDir\kixforms.dll','SpecialBuild')
   
   If Not Exist("$SystemDir\kixforms.dll")
      Copy '$TempDir\kixforms.dll' '$SystemDir\'
      Run "%comspec% /c start 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" + $Min_dll + " " + $Min_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
            Run "%comspec% /c start REGSVR32.EXE /s /U KIXFORMS.DLL"
            Copy '$TempDir\kixforms.dll' '$SystemDir\'
            Run "%comspec% /c start REGSVR32.EXE /s KIXFORMS.DLL"
         EndIf
      EndIf
   EndIf
   $System = CreateObject("KiXtart.System")
   Select
      Case @error > 0
         $= MessageBox(@SERROR + @CRLF + "Registration of Kixforms.dll failed","Registration of Kixforms.dll failed",4112)
         Quit()
      Case @error < 0
         $= MessageBox("Error: " + @Error + " has been encountered. ","Registration of Kixforms.dll failed",4112)
         Quit()
   EndSelect
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
Les
KiXforms Aficionado
KiXforms Aficionado


Joined: 24 Dec 2003
Posts: 317

PostPosted: Fri Jan 14, 2005 4:15 pm    Post subject: Reply with quote

This is minor, but rather than have two CASEs for @Error that say pretty much the same thing, why not just have one on @Error?
_________________
The Repro Man
Stealing for a living!
Back to top
View user's profile Send private message
benny69
KiXforms Advocate
KiXforms Advocate


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

PostPosted: Fri Jan 14, 2005 4:40 pm    Post subject: Reply with quote

well you see,
the first checks for an error > 0, if the error is > 0 then it is a win32 error and @serror will return the exact problem.
the second checks for an error < 0, if the error is < 0 (negitive) then it is an unknown error and must be researched.

_________________
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
benny69
KiXforms Advocate
KiXforms Advocate


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

PostPosted: Fri Jan 14, 2005 5:18 pm    Post subject: Reply with quote

Here is another ver that takes into account wether or not you are useing a compiled file from ASE or KiXscripts Editor.

What I added is:
Code:

If Not $TempDir
   For $i = 1 to (Len($EXECmdLine))
      If SubStr($EXECmdLine, $i, 1) = Chr(92)
         $FileNameLength = Len($EXECmdLine) - ($i - 1)
         $FileNamePath = SubStr($EXECmdLine, 1, (Len($EXECmdLine) - $FileNameLength + 1))
      EndIf
   Next
   $TempDir = $FileNamePath
EndIf


Code:

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

Function CheckKixformsVersion(optional $Min_dll,optional $Min_SB)
   Dim $i,$FileNameLength,$FileNamePath
   Dim $SystemDir,$TempDir,$Priv,$Domain,$System
   Dim $Inst_dll,$Pack_dll,$Inst_dll_SB,$Pack_dll_SB
   
   $SystemDir = "%SystemROOT%\System32"
   $TempDir = %ASESCRIPTPATH%
   If Not $TempDir
      For $i = 1 to (Len($EXECmdLine))
         If SubStr($EXECmdLine, $i, 1) = Chr(92)
            $FileNameLength = Len($EXECmdLine) - ($i - 1)
            $FileNamePath = SubStr($EXECmdLine, 1, (Len($EXECmdLine) - $FileNameLength + 1))
         EndIf
      Next
      $TempDir = $FileNamePath
   EndIf
   
   If Not $Min_dll
      $Min_dll="2.4.0.46"
   EndIf
   If Not $Min_SB
      $Min_SB="10"
   EndIf

   $Inst_dll = GetFileVersion('$SystemDir\kixforms.dll')
   $Pack_dll = GetFileVersion('$TempDir\kixforms.dll')
   $Inst_dll_SB = GetFileVersion('$SystemDir\kixforms.dll','SpecialBuild')
   $Pack_dll_SB = GetFileVersion('$TempDir\kixforms.dll','SpecialBuild')
   
   If Not Exist("$SystemDir\kixforms.dll")
      Copy '$TempDir\kixforms.dll' '$SystemDir\'
      Run "%comspec% /c start REGSVR32.EXE /s KIXFORMS.DLL" ;/s silences the system (no user responce needed)
   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" + $Min_dll + " " + $Min_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
            Run "%comspec% /c start REGSVR32.EXE /s /U KIXFORMS.DLL" ;/s silences the system (no user responce needed)
            Copy '$TempDir\kixforms.dll' '$SystemDir\'
            Run "%comspec% /c start REGSVR32.EXE /s KIXFORMS.DLL" ;/s silences the system (no user responce needed)
         EndIf
      EndIf
   EndIf
   $System = CreateObject("KiXtart.System")
   Select
      Case @error > 0
         $= MessageBox(@SERROR + @CRLF + "Registration of Kixforms.dll failed","Registration of Kixforms.dll failed",4112)
         Quit()
      Case @error < 0
         $= MessageBox("Error: " + @Error + " has been encountered. ","Registration of Kixforms.dll failed",4112)
         Quit()
   EndSelect
EndFunction


Somthing I'm not sure about is:
Code:

Run "%comspec% /c start REGSVR32.EXE /s /U KIXFORMS.DLL"
Run "%comspec% /c start REGSVR32.EXE /s KIXFORMS.DLL"

Does this work on all Windows Versions?
Do I need to worry about a diferant structure for say Win89 vers Win2000 or WinNT?

_________________
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
Les
KiXforms Aficionado
KiXforms Aficionado


Joined: 24 Dec 2003
Posts: 317

PostPosted: Fri Jan 14, 2005 5:45 pm    Post subject: Reply with quote

benny69 wrote:
well you see,
the first checks for an error > 0, if the error is > 0 then it is a win32 error and @serror will return the exact problem.
the second checks for an error < 0, if the error is < 0 (negitive) then it is an unknown error and must be researched.

..and your point is?
I don't need a lesson in KiX expressions. One prints @Error, the other @SError... why not just print both?

...and will the end user that gets one message vs. the other do something different?

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


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

PostPosted: Fri Jan 14, 2005 5:46 pm    Post subject: Reply with quote

I know I am late on this topic but here is somthing close to what I use. It is an updated version from here, Update/Install KixForms. It includes checking to see if the user has enough rights.

Code:
FUNCTION fnUpdateKiXFormsLocal($SourceFile)
   DIM $ErrorCode, $SourceVersion, $SourceSpecialBuild, $SourceDate, $TargetDir, $TargetFile, $TargetVersion, $TargetSpecialBuild, $TargetDate
   $ErrorCode = 0
   $SourceVersion = GetFileVersion($SourceFile)
   $SourceSpecialBuild = GetFileVersion($SourceFile, "SpecialBuild")
   $SourceDate = GetFileTime($SourceFile)
   $TargetFile = ReadValue("HKCR\CLSID\" + ReadValue("HKCR\Kixtart.Form\CLSID", "") + "\InprocServer32", "")
   $TargetVersion = GetFileVersion($TargetFile)
   $TargetDate = GetFileTime($TargetFile)
   $TargetSpecialBuild = GetFileVersion($TargetFile, "SpecialBuild")
   IF $TargetVersion = "" OR $TargetVersion < $SourceVersion OR $TargetSpecialBuild < $SourceSpecialBuild OR $TargetDate < $SourceDate
      IF InGroup ('\\' + @Wksta + '\' + SidToName('S-1-5-32-544')) - 1 + @InWin, '\\' + @Wksta + '\' + SidToName('S-1-5-32-547')) - 1 + @InWin)
         $TargetDir = ExpandEnvironmentVars(ReadValue('HKLM\SYSTEM\CurrentControlSet\Control\Windows', 'SystemDirectory'))
         IF $TargetFile
            SHELL "%comspec% /c regsvr32 " + $TargetFile + " /s /u"
            $ErrorCode = @Error
            IF $ErrorCode = 0
               DEL $TargetFile /H /F
               $ErrorCode = @Error
            ENDIF
         ENDIF
         IF $ErrorCode = 0
            COPY $SourceFile $TargetDir
            $ErrorCode = @Error
            IF $ErrorCode = 0
               SHELL "regsvr32 " + $TargetDir + "\kixforms.dll /s"
               $ErrorCode = @Error
            ENDIF
         ENDIF
      ELSE
         $ErrorCode = 5
      ENDIF
   ENDIF
   EXIT $ErrorCode
ENDFUNCTION

_________________
Kelly
Back to top
View user's profile Send private message Send e-mail MSN Messenger
Display posts from previous:   
Post new topic   Reply to topic    KiXforms Forum Index -> Advanced Scripting All times are GMT
Goto page 1, 2, 3, 4, 5  Next
Page 1 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