Jump to content
Muhammad_Awais_Sharif

how to automate Java Installer

Recommended Posts

Muhammad_Awais_Sharif

Hi

I have Java 8 installer 

I want to automate it's installation process. 

I have found silent installation method but I want to install it using controls clicking like as normal user do 

But I don't find any control using  AutoIt v3 Window Info 

How I can find it's control buttons ?

Thank you :blink:

Share this post


Link to post
Share on other sites
AutoBert

Maybe with

from @junkew

Edited by AutoBert
  • Like 1

Share this post


Link to post
Share on other sites
mLipok

Look for unatentded instalation switches

  • Like 1

Signature beginning:   Wondering who uses AutoIT and what it can be used for ?
* GHAPI UDF - modest begining - comunication with GitHub REST API *
ADO.au3 UDF     POP3.au3 UDF     XML.au3 UDF    How to use IE.au3  UDF with  AutoIt v3.3.14.x  for other useful stuff click the following button

Spoiler

Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind. 

My contribution (my own projects): * Debenu Quick PDF Library - UDF * Debenu PDF Viewer SDK - UDF * Acrobat Reader - ActiveX Viewer * UDF for PDFCreator v1.x.x * XZip - UDF * AppCompatFlags UDF * CrowdinAPI UDF * _WinMergeCompare2Files() * _JavaExceptionAdd() * _IsBeta() * Writing DPI Awareness App - workaround * _AutoIt_RequiredVersion() * Chilkatsoft.au3 UDF * TeamViewer.au3 UDF * JavaManagement UDF * VIES over SOAP * WinSCP UDF * GHAPI UDF - modest begining - comunication with GitHub REST API *

My contribution to others projects or UDF based on  others projects: * _sql.au3 UDF  * POP3.au3 UDF *  RTF Printer - UDF * XML.au3 UDF * ADO.au3 UDF SMTP Mailer UDF *

Useful links: * Forum Rules * Forum etiquette *  Forum Information and FAQs * How to post code on the forum * AutoIt Online Documentation * AutoIt Online Beta Documentation * SciTE4AutoIt3 getting started * Convert text blocks to AutoIt code * Games made in Autoit * Programming related sites * Polish AutoIt Tutorial * DllCall Code Generator * 

Wiki: Expand your knowledge - AutoIt Wiki * Collection of User Defined Functions * How to use HelpFile * Good coding practices in AutoIt * 

IE Related:  * How to use IE.au3  UDF with  AutoIt v3.3.14.x * Why isn't Autoit able to click a Javascript Dialog? * Clicking javascript button with no ID * IE document >> save as MHT file * IETab Switcher (by LarsJ ) * HTML Entities * _IEquerySelectorAll() (by uncommon) * IE in TaskScheduler

I encourage you to read: * Global Vars * Best Coding Practices * Please explain code used in Help file for several File functions * OOP-like approach in AutoIt * UDF-Spec Questions *  EXAMPLE: How To Catch ConsoleWrite() output to a file or to CMD *

"Homo sum; humani nil a me alienum puto" - Publius Terentius Afer
"Program are meant to be read by humans and only incidentally for computers and execute" - Donald Knuth, "The Art of Computer Programming"
:naughty:  :ranting:, be  :) and       \\//_.

Anticipating Errors :  "Any program that accepts data from a user must include code to validate that data before sending it to the data store. You cannot rely on the data store, ...., or even your programming language to notify you of problems. You must check every byte entered by your users, making sure that data is the correct type for its field and that required fields are not empty."

Signature last update: 2018-09-20

Share this post


Link to post
Share on other sites
Muhammad_Awais_Sharif

@junkew  i have followed instructions i have JDk Installed 
 

also run 

jabswitch.exe" /enable


i am not getting other steps 
and when i executed simply spy and pressed ctrl + w it stop working 
i think i have to do something else before it working ?

 

Share this post


Link to post
Share on other sites
Muhammad_Awais_Sharif

windows 10 and jdk 1.8
okay i will search for java screenreader ty :D 

Share this post


Link to post
Share on other sites
pcjunki

you can run the java installer from the windows command line,

jre-8u101-windows-i586.exe /s

 

Share this post


Link to post
Share on other sites
Muhammad_Awais_Sharif

Thank you dear
although i have found this solution 
like this 
first i have to record it's state 

jdk-8u101-nb-8_1-windows-x64.exe --record state.xml

then i can use like this 

