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 Setup

 
Post new topic   Reply to topic    KiXforms Forum Index -> Script Archive
View previous topic :: View next topic  
Author Message
Dean F
KiXforms Dabbler
KiXforms Dabbler


Joined: 19 May 2003
Posts: 13
Location: Seattle

PostPosted: Mon May 19, 2003 12:57 am    Post subject: KIXForms Setup Reply with quote

The following is my simplistic Smile KIXFORMS SETUP CODE. I've dropped it in front of many scripts which use KIXFORMS.

It is designed to work with the compiler built into KIXSCRIPTS.COM's (http://www.kixscripts.com) editor. By use of the latest version of that compiler, one can add 3rd party files into the compiled EXE along with the KIX script (such as the KIXFORMS.DLL) - all of which get extracted to the user's TEMP folder for execution and/or use by the script.

UPDATE - An updated version of this script can be found further along in this discussion thread.

Code:

;===============================================================================================
;Last Modified on 4/26/2003 at 7:33:54 PM by DFlaming
;===============================================================================================
SetConsole ("Hide")

;Read in path of new KIXFORMS.DLL file
If Exist("@SCRIPTDIR\KIXFORMS.DLL")
   $NewKixFormsFile = "@SCRIPTDIR\KIXFORMS.DLL"
Else
   $NewKixFormsFile = "$EXEPath\KIXFORMS.DLL"
EndIf

;Determine Operating System (Win 9x or NT based) and Windows and System folders
If "@INWIN" = "2"
   $Key = "HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\"
   $Value = "SystemRoot"
   $SystemFolder = "System"
Else
   $Key = "HKEY_LOCAL_MACHINE\Software\Microsoft\Windows NT\CurrentVersion\"
   $Value = "SystemRoot"
   $SystemFolder = "System32"
EndIf

$WindowsFolder = ReadValue("$Key","$Value")

;These below three lines are needed for the compilation process.  They tell the compiler where my KIXFORMS.DLL is located.
;<META>
;<ADDFILE>C:\Documents and Settings\Dean Flaming\Desktop\Kix Scripts\kixforms.dll</ADDFILE>
;</META>

;Lookup KIXFORMS.DLL Class IDs to determine if it is already registered
$KixFormsKey1 = "HKEY_CLASSES_ROOT\CLSID\{F89DF848-618A-46F9-8A1C-396EA442BDD3}\"
$KixFormsKey2 = "HKEY_CLASSES_ROOT\TypeLib\{C8DCCD39-471D-4AFD-8EA2-89604A9C6252}\"

$KixFormsKeyName1 = EnumKey($KixFormsKey1,0)
If @ERROR <> 0 GoTo CheckDLL EndIf

$KixFormsKeyName2 = EnumKey($KixFormsKey2,0)
If @ERROR <> 0 GoTo CheckDLL EndIf

;Read in path of existing KIXFORMS.DLL file
:CurrentKF
$CurrentKixFormsFile = ReadValue("$KixFormsKey1\InprocServer32","")

;Get File Versions of both new and existing KIXFORMS.DLL files
$KixFormsVer1 = GetFileVersion("$NewKixFormsFile")
$KixFormsVer2 = GetFileVersion("$CurrentKixFormsFile")

;Compare version numbers of new and existing KIXFORMS.DLL files
If $KixFormsVer1 <> $KixFormsVer2
   ;Ask user to upgrade to newer version of KIXFORMS.DLL file
   MessageBox("A newer version of KIXFORMS is available.  Do you wish to update your version of KIXFORMS?","KIXFORMS Update",35)
   If @ERROR = 6
      ;Update to new KIXFORMS.DLL file
      Copy "$NewKixFormsFile" "$CurrentKixFormsFile" /H
   EndIf
   If @ERROR = 7 GoTo KFDone EndIf
   If @ERROR = 2 GoTo TheEnd EndIf
EndIf

;At this point either user has an updated KIXFORMS.DLL, has updated, or does not wish to update.
;Process will now Exit.
GoTo KFDone


;Check to see if user wants to install KIXFORMS
:CheckDLL
MessageBox("Your system does not have KIXFORMS installed and/or properly registered." + Chr(13) + Chr(10) + "" + Chr(13) + Chr(10) + "Would you like to setup KIXFORMS on your system?" + Chr(13) + Chr(10) + "" + Chr(13) + Chr(10) + "Note:   You will not be able to run programs which make use of KIXFORMS unless it is installed!","KIXFORMS Setup",4131)
If @ERROR = 2 Exit EndIf
If @ERROR = 7
   MessageBox("The KIXFORMS.DLL file is not installed nor correctly registered on this system!" + Chr(13) + Chr(10) + "" + Chr(13) + Chr(10) + "You will not be able to use any programs which make use of KIXFORMS!","KIXFORMS ERROR",4112)
   GoTo TheEnd
