#172137 - 2006-12-28 09:30 PM
MY SCRIPT WONT RUN.........PLEASE HELP
|
selormquarshie
Getting the hang of it
Registered: 2006-12-24
Posts: 85
|
Ok so finally i'm able to get something going here...what this script does is to install adobereader 8 and uninstalls all previous versions on all computers. it doesn't seem to run.please help........
Gosub ChkInstaller Gosub MSIparam
If Not Exist ("C:\Program Files\Adobe 8.0") MessageBox("Installing Adobe Reader 8.0","ESI International",,2) Shell '%systemroot%\system32\msiexec.exe /qb!- /i"\\william\admin\users\adobereader\8\AdobeReader 8.0.msi"' WriteValue ("HKEY_LOCAL_MACHINE\SOFTWARE\Adobe\Acrobat Reader\8.0\AdobeViewer\", "EULA", "1", "REG_DWord")
;--------------------------------------------------------------------------------------------------------------
:UNINSTAR6 ; Purpose: To uninstall AdobeReader 6.x Dim $uninst,$leftpart,$rightpart ; Read Registry key to determine in AR 6 is installed $uninst=ReadValue("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\Adobe Acrobat 6.0","UninstallString") If $uninst<>"" If Exist ("C:\Program Files\Adobe\Acrobat 6.0\Acrobat\Acrobat.exe") Exit EndIf ;Acrobat 6 detected, uninstall. Parse string, add '-y' For quiet mode $leftpart=Left($uninst,InStr($uninst,"-f")-2) $rightpart=Right($uninst,Len($uninst)-InStr($uninst,"-f")+1) $uninst=$leftpart+" -y -a -x "+$rightpart Shell $uninst
;==============================================================================
:UNINSTAR7 ; Purpose: To uninstall AdobeReader 7.x Dim $uninst,$leftpart,$rightpart ; Read Registry key to determine in AR 7 is installed $uninst=ReadValue("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\Adobe Acrobat 7.0","UninstallString") If $uninst<>"" If Exist ("C:\Program Files\Adobe\Acrobat 7.0\Acrobat\Acrobat.exe") Exit EndIf ; Acrobat 7 detected, uninstall. Parse string, add '-y' for quiet mode $leftpart=Left($uninst,InStr($uninst,"-f")-2) $rightpart=Right($uninst,Len($uninst)-InStr($uninst,"-f")+1) $uninst=$leftpart+" -y -a -x "+$rightpart Shell $uninst
|
Top
|
|
|
|
#172139 - 2006-12-28 10:09 PM
Re: MY SCRIPT WONT RUN.........PLEASE HELP
[Re: selormquarshie]
|
eriqjaffe
Hey THIS is FUN
Registered: 2004-06-24
Posts: 214
Loc: Arlington Heights, IL USA
|
This bit here:
$uninst=ReadValue("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\Adobe Acrobat 7.0","UninstallString")
If $uninst<>""
If Exist ("C:\Program Files\Adobe\Acrobat 7.0\Acrobat\Acrobat.exe") Exit EndIf ...is missing an "endif"
If I'm reading that right, also, you're exiting the gosub if Acrobat.exe exists before it ever gets uninstalled.
$uninst=ReadValue("HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\Adobe Acrobat 7.0","UninstallString")
If $uninst <> ""
If Exist("C:\Program Files\Adobe\Acrobat 7.0\Acrobat\Acrobat.exe")
<here is where you'd perform the uninstall>
EndIf
EndIf ...seems more like the ticket.
|
Top
|
|
|
|
#172141 - 2006-12-28 10:31 PM
Re: MY SCRIPT WONT RUN.........PLEASE HELP
[Re: eriqjaffe]
|
selormquarshie
Getting the hang of it
Registered: 2006-12-24
Posts: 85
|
how about this new code........... ;Gosub ChkInstaller ;Gosub MSIparam
If Not Exist ("C:\Program Files\Adobe 8.0") MessageBox("Installing Adobe Reader 8.0","ESI International",,2) Shell '%systemroot%\system32\msiexec.exe /qb!- /i"\\william\admin\users\adobereader\8\AdobeReader 8.0.msi"' WriteValue ("HKEY_LOCAL_MACHINE\SOFTWARE\Adobe\Acrobat Reader\8.0\AdobeViewer\", "EULA", "1", "REG_DWord")
;--------------------------------------------------------------------------------------------------------------
:UNINSTAR6 ; Purpose: To uninstall AdobeReader 6.x Dim $uninst,$leftpart,$rightpart ; Read Registry key to determine in AR 6 is installed $uninst=ReadValue("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\Adobe Acrobat 6.0","UninstallString") If $uninst<>"" If Exist ("C:\Program Files\Adobe\Acrobat 6.0\Acrobat\Acrobat.exe") ;Acrobat 6 detected, uninstall. Parse string, add '-y' For quiet mode $leftpart=Left($uninst,InStr($uninst,"-f")-2) $rightpart=Right($uninst,Len($uninst)-InStr($uninst,"-f")+1) $uninst=$leftpart+" -y -a -x "+$rightpart Shell $uninst
;==============================================================================
:UNINSTAR7 ; Purpose: To uninstall AdobeReader 7.x Dim $uninst,$leftpart,$rightpart ; Read Registry key to determine in AR 7 is installed $uninst=ReadValue("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\Adobe Acrobat 7.0","UninstallString") If $uninst<>"" If Exist ("C:\Program Files\Adobe\Acrobat 7.0\Acrobat\Acrobat.exe") Exit ; Acrobat 7 detected, uninstall. Parse string, add '-y' for quiet mode $leftpart=Left($uninst,InStr($uninst,"-f")-2) $rightpart=Right($uninst,Len($uninst)-InStr($uninst,"-f")+1) $uninst=$leftpart+" -y -a -x "+$rightpart Shell $uninst
EndIf
|
Top
|
|
|
|
#172146 - 2006-12-29 12:01 AM
Re: MY SCRIPT WONT RUN.........PLEASE HELP
[Re: selormquarshie]
|
eriqjaffe
Hey THIS is FUN
Registered: 2004-06-24
Posts: 214
Loc: Arlington Heights, IL USA
|
You're still missing endif's, there has to be one for each "if". It also appears as if you're still exiting the subroutines before you shell out to the uninstaller...
Another thing I just noticed...your code references "ChkInstaller" and "MSIParam", but I don't see where those are.
Structurally, I think something like this would make more sense:
1) Check for Reader 6, uninstall it if it's there. 2) Check for Reader 7, uninstall it if it's there. 3) Install Reader 8.
Really, there's no need for GOSUBs at all, since that would work just fine if you did it as a linear sequence...besides, GOTO and GOSUB generally aren't considered best practice 'round these parts.
|
Top
|
|
|
|
#172147 - 2006-12-29 12:38 AM
Re: MY SCRIPT WONT RUN.........PLEASE HELP
[Re: selormquarshie]
|
NTDOC
Administrator
Registered: 2000-07-28
Posts: 11623
Loc: CA
|
Hello selormquarshie and welcome to the board.
When you registered you were presented with some information on how to use the board and how to post. Please take a few moments and read this FAQ on how to post.
You should post your code within the CODE TAGS to preserve the formatting and make it easier for others to read your code and assist you better.
The Post/Reply Formatting Box and How to use it http://www.kixtart.org/forums/ubbthreads.php?ubb=showflat&Number=171901
Thanks guy.
.
|
Top
|
|
|
|
#172158 - 2006-12-29 09:46 AM
Re: MY SCRIPT WONT RUN.........PLEASE HELP
[Re: Witto]
|
Mart
KiX Supporter
Registered: 2002-03-27
Posts: 4672
Loc: The Netherlands
|
Not tested but this rewtite of the code might work. No ugly GoSub's and stuff.
Break on
$key = "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\"
$ar6 = ReadValue($key + "Adobe Acrobat 6.0","UninstallString")
$ar7 = ReadValue($key + "Adobe Acrobat 7.0","UninstallString")
$ar8 = Exist("C:\Program Files\Adobe\Reader 8.0\Reader\AcroRd32.exe")
;
If $ar6 <> ""
;Acrobat 6 detected, uninstall. Parse string, add '-y' For quiet mode
$leftpart=Left($uninst,InStr($uninst,"-f")-2)
$rightpart=Right($uninst,Len($uninst)-InStr($uninst,"-f")+1)
$uninst=$leftpart+" -y -a -x "+$rightpart
Shell $uninst
EndIf
If $ar7 <> ""
; Acrobat 7 detected, uninstall. Parse string, add '-y' for quiet mode
$leftpart=Left($uninst,InStr($uninst,"-f")-2)
$rightpart=Right($uninst,Len($uninst)-InStr($uninst,"-f")+1)
$uninst=$leftpart+" -y -a -x "+$rightpart
Shell $uninst
EndIf
If $ar8 <> "1"
MessageBox("Installing Adobe Reader 8.0","ESI International",,2)
Shell '%systemroot%\system32\msiexec.exe /qb!- /i"\\william\admin\users\adobereader\8\AdobeReader 8.0.msi"'
WriteValue ("HKLM\SOFTWARE\Adobe\Acrobat Reader\8.0\AdobeViewer\", "EULA", "1", "REG_DWord")
EndIf
_________________________
Mart
- Chuck Norris once sold ebay to ebay on ebay.
|
Top
|
|
|
|
#172183 - 2006-12-29 06:04 PM
Re: MY SCRIPT WONT RUN.........PLEASE HELP
[Re: Mart]
|
selormquarshie
Getting the hang of it
Registered: 2006-12-24
Posts: 85
|
good call guys. i will look into this further. happy new year!!!
|
Top
|
|
|
|
#172206 - 2006-12-29 11:41 PM
Re: MY SCRIPT WONT RUN.........PLEASE HELP
[Re: selormquarshie]
|
Witto
MM club member
Registered: 2004-09-29
Posts: 1828
Loc: Belgium
|
Take a look at the Adobe Customization Wizard 8 to create a MST file
|
Top
|
|
|
|
Moderator: Glenn Barnas, NTDOC, Arend_, Jochen, Radimus, Allen, ShaneEP, Ruud van Velsen, Mart
|
1 registered
(Allen)
and 382 anonymous users online.
|
|
|