jdk-8u101-nb-8_1-windows-x64.exe --silent --state state.xml

Or 
 

<?xml version="1.0" encoding="UTF-8"?><!--
  DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.

  Copyright 1997-2010 Oracle and/or its affiliates. All rights reserved.

  Oracle and Java are registered trademarks of Oracle and/or its affiliates.
  Other names may be trademarks of their respective owners.

  The contents of this file are subject to the terms of either the GNU General Public
  License Version 2 only ("GPL") or the Common Development and Distribution
  License("CDDL") (collectively, the "License"). You may not use this file except in
  compliance with the License. You can obtain a copy of the License at
  http://www.netbeans.org/cddl-gplv2.html or nbbuild/licenses/CDDL-GPL-2-CP. See the
  License for the specific language governing permissions and limitations under the
  License.  When distributing the software, include this License Header Notice in
  each file and include the License file at nbbuild/licenses/CDDL-GPL-2-CP.  Oracle
  designates this particular file as subject to the "Classpath" exception as provided
  by Oracle in the GPL Version 2 section of the License file that accompanied this code.
  If applicable, add the following below the License Header, with the fields enclosed
  by brackets [] replaced by your own identifying information:
  "Portions Copyrighted [year] [name of copyright owner]"
  
  Contributor(s):
  
  The Original Software is NetBeans. The Initial Developer of the Original Software
  is Sun Microsystems, Inc. Portions Copyright 1997-2007 Sun Microsystems, Inc. All
  Rights Reserved.
  
  If you wish your version of this file to be governed by only the CDDL or only the
  GPL Version 2, indicate your decision by adding "[Contributor] elects to include
  this software in this distribution under the [CDDL or GPL Version 2] license." If
  you do not indicate a single choice of license, a recipient has the option to
  distribute your version of this file under either the CDDL, the GPL Version 2 or
  to extend the choice of license to its licensees as provided above. However, if you
  add GPL Version 2 code and therefore, elected the GPL Version 2 license, then the
  option applies only if the new code is made subject to such option by the copyright
  holder.
--><state xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="state-file.xsd">
<components>
        <product platform="windows linux solaris-sparc solaris-x86 macosx-ppc macosx-x86" status="to-be-installed" uid="nb-base" version="8.1.0.0.201510222201">
            <properties>
                <property name="installation.location.windows">C:\Program Files\NetBeans 8.1</property>
                <property name="minimum.jdk.version">1.7.0</property>
                <property name="jdk.location">C:\Program Files\Java\jdk1.8.0_101</property>
                <property name="installation.timestamp">1476539814627</property>
                <property name="start.menu.shortcut.location">all.users</property>
                <property name="installation.location.macosx">$N{install}/NetBeans/NetBeans 8.1.app</property>
                <property name="installation.location">$N{install}/netbeans-8.1</property>
                <property name="desktop.shortcut.location">all.users</property>
                <property name="netbeans.summary.message.text"/>
            </properties>
        </product>
        <product platform="windows-x64" status="to-be-installed" uid="jdk" version="1.8.0.101.1364">
            <properties>
                <property name="jdk.win.installed">true</property>
                <property name="jre.win.installed">true</property>
                <property name="installation.location">$N{install}/jdk1.8.0_101</property>
                <property name="javadb.win.installed">true</property>
                <property name="installation.location.windows">C:\Program Files\Java\jdk1.8.0_101</property>
            </properties>
        </product>
        <product platform="windows linux solaris-sparc solaris-x86 macosx-ppc macosx-x86" status="to-be-installed" uid="nb-extide" version="8.1.0.0.201510222201">
            <properties>
                <property name="show-in-wizard">false</property>
                <property name="installation.location">C:\Program Files\NetBeans 8.1</property>
            </properties>
        </product>
        <product platform="windows linux solaris-sparc solaris-x86 macosx-ppc macosx-x86" status="to-be-installed" uid="nb-javase" version="8.1.0.0.201510222201">
            <properties>
                <property name="jre.allowed">false</property>
                <property name="installation.location">C:\Program Files\NetBeans 8.1</property>
            </properties>
        </product>
    </components>
</state>

But as you know the packege that i have downloaded has JDK/JRE netbeans so it can take too much time for installation.
And a user who don't know much about these things he would be thinking what is going on :P 
so that is way i was thinking to make installer like a normal user install like autoit help contain a example winzip installation :D 
but thank you for reply :D :)

Share this post


