Page 1 of 1 1
Topic Options
#195376 - 2009-08-10 05:57 PM For Next Code
KIXKicks Offline
Starting to like KiXtart

Registered: 2002-07-26
Posts: 177
Loc: Vancouver, WA
I wrote some code to remove older version of Java from users computers and it works rather well. I find that it takes up a considerable amount of space and I would like to optimize it down into an array or something...

 Code:
                $SUNJAVA150_18CHECKKEY=KEYEXIST("$HKLM\$SMWCV\UNINSTALL\{3248F0A8-6813-11D6-A77B-00B0D0150180}")
		IF $SUNJAVA150_18CHECKKEY
			? "Sun Java 1.5.0_18 Exists...Uninstalling" ?
			$GROUPBOXSTATUSLABEL.TEXT="Uninstalling Sun Java 1.5.0_18 Update..."
			SLEEP 5
			SHELL '%COMSPEC% /C MSIEXEC /X{3248F0A8-6813-11D6-A77B-00B0D0150180} /QR'
			SLEEP 5
			$EXITLOGINSCRIPT="YES"
		ELSE
			? "Sun Java 1.5.0_18 Is Not Installed...Skipping Uninstall" ?
		ENDIF

		$SUNJAVA150_17CHECKKEY=KEYEXIST("$HKLM\$SMWCV\UNINSTALL\{3248F0A8-6813-11D6-A77B-00B0D0150170}")
		IF $SUNJAVA150_17CHECKKEY
			? "Sun Java 1.5.0_17 Exists...Uninstalling" ?
			$GROUPBOXSTATUSLABEL.TEXT="Uninstalling Sun Java 1.5.0_17 Update..."
			SLEEP 5
			SHELL '%COMSPEC% /C MSIEXEC /X{3248F0A8-6813-11D6-A77B-00B0D0150170} /QR'
			SLEEP 5
			$EXITLOGINSCRIPT="YES"
		ELSE
			? "Sun Java 1.5.0_17 Is Not Installed...Skipping Uninstall" ?
		ENDIF

		$SUNJAVA150_16CHECKKEY=KEYEXIST("$HKLM\$SMWCV\UNINSTALL\{3248F0A8-6813-11D6-A77B-00B0D0150160}")
		IF $SUNJAVA150_16CHECKKEY
			? "Sun Java 1.5.0_16 Exists...Uninstalling" ?
			$GROUPBOXSTATUSLABEL.TEXT="Uninstalling Sun Java 1.5.0_16 Update..."
			SLEEP 5
			SHELL '%COMSPEC% /C MSIEXEC /X{3248F0A8-6813-11D6-A77B-00B0D0150160} /QR'
			SLEEP 5
			$EXITLOGINSCRIPT="YES"
		ELSE
			? "Sun Java 1.5.0_16 Is Not Installed...Skipping Uninstall" ?
		ENDIF

Top
#195377 - 2009-08-10 06:28 PM Re: For Next Code [Re: KIXKicks]
eriqjaffe Offline
Hey THIS is FUN

Registered: 2004-06-24
Posts: 214
Loc: Arlington Heights, IL USA
Something like this?

 Code:
$Versions = "1.5.0_18,{3248F0A8-6813-11D6-A77B-00B0D0150180}","1.5.0_17,{3248F0A8-6813-11D6-A77B-00B0D0150170}","1.5.0_16,{3248F0A8-6813-11D6-A77B-00B0D0150160}"

for each $Version in $Versions
    $tmp = split($Version,",")
    if KEYEXIST("$HKLM\$SMWCV\UNINSTALL\"+$tmp[1])
        ? "Sun Java "+$tmp[0]+" Exists...uninstalling" ?
        $GROUPBOXSTATUSLABEL.TEXT="Uninstalling "+$tmp[0]+" Update..."
        Sleep 5
        SHELL "%COMSPEC% /C MSIEXEC /X"+$tmp[1]+" /QR"
        Sleep 5
        $EXITLOGINSCRIPT="YES"
    else
        ? "Sun Java "+$tmp[0]+" is not installed...skipping uninstall" ?
    endif
next


Edited by eriqjaffe (2009-08-10 06:31 PM)

Top
#195381 - 2009-08-11 12:45 AM Re: For Next Code [Re: eriqjaffe]
KIXKicks Offline
Starting to like KiXtart

Registered: 2002-07-26
Posts: 177
Loc: Vancouver, WA
Yes, thanks.
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
0 registered and 1260 anonymous users online.
Newest Members
Viginette, ManuvdWielNL, Sir_Barrington, batdk82, StuTheCoder
17888 Registered Users

Generated in 0.278 seconds in which 0.218 seconds were spent on a total of 13 queries. Zlib compression enabled.

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