EndIf
If @ERROR = 6
   ;Copy KIXFORMS.DLL to the Windows folder
   Copy "$NewKixFormsFile" "$WindowsFolder\KIXFORMS.DLL" /H
   If NOT Exist("$WindowsFolder\KIXFORMS.DLL")
      MessageBox("The system could not find KIXFORMS.DLL in either in $EXEPath or in @SCRIPTDIR to copy into $WindowsFolder!" + Chr(13) + Chr(10) + "" + Chr(13) + Chr(10) + "Would you like to retry the copy?","COPY ERROR!",19)
      If @Error = 2 GoTo Exit EndIf
      If @Error = 7
         MessageBox("The KIXFORMS.DLL file is not installed nor correctly registered on this system!" + Chr(13) + Chr(10) + "" + Chr(13) + Chr(10) + "You will not be able to use any programs which make use of KIXFORMS!","KIXFORMS ERROR",4112)
         GoTo TheEnd
      EndIf
      If @ERROR = 6 GoTo CheckDLL EndIf
   EndIf
   ;Register the KIXFORMS.DLL file to the Windows OS
   Shell '$WindowsFolder\$SystemFolder\REGSVR32.EXE /s $WindowsFolder\KIXFORMS.DLL'
EndIf

:KFDone

:TheEnd
Exit

_________________
Good Luck,

-Dean F.


Last edited by Dean F on Tue May 20, 2003 5:49 pm; edited 1 time in total
Back to top
View user's profile Send private message
Sealeopard
KiXforms Aficionado
KiXforms Aficionado


Joined: 05 Mar 2003
Posts: 436
Location: Boston, MA

PostPosted: Mon May 19, 2003 1:58 am    Post subject: Reply with quote

Registering a COM-DLL requires at leats Power User rights. Also, one should alwsy unregister a DLL be fore registerign it again. There are already a couple of posts dealing with the recommended way to distribute KiXforms in this BBS.

See What is the best way to update install/update kixforms?

_________________
Jens

'There are two kinds of vessels, submarines and targets.'
Back to top
View user's profile Send private message Send e-mail MSN Messenger
Dean F
KiXforms Dabbler
KiXforms Dabbler


Joined: 19 May 2003
Posts: 13
Location: Seattle

PostPosted: Mon May 19, 2003 3:50 am    Post subject: Re: KIXForms Setup Reply with quote

While you are correct that COM-DLL registration requires Power User rights on most systems, I've found Windows XP and 2000 systems to be a bit more forgiving in that arena and, with local policy and system modifications, regular users can accomplish the same functions.

You are also correct that unregistering a COM-DLL should be done before the re-registering of that same COM-DLL. In this case, my script does not conduct that function but, instead, merely replaces the DLL if an upate is available. The registration of the KIXFORMS.DLL, for the most part, just makes the WIN32 system aware of it's location.

I had previously read through the mentioned topic "...install/update kixforms" before my first posting. The script I posted was written prior to viewing this article but after reviewing both my script and this other one, found that mine accomplished exactly what I needed it to at the time.

Thanks for the pointers!

_________________
Good Luck,

-Dean F.
Back to top
View user's profile Send private message
Dean F
KiXforms Dabbler
KiXforms Dabbler


Joined: 19 May 2003
Posts: 13
Location: Seattle

PostPosted: Tue May 20, 2003 5:48 pm    Post subject: Updated Script Reply with quote

I've updated this to add the "$NUL=" to all MESSAGEBOX lines as well as replaced the CHR(13) + CHR(10) with @CRLF. This should clean it up somewhat.

Thanks to SeaLeopard and others for their pointers.

Code:

;===============================================================================================
;Last Modified on 5/20/2003 at 12:54:43 PM by DFlaming
;===============================================================================================
SetConsole ("Hide")

;Read in path of new KIXFORMS.DLL file
If Exist("@SCRIPTDIR\KIXFORMS.DLL")
   $NewKixFormsFile = "@SCRIPTDIR\KIXFORMS.DLL"
Else
   $NewKixFormsFile = "$EXEPath\KIXFORMS.DLL"
EndIf

;Determine Operating System (Win 9x or NT based) and Windows and System folders
If "@INWIN" = "2"
   $Key = "HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\"
   $Value = "SystemRoot"
   $SystemFolder = "System"
