Page 1 of 1 1
Topic Options
#132462 - 2005-01-14 02:21 PM Call middle of second script
rainvi Offline
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
#132463 - 2005-01-14 02:26 PM Re: Call middle of second script
AzzerShaw Offline
Seasoned Scripter
****

Registered: 2003-02-20
Posts: 510
Loc: Cheltenham, England
Hi,

Ignore that



Edited by AzzerShaw (2005-01-14 02:27 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
#132464 - 2005-01-14 02:30 PM Re: Call middle of second script
AzzerShaw Offline
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 Offline
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 Offline
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
Page 1 of 1 1


Moderator:  Jochen, Allen, Radimus, Glenn Barnas, ShaneEP, Ruud van Velsen, Arend_, Mart 
Hop to:
Shout Box

Who's Online
1 registered (Allen) and 271 anonymous users online.
Newest Members
Sir_Barrington, batdk82, StuTheCoder, M_Moore, BeeEm
17886 Registered Users

Generated in 0.053 seconds in which 0.021 seconds were spent on a total of 12 queries. Zlib compression enabled.

Search the board with:
superb Board Search
or try with google:
Google
Web kixtart.org