Link to post
Share on other sites
ViciousXUSMC

I extract the .MSI from the .EXE and then run it with standard MSIEXEC silent flags.  

You can use a transform file to make changes to your install, or parameters, or what I do is just modify the MSI with InstaEdit

  • Like 1

Share this post


Link to post
Share on other sites
junkew

Did you try JABSimple.Spy on my W10 this works see below on javacpl what is the output of first few lines?

F:\Program Files\Java\jre1.8.0_102
We are using X64 at cpu X64 Autoit 64 bit version 1
  Windows accessbridge 32 opened 1
 0 initializeAccessBridge is finishedWindows_run passed :
+>20:20:53 Starting AutoIt3Wrapper v.14.801.2025.0 SciTE v.3.4.4.0   Keyboard:00020409  OS:WIN_81/  CPU:X64 OS:X64    Environment(Language:0413)
+>         SciTEDir => C:\Program Files (x86)\AutoIt3\SciTE   UserDir => \AppData\Local\AutoIt v3\SciTE\AutoIt3Wrapper   SCITE_USERHOME => \AppData\Local\AutoIt v3\SciTE 
>Running AU3Check (3.3.14.2)  from:C:\Program Files (x86)\AutoIt3  input:\Documents\UIA\JABSimpleSpy.au3
+>20:20:54 AU3Check ended.rc:0
>Running:(3.3.14.2):C:\Program Files (x86)\AutoIt3\autoit3_x64.exe "\Documents\UIA\JABSimpleSpy.au3"    
--> Press Ctrl+Alt+Break to Restart or Ctrl+Break to Stop
F:\Program Files\Java\jre1.8.0_102
We are using X64 at cpu X64 Autoit 64 bit version 1
  Windows accessbridge 32 opened 1
 0 initializeAccessBridge is finishedWindows_run passed :
0hello  name: <Settings...>
  description: <<html>Modify settings for temporary files</html>>
  role: <push button>
  role_en_US: <push button>
  states: <enabled,focusable,visible,showing,opaque>
  states_en_US: <enabled,focusable,visible,showing,opaque>
  indexInParent: <0>
  childrenCount: <0>
  x: <1028>
  y: <447>
  width: <83>
  height: <0>
0hello  name: <Security>
  description: <>
  role: <page tab>
  role_en_US: <page tab>
  states: <enabled,focusable,visible,showing,focused,selectable>
  states_en_US: <enabled,focusable,visible,showing,focused,selectable>
  indexInParent: <3>
  childrenCount: <1>
  x: <827>
  y: <197>
  width: <50>
  height: <0>

 

 

Share this post


Link to post
Share on other sites
Muhammad_Awais_Sharif

may be i am not using it in right way 
but when i run this was the output 

--> Press Ctrl+Alt+Break to Restart or Ctrl+Break to Stop
C:\Program Files\Java\jre1.8.0_111
We are using X64 at cpu X64 Autoit 64 bit version 1
  Windows accessbridge 32 opened 1
 0 initializeAccessBridge is finishedWindows_run passed :

And on press ctrl + w while mouse was on jdk-8u101-nb-8_1-windows-x64.exe Installer, It returns nothing 
not any thing in Scite output window or not even in Simple UIA Spy Editbox  (Or may be empty response)

Share this post


Link to post
Share on other sites
legend

using controlclick is very not the correct way to install software, it's not very reliable.

Instead use java's silent switch / parameter, to automatic silently install it:

FileGetShortName(@UserProfileDir & "\java.exe /s")

 

I wrote a little function to obtain the link to the latest java version:'

