Jump to content
Sign in to follow this  
RBrown1375

Java Upgrade

Recommended Posts

RBrown1375

Thank you for responding,

I have hit a wall and it seems so simple, but I just can't get it. I have to run a Java update. The script needs to look in the registry, see version 7.x and then do something. If the RegRead returns a value of 1.7.0_15 then stop.

If RegRead returns any other version 7, then continue on and run the install. Everything else in my code is working fine, except being able to identify the product code and do the next thing: Close or install.

Here is part of my code:

#RequireAdmin
Local $a = "C:\Windows\Temp\"
Dim $var2 = "1.7.0_15"
Local $b = "C:\Users\"
Local $Sun = "C:\Users\" & @UserName & "\AppData\LocalLow\Sun\Java\Deployment\"
Local $Sun2 = "C:\Users\" & @UserName & "\AppData\LocalLow\Sun\Java\Deployment\security\"
Local $Sun3 = "C:\Users\" & @UserName & "\AppData\LocalLow\Sun\Java\Deployment\tmp\si"

;File copy section: Each Application is taken from the source and copied to the folders created

;If $a = True Then FileInstall("E:\JAVA\JRE7_15\jre-7u15-windows-i586.exe", "C:\Windows\Temp\jre-7u15-windows-i586.exe")

;Sleep(5000)
;Registry lookup for Java installation
Local $var = RegRead("HKEY_LOCAL_MACHINE\SOFTWARE\JavaSoft\Java Runtime Environment\", "Java7FamilyVersion")
Sleep(5000)
If $var = $var2 Then
MsgBox(4096, "I see It:", $var)
EndIf
Else
If Not $var2 = $var Then
MsgBox(4096, "It Ain't Here:", $var)

  RunWait(@WindowsDir & "\Temp\jre-7u15-windows-i586.exe /s")
  Sleep(10000)
;MsgBox(4096, "I see It:", $var)

EndIf

everything below this works fine and the install file works fine as well. I placed message boxes in the code so I could track the code and they will be removed later. Any ideas would be great.

Cheers

Share this post


Link to post
Share on other sites
Colyn1337

Are you running on x86 arch or x64?

I ask because x64 regread()'s need to be done as HKLM64 and not HKLM

EDIT:

Also, print out the @error flag after the regread...

IF @error Then consolewrite("Error " & @error & " found!" & @LF)

Edited by Colyn1337

Share this post


Link to post
Share on other sites
RBrown1375

Sorry I did leave that out. This will target x86 systems only Win 7 and XP.

I'll try your error code.

Edited by RBrown1375

Share this post


Link to post
Share on other sites
Nessie

Tested and working well:

#RequireAdmin
Local $a = "C:\Windows\Temp\"
Dim $var2 = "1.7.0_17"
Local $b = "C:\Users\"
Local $Sun = "C:\Users\" & @UserName & "\AppData\LocalLow\Sun\Java\Deployment\"
Local $Sun2 = "C:\Users\" & @UserName & "\AppData\LocalLow\Sun\Java\Deployment\security\"
Local $Sun3 = "C:\Users\" & @UserName & "\AppData\LocalLow\Sun\Java\Deployment\tmp\si"

;File copy section: Each Application is taken from the source and copied to the folders created

;If $a = True Then FileInstall("E:\JAVA\JRE7_15\jre-7u15-windows-i586.exe", "C:\Windows\Temp\jre-7u15-windows-i586.exe")

;Sleep(5000)
;Registry lookup for Java installation
Local $var = RegRead("HKEY_LOCAL_MACHINE\SOFTWARE\JavaSoft\Java Runtime Environment\", "Java7FamilyVersion")
MsgBox(0, "", $var)
Sleep(5000)
If $var = $var2 Then
MsgBox(4096, "I see It:", $var)
Else
MsgBox(4096, "It Ain't Here:", $var)

RunWait(@WindowsDir & "\Temp\jre-7u15-windows-i586.exe /s")
Sleep(10000)
EndIf

Hi!


My UDF: NetInfo UDF Play with your network, check your download/upload speed and much more! YTAPI Easy to use YouTube API, now you can easy retrive all needed info from a video. NavInfo Check if a specific browser is installed and retrive other usefull information. YWeather Easy to use Yahoo Weather API, now you can easily retrive details about the weather in a specific region. No-IP UDF Easily update your no-ip hostname(s).

My Script: Wallpaper Changer Change you wallpaper dinamically, you can also download your wallpaper from your website and share it with all!   My Snippet: _ImageSaveToBMPConvert an image to bmp format. _SciteGOTO Open a file in SciTE at specific fileline. _FileToHex Show the hex code of a specified file

Share this post


Link to post
Share on other sites
RBrown1375

Thank You for the response. I'll work on this now and let you know. :thumbsup:

Share this post


Link to post
Share on other sites
RBrown1375

Nessie,

Your script additions worked great. Thank you!!!!

Cheers :geek:

Share this post


Link to post
Share on other sites
Nessie

Glad to help you, no problem :)


My UDF: NetInfo UDF Play with your network, check your download/upload speed and much more! YTAPI Easy to use YouTube API, now you can easy retrive all needed info from a video. NavInfo Check if a specific browser is installed and retrive other usefull information. YWeather Easy to use Yahoo Weather API, now you can easily retrive details about the weather in a specific region. No-IP UDF Easily update your no-ip hostname(s).

My Script: Wallpaper Changer Change you wallpaper dinamically, you can also download your wallpaper from your website and share it with all!   My Snippet: _ImageSaveToBMPConvert an image to bmp format. _SciteGOTO Open a file in SciTE at specific fileline. _FileToHex Show the hex code of a specified file

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

  • Similar Content

    • CarlD
      By CarlD
      Is there a reliable way to ensure that data assigned to variables in a script is overwritten or deleted when the script exits? I have scripts that encrypt/decrypt data and would like to ensure, if possible, that the encryption keys and decrypted data do not stay in memory after the script exits. Thanks.
    • Skeletor
      By Skeletor
      Hi Guys,
      Is it possible to get a variable on your For..Next loop? 
       
      Local $Lines1 = _FileCountLines(C:\temp\test.txt) Local $linesToCount2 = $Lines1 + 2 $var = Number($linesToCount2) For $count = 1 To _FileCountLines($FileRead2) Step 1 For $i = $var To $count Next ;Code does stuff here Next Somehow my code doesn't work even though I thought I could convert the variable to a Integer / Number.
      This code I posted above does not move to the next value.
      But the code below does... why is that?
      For $count = 1 To _FileCountLines($FileRead2) Step 1 For $i = 2 To $count Next ;Code does stuff here Next  
      Why is the For loop resetting itself?
      Is it because the program does not cache the variable and needs to keep on acquiring this variable each time?
      If so , how would you make this variable static?

       
    • ShakeelAhmad
      By ShakeelAhmad
      I've to upload different number of photos online in different assignments. There is a problem that all photos cannot be selected at once to upload. I have to choose and upload photos one by one. For this purpose I have made a script to automate whatever I have to do manually for choosing and uploading photos one by one.
      Please see my script below and check the last "MouseClick" command. This command clicks the button to choose and upload next photo. The problem I'm facing is; the last "MouseClick" works 1 step extra when all photos have been selected and uploaded. I mean if 7 photos are to be uploaded, this command opens the box from where next photo is selected and uploaded then it again opens the box and next photo is choosen and so on.... when last photo is selected and uploaded, this button once again opens the box. When all photos are uploaded, it should not click the button to select next photo. Please suggest how can I resolve this issue.
      #include <AutoItConstants.au3> Sleep(200) HotKeySet("{ESC}","Quit") ;Press ESC key to quit Send("{ALT DOWN}") Send("{TAB}") Send("{ALT UP}") Sleep(200) Local $photos = InputBox("Question", "How many photos to upload?", "#", "", _ - 1, -1, 0, 0) ; How many photos to upload Local $selector = 0 While $photos <> $selector MouseClick("Left", 281, 238, 1) ; mouse click on very first photo in the box. if $selector = 0 Then Send("{ENTER}") ; for selecting very first photo from "open" window. Sleep(800) Else sleep(200) Send("{RIGHT " & $selector & "}") ; for selecting 2nd to onward photos from "open" window. sleep(1000) Send("{ENTER}") sleep(1000) EndIf MouseClick("Left", 495, 198, 1) ; for clicking a button to choose next photo to upload $selector = $selector + 1 WEnd Beep(1500, 300) ; beep when all photos uploaded Exit Regards,
       
      Shakeel
    • Gringo
      By Gringo
      Hi,
      I'm trying to create a shortcut playing with variables but I can't figure out what's wrong
      I got 2 variables joined in one with for instance
      Local $path = FileOpenDialog($message, "C:" & "", "Select your executable (*.exe)", 1 + 4)
      Local $elev = 'c:\windows\System32\cmd.exe /c start "runhigh" /high '
      $target = $elev & $path
      FileCreateShortcut($target, @DesktopCommonDir & "\linked.lnk", StringLeft($target,StringInStr($target,"\",0,-1)) , "" , "" , "c:\i.ico")
      The problem is that a shortcut is created but instead of the target area I got the start in filled with my variable
      My second problem is that when I do a shell execute of the result of $target = $elev & $path, Note that if I do a batch with the variable written manually, it's working.
    • user4157124
      By user4157124
      As they're opinion-based to some degree; how are AutoIt's best practices decided and do suggestions get considered?
      Some suggestions :
      For...To...Step...Next -loop variable-naming like $iN ($i1, $i2, etc.) : conforms to recommended naming convention, identifies level (albeit inverted to ExitLoop and ContinueLoop's convention) and enables SciTE selection-highlighting (requires minimum of 3 characters). Minimize logic in global scope, separate data & settings from logic, use of vertical space, project organization (folder structure, resource- and include file management). Example (loop variable-naming, minimizing logic in global scope and separation of settings from logic) :
      #include <Array.au3> Global Enum $RANDOM_RETURNFLOAT, _ $RANDOM_RETURNINTEGER Global Enum $EXITCODE_NONE Global Const $g_sChar0 = '-' Global Const $g_sChar1 = '+' Global Const $g_iAmountX = 10 Global Const $g_iAmountY = $g_iAmountX Main() Func Main() Local $aArray[$g_iAmountY][$g_iAmountX] For $i1 = 0 To $g_iAmountY - 1 For $i2 = 0 To $g_iAmountX - 1 $aArray[$i1][$i2] = Random(0, 1, $RANDOM_RETURNINTEGER) ? $g_sChar1 : $g_sChar0 Next Next _ArrayDisplay($aArray) Exit $EXITCODE_NONE EndFunc Example (project organization) :
      + project_folder + bak [backup files] + bin [distributed binaries and dependencies] + inc [non-standard include files] + res [resource files (icons, file+install files, etc.)] + usr [configuration files, databases, etc.] - script.au3 - script.exe Example (use of vertical space) :
      Func _DigitalRoot($iNum) Local $sNum = '' Local $aNum While $iNum > 9 $sNum = String($iNum) $aNum = StringSplit($sNum, '') $iNum = 0 For $i1 = 1 To $aNum[0] $iNum += Int($aNum[$i1]) Next WEnd Return $iNum EndFunc
×