#132462 - 2005-01-14 02:21 PM
Call middle of second script
|
rainvi
Lurker
Registered: 2005-01-14
Posts: 1
|
New to KiXtart and using this as my starter script. I want to install Acrobat Reader 7 on the computers and I am trying to think ahead of other software rollouts by seperating the code. script1 will run a system check on all computers and then calls script2 script2 will check missing installs and configurations. script3 will run the specific software install. Question: How do you call the middle of the second script?
script2: Gosub Acrobat goto end :Acrobat DIM $uninst, $leftpart, $rightpart
;Read Registry key to determine if AR4 is installed $uninst=ReadValue("KLM\Software....", "UninstallString") if $uninst<>"" call \\server\kix\acrobat7.kix :ar4_detected (<-this isn't working) else call \\server\kix\acrobat7.kix :Install enfif RETURN
script3: Gosub ar4_detected Gosub MSIparam Gosub Install {code... } Thanks in advance
|
|
Top
|
|
|
|
#132464 - 2005-01-14 02:30 PM
Re: Call middle of second script
|
AzzerShaw
Seasoned Scripter
  
Registered: 2003-02-20
Posts: 510
Loc: Cheltenham, England
|
OKay think ive worked out now what you mean
try something like this
Code:
script2:
Gosub Acrobat
GoTo end
:Acrobat
Dim $uninst, $leftpart, $rightpart
;Read Registry key to determine if AR4 is installed
$uninst=ReadValue("KLM\Software....", "UninstallString")
If $uninst<>""
WriteProfileString ("c:\temp\Yes.txt","Yes","Yes","yes")
Call \\server\kix\acrobat7.kix
Else
WriteProfileString ("c:\temp\No.txt","No","No","No")
Call \\server\kix\acrobat7.kix
endif
Return
script3:
If exist ("c:\temp\yes.txt")
Gosub ar4_detected
Endif
If exist ("c:\temp\No.txt")
Gosub MSIparam
Endif
Gosub Install
{code...
}
del
Something like that
Aaron
Edited by AzzerShaw (2005-01-14 02:44 PM)
_________________________
If at first you don't succeed, try again. Then quit. There's no use being a damn fool about it. - W.C Fields
|
|
Top
|
|
|
|
#132465 - 2005-01-14 02:43 PM
Re: Call middle of second script
|
Richard H.
Administrator
   
Registered: 2000-01-24
Posts: 4946
Loc: Leatherhead, Surrey, UK
|
There are ways to do what you want, but it's not a very good design. Better is:
- Make the installs / uninstalls functions.
- Call the script to load the function.
- Call the functions when you need them
|
|
Top
|
|
|
|
#132466 - 2005-01-14 03:06 PM
Re: Call middle of second script
|
Richard H.
Administrator
   
Registered: 2000-01-24
Posts: 4946
Loc: Leatherhead, Surrey, UK
|
Here is an example.
Take the following and save it as Acrobat.udf: Code:
; Acrobat check UDF Function udfAcrobat_Has_AR4() Dim $sKey,$sEntry $sKey="HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\Adobe Acrobat 4.0" $sEntry="UninstallString" $sKey $udfAcrobat_Has_AR4=(ReadValue($sKey,$sEntry)<>"") Exit 0 EndFunction ; Acrobat install UDF Function udfAcrobat_Install_AR4() ; Do install / uninstall ; ; If INSTALL_WAS_SUCCESSFUL $udfAcrobat_Install_AR4=0 Else $udfAcrobat_Install_AR4=1 EndIf Exit $udfAcrobat_Install_AR4 EndFunction
You can now load up the functions and call them individually in your main script: Code:
; Load Acrobat functions. CALL "\\SERVER\Kix\Acrobat7.udf" ; Acrobat install check. If udfAcrobat_Has_AR4() ; Do something "AR4 installed - no action necessary"+@CRLF Else ; AR4 not installed - must install. If udfAcrobat_Install_AR4() "Failed to install AR4!"+@CRLF Else "AR4 Installed ok."+@CRLF EndIf EndIf
|
|
Top
|
|
|
|
Moderator: Jochen, Allen, Radimus, Glenn Barnas, ShaneEP, Ruud van Velsen, Arend_, Mart
|
0 registered
and 302 anonymous users online.
|
|
|