(i'm using psexec to run the java installation as the system user. you may ask why. It's because we are using software restrictions, so to bypass them, I run it as the system account.

;Download and install latest java version


install_latest_java_version()

func install_latest_java_version()
SplashTextOn("Opdater Java", "Vent venligst" & @CRLF & @CRLF & "Installere Java: " & @CRLF & @CRLF & latest_java_version(), -1, -1, -1, -1, "", "", 24)
if FileExists(@UserProfileDir & "\java.exe") then FileDelete(@UserProfileDir & "\java.exe") ;makes sure we gets the

$readtext = InetRead("https://java.com/inc/BrowserRedirect1.jsp?locale=en",1)
$source = BinaryToString($readtext)
$text =  _StringBetween($source,'<a title="Download Java software for Windows Offline" href="', '">')
$latest_version = $text[0]

InetGet($latest_version, @UserProfileDir & "\java.exe")
;RunWait(@UserProfileDir & "\java.exe /s")

_RunDos(FileGetShortName(@UserProfileDir & "\PsExec.exe") & " -i -s /accepteula " & FileGetShortName(@UserProfileDir & "\java.exe /s"))

SplashOff()
EndFunc

;---------------------------------------------------------------------------------------------------------------------------------

;Get the name of latest java version

func latest_java_version()
if FileExists(@UserProfileDir & "\java.exe") then FileDelete(@UserProfileDir & "\java.exe") ;makes sure we gets the

$readtext = InetRead("https://java.com/inc/BrowserRedirect1.jsp?locale=en",1)
$source = BinaryToString($readtext)
$text =  _StringBetween($source,'<h4 class="sub">Recommended ', '</h4>')
$latest_version = $text[0]
Return($latest_version)
EndFunc

 

Edited by legend
  • Like 1

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

  • Similar Content

    • Raj0813
      By Raj0813
      Launch the web application which has security certificate associated. On launching we get "Select a Certificate from the list of certificates" . how to handle this certificates using AutoIT and certificates are in a drop down. i have only chrome browser to launch the application.  do i need to install autoIt or just the add jar files and dll to it. it is not a pop up.
      Tried adding the certificate to trusted source dint work.. 
      Please find the screenshot attached for the screen obtained.

    • Spartan117
      By Spartan117
      Hi everyone,
      I wonder if there is a cloud service that can offer a physical server so that AutoIT can turn as it is in a physical machine.
      Thank you
    • XaelloNegative
      By XaelloNegative
      Hi team,
      I have a "well-built" autoIt exe app. Its running smooth until I open another application that when I run through the window info tool, returns as "SunAwtFrame". After running said application, my "well-built" autoIt exe app ceases to run.
      What seems to be the problem here and is there a possible turn around for it? Any suggestion or recommendation will be greatly appreciated. Thanks in advance.
      ~XN~
    • Ascer
      By Ascer
      1. Description.
      Automate communication with Gmail API using oAuth 2.0 security. 2. Requirements.
      Google Gmail account. Finished Authorization process. Look here 3. Possibilities.
      ;======================================================================================================================== ; Date: 2018-02-12, 11:46 ; ; Bug Fixs: 2018-02-17, 7:31 -> Fixed problems with adding items to array and minor bugs. ; ; Description: UDF for using Gmail API interface. This UDF requires oAuth.au3 and Gmail account. ; ; Function(s): ; gmailUsersGetProfile() -> Information about your account. ; gmailUsersLabelsList() -> Get all available labels ids. ex. "INBOX", "UNREAD" ; gmailUsersLabelsGet() -> Get information about specific label id. ; gmailUsersMessagesBatchDelete() -> Delete many messages emails by id. ; gmailUsersMessagesBatchModify() -> Set status for many messages ex. "INBOX", "UNREAD" ; gmailUsersMessagesDelete() -> Totaly delete email from ur account. ; gmailUsersMessagesGet() -> Get all information about specific email. ; gmailUsersMessagesList() -> Get list of last ~100 emails. ; gmailUsersMessagesModify() -> Modify single message. ; gmailUsersMessagesTrash() -> Put email in trash. ; gmailUsersMessagesUntrash() -> Restore email from trash. ; gmailUsersMessagesSend() -> Send email to single or group recipients. ; gmailUsersMessagesAttachmentsGet() -> Download attachment by id. ; ; Author(s): Ascer ;======================================================================================================================== 4. Downloads.
      oAuth.au3 Gmail API.au3 5. Examples.
      Sending emails
    • Spask
      By Spask
      Hi, I'm trying to find a text value inside of a html.
      This is what the line looks like normally:
      <p id="line1" class> <span class="bot">TEXT HERE</span> </p> The text then changes to a non breaking space:
      <p id="line1" class> <span class="bot">&nbsp;</span> </p> And then it changes back to normal text but it's different every time.
      Can I code this so that it grabs the text every time it changes and has a variable that represents it?
      I currently have this inside of my loop:
      $span = .document.getElementsByTagName("span") For $text In $span If $text.value = "&nbsp;" Then Sleep(50) MsgBox(0,0,0) ;messagebox to test if it can be found, but I don't know how to grab the text EndIf Next The problem is that there are many other lines in the html that have the same span but are called "line3", "line5", etc and the one I need is from "line1".
      I will appreciate if anyone can help with this!
×