Else
   $Key = "HKEY_LOCAL_MACHINE\Software\Microsoft\Windows NT\CurrentVersion\"
   $Value = "SystemRoot"
   $SystemFolder = "System32"
EndIf

$WindowsFolder = ReadValue("$Key","$Value")

;These below three lines are needed for the compilation process.  They tell the compiler where my KIXFORMS.DLL is located.
;<META>
;<ADDFILE>C:\Documents and Settings\Dean Flaming\Desktop\Kix Scripts\kixforms.dll</ADDFILE>
;</META>

;Lookup KIXFORMS.DLL Class IDs to determine if it is already registered
$KixFormsKey1 = "HKEY_CLASSES_ROOT\CLSID\{F89DF848-618A-46F9-8A1C-396EA442BDD3}\"
$KixFormsKey2 = "HKEY_CLASSES_ROOT\TypeLib\{C8DCCD39-471D-4AFD-8EA2-89604A9C6252}\"

$KixFormsKeyName1 = EnumKey($KixFormsKey1,0)
If @ERROR <> 0 GoTo CheckDLL EndIf

$KixFormsKeyName2 = EnumKey($KixFormsKey2,0)
If @ERROR <> 0 GoTo CheckDLL EndIf

;Read in path of existing KIXFORMS.DLL file
:CurrentKF
$CurrentKixFormsFile = ReadValue("$KixFormsKey1\InprocServer32","")

;Get File Versions of both new and existing KIXFORMS.DLL files
$KixFormsVer1 = GetFileVersion("$NewKixFormsFile")
$KixFormsVer2 = GetFileVersion("$CurrentKixFormsFile")

;Compare version numbers of new and existing KIXFORMS.DLL files
If $KixFormsVer1 <> $KixFormsVer2
   ;Ask user to upgrade to newer version of KIXFORMS.DLL file
   $Nul=MessageBox("A newer version of KIXFORMS is available.  Do you wish to update your version of KIXFORMS?","KIXFORMS Update",35)
   If @ERROR = 6
      ;Update to new KIXFORMS.DLL file
      Copy "$NewKixFormsFile" "$CurrentKixFormsFile" /H
   EndIf
   If @ERROR = 7 GoTo KFDone EndIf
   If @ERROR = 2 GoTo TheEnd EndIf
EndIf

;At this point either user has an updated KIXFORMS.DLL, has updated, or does not wish to update.
;Process will now Exit.
GoTo KFDone


;Check to see if user wants to install KIXFORMS
:CheckDLL
$Nul=MessageBox("Your system does not have KIXFORMS installed and/or properly registered.@CRLF@CRLFWould you like to setup KIXFORMS on your system?@CRLF@CRLFNote:   You will not be able to run programs which make use of KIXFORMS unless it is installed!","KIXFORMS Setup",4131)
If @ERROR = 2 Exit EndIf
If @ERROR = 7
   $Nul=MessageBox("The KIXFORMS.DLL file is not installed nor correctly registered on this system!@CRLF@CRLFYou will not be able to use any programs which make use of KIXFORMS!","KIXFORMS ERROR",4112)
   GoTo TheEnd
EndIf
If @ERROR = 6
   ;Copy KIXFORMS.DLL to the Windows folder
   Copy "$NewKixFormsFile" "$WindowsFolder\KIXFORMS.DLL" /H
   If NOT Exist("$WindowsFolder\KIXFORMS.DLL")
      $Nul=MessageBox("The system could not find KIXFORMS.DLL in either in $EXEPath or in @SCRIPTDIR to copy into $WindowsFolder!@CRLF@CRLFWould you like to retry the copy?","COPY ERROR!",19)
      If @Error = 2 GoTo Exit EndIf
      If @Error = 7
         $Nul=MessageBox("The KIXFORMS.DLL file is not installed nor correctly registered on this system!@CRLF@CRLFYou will not be able to use any programs which make use of KIXFORMS!","KIXFORMS ERROR",4112)
         GoTo TheEnd
      EndIf
      If @ERROR = 6 GoTo CheckDLL EndIf
   EndIf
   ;Register the KIXFORMS.DLL file to the Windows OS
   Shell '$WindowsFolder\$SystemFolder\REGSVR32.EXE /s $WindowsFolder\KIXFORMS.DLL'
EndIf

:KFDone

:TheEnd
Exit

_________________
Good Luck,

-Dean F.
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    KiXforms Forum Index -> Script Archive All times are GMT
Page 1 of 1

 
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