Jump to content

Automating Java RE install


JHeaton
 Share

Recommended Posts

Hi everyone :)

I've been playing around with AutoIt for a couple of days now and I'm starting to get the hang of it. Already got a script that installs Acrobat 8 perfectly and does the after-install stuff we usually do manually here at work. However, when it comes to installing the Java Runtime Environment (both versions 1.4.2 and 6) the script doesn't seem to do anything once it gets to the licence screen. Any keys sent, requests for text from the window etc. have no effect and I'm not sure why. Here's the code I'm using for Version 6:

;Install Java 6
Run("T:\Computer Installation\Software Install\01 ALL\Java Virtual\Java 6\jre-6-windows-i586.exe")
WinWaitActive("Open File - Security Warning")
    Send("!r")
WinWaitActive("Java (TM) SE Runtime Environment 6 Update 1 - License")
    Send("!a")
WinWaitActive("Java (TM) SE Runtime Environment 6 Update 1 - Complete")
    Send("!f")

I went about it in roughly the same way as the one I did for Acrobat but this just doesn't work. I'm hoping to make one script to go through our whole install process. Any help is appreciated.

Kind regards,

Joel.

Edited by JHeaton
Link to comment
Share on other sites

You could use one of these options:

java.exe /passive or /quite
or better
Run("T:\Computer Installation\Software Install\01 ALL\Java Virtual\Java 6\jre-6-windows-i586.exe" & " /passive")
Note that at " /passive" there is a space.

It's just for java installation. :)

Edited by Fantastic
Link to comment
Share on other sites

Thanks, I'll give that a try, although it doesn't seem to be just that installation. I progressed on to the next application and came up with suffered from the same problem. I'm at a loss, really. It's odd. If I run the script, it sits and waits on the first screen, however if I cancel the install and restart it manually (with the script still running in the background) it does everything it's supposed to. It's as if the window doesn't register as active if the script starts it... :/

Link to comment
Share on other sites

Make sure that the windows that you are sending the keys is active and then send the keys.

Like:

WinActivate("Open File - Security Warning")

Just play around with it and you will get it working.

Also you could use:

ControlSend ( "title", "text", controlID, "string" [, flag] )

which as I remember doesn't need the window to be active.

Have some fun with it :)

Link to comment
Share on other sites

Sorry to bump this, but I'm still struggling. I just can't seem to manipulate these windows and it doesn't seem to be just the Java installers, but any piece of software with that installer type. The one that Adobe use for Acrobat Reader and a couple of others work perfectly, but these are just really awkward.

Has anyone got this working without opting for a quiet install?

Thanks.

Link to comment
Share on other sites

Hi,

try command line parameters for java installation.

Documentation and another usefull link see here:

http://www.appdeploy.com/packages/detail.asp?id=1048

http://forums.sun.com/thread.jspa?threadID=5390797

Example for complete silent installation, no reboot, Internet Explorer and Mozilla Integration:

cmd /c "c:\jre-6u13-windows-i586-p-s.exe /s /v"/qb- REBOOT=ReallySuppress IEXPLORER=1 MOZILLA=1 JAVAUPDATE=0

;-))

Stefan

P.S: Could it be, that you are installing an old version of Java JRE? You should install the latest version!

Edited by 99ojo
Link to comment
Share on other sites

This is what I use to install JRE 1.5u6 at work.

#include <Misc.au3>
_Singleton("AutoIt Automated Script")
Opt("MustDeclareVars", 1)
HotKeySet("{PAUSE}", "_Close")
Func _Close()
    Exit
EndFunc
Func _ControlClick($title, $text, $controlID)
    WinWait($title, $text)
    WinActivate($title, $text)
    Sleep(200)
    ControlClick($title, $text, $controlID)
EndFunc

Global $ininame = "_install_jre_1-5_update_6.ini"
Global $section = "Options"
If Not FileExists($ininame) Then
    IniWrite($ininame, $section, "Path", ".\JRE 1.5 Update 6\jre-1_5_0_06-windows-i586-p.exe")
    Exit
EndIf

Global $exec = IniRead($ininame, $section, "Path", ".\JRE 1.5 Update 6\jre-1_5_0_06-windows-i586-p.exe")

Run($exec)
If Not @error Then
    _ControlClick("J2SE Runtime Environment 5.0 Update 6 - License", "", "[TEXT:Typical setup - All recommended features will be installed.]")
    _ControlClick("J2SE Runtime Environment 5.0 Update 6 - License", "", "[TEXT:&Accept >]")
    _ControlClick("J2SE Runtime Environment 5.0 Update 6 - Complete", "", "[TEXT:&Finish]")
    WinWaitClose("J2SE Runtime Environment 5.0 Update 6 - Complete")
EndIf

Just alter as needed to use the correct window/button text for your JRE version.

I use the upper section of this script as part of my template for making installation scripts at work. It's not that extensive since it doesn't handle errors or installation problems. Those I still handle manually. This is pretty much for normal successful installs on newly formatted workstations.

Edited by omikron48
Link to comment
Share on other sites

Hi,

try command line parameters for java installation.

Documentation see here:

http://www.appdeploy.com/packages/detail.asp?id=1048

Example for complete silent installation, no reboot, Internet Explorer and Mozilla Integration:

cmd /c "c:\jre-6u13-windows-i586-p-s.exe /s /v"/qb- REBOOT=ReallySuppress IEXPLORER=1 MOZILLA=1 JAVAUPDATE=0

;-))

Stefan

P.S: Could it be, that you are installing an old version of Java JRE? You should install the latest version!

Doing both, actually. We have a single piece of software that won't work without 1.4.2, though none of us can remember what it is. I'll try those parameters, it's starting to look like the only way to do it. It may well be that I'll have to do this for a lot of applications, but if that's the only way to do it, then it will have to do.

Thank you :)

Edit:

This is what I use to install JRE 1.5u6 at work.

#include <Misc.au3>
_Singleton("AutoIt Automated Script")
Opt("MustDeclareVars", 1)
HotKeySet("{PAUSE}", "_Close")
Func _Close()
    Exit
EndFunc
Func _ControlClick($title, $text, $controlID)
    WinWait($title, $text)
    WinActivate($title, $text)
    Sleep(200)
    ControlClick($title, $text, $controlID)
EndFunc

Global $ininame = "_install_jre_1-5_update_6.ini"
Global $section = "Options"
If Not FileExists($ininame) Then
    IniWrite($ininame, $section, "Path", ".\JRE 1.5 Update 6\jre-1_5_0_06-windows-i586-p.exe")
    Exit
EndIf

Global $exec = IniRead($ininame, $section, "Path", ".\JRE 1.5 Update 6\jre-1_5_0_06-windows-i586-p.exe")

Run($exec)
If Not @error Then
    _ControlClick("J2SE Runtime Environment 5.0 Update 6 - License", "", "[TEXT:Typical setup - All recommended features will be installed.]")
    _ControlClick("J2SE Runtime Environment 5.0 Update 6 - License", "", "[TEXT:&Accept >]")
    _ControlClick("J2SE Runtime Environment 5.0 Update 6 - Complete", "", "[TEXT:&Finish]")
    WinWaitClose("J2SE Runtime Environment 5.0 Update 6 - Complete")
EndIf

Just alter as needed to use the correct window/button text for your JRE version.

Ooh, thanks, I'll give that a try ;) Edited by JHeaton
Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...