Muhammad_Awais_Sharif

how to automate Java Installer

16 posts in this topic

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



#2 ·  Posted (edited)

Maybe with

from @junkew

Edited by AutoBert
1 person likes this

Share this post


Link to post
Share on other sites

Look for unatentded instalation switches

1 person likes this

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 - BETA * 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 * Best coding practices * 

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) * 

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: 2017-06-04

Share this post


Link to post
Share on other sites

@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

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

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

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

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

1 person likes this

Share this post


Link to post
Share on other sites

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

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

#15 ·  Posted (edited)

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
1 person likes this

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

    • 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!
    • ags911
      By ags911
      I have a script that has to work on multiple resolutions but each resolution has slightly different co-ordinates due to automatic UI scaling. I have had to make separate files for each but would like to implement them all in one script. I have a similar program written for Java which uses else if statements to use different co-ordinates for each resolution after it has been detected. I'm not good with Java so I would like to implement this on AutoIt before later making a Java version.
       
      This is a snippet of the autoit code I have.
      ToolTip("1 - Search")
      MouseClick("Left", @DesktopWidth *0.823, @DesktopHeight *0.925, 1, 25)
      ToolTip("2 - Buy Now")
      MouseClick("Left", @DesktopWidth *0.83, @DesktopHeight *0.798, 1, 27)
      ToolTip("3 - OK")
      MouseClick("Left", @DesktopWidth *0.555, @DesktopHeight *0.596, 1, 15)
      ToolTip("4 - OK Clear Error")
      MouseClick("Left", @DesktopWidth *0.49, @DesktopHeight *0.597, 1, 30)
      ToolTip("5 - Back to Search")
      MouseClick("Left", @DesktopWidth *0.161, @DesktopHeight *0.108, 1, 15)
       
      This is a snippet of a java code I used.
      Thanks.
      private static void goToSearch(double maxX, double maxY, Robot bot) throws InterruptedException {     int currentX = 0;     int currentY = 0;     if (maxX == 2650 && maxY == 1440) {         currentX = 734;         currentY = 1316;     } else if (maxX == 1920 && maxY == 1200) {         currentX = 551;         currentY = 1096;     } else if (maxX == 1920 && maxY == 1080) {         currentX = 551;         currentY = 1042;     } else if (maxX == 1680 && maxY == 1050) {         currentX = 482;         currentY = 959;     } else if (maxX == 1440 && maxY == 900) {         currentX = 413;         currentY = 822;     } else if (maxX == 1366 && maxY == 768) {         currentX = 392;         currentY = 741;     } else if (maxX == 1280 && maxY == 800) {         currentX = 367;         currentY = 731;
    • TotalAuto
      By TotalAuto
      Howdy All
      I've gone around and around in circles wasting hours trying to fix this problem to no avail so I thought I would try posting for help given there are some real smart people in this forum.
      Background
      I have 5 separate .au3 scripts that all do different basic tasks. For example:
      1.au3 = opens Chrome browser to obtain information from a specific website then closes
      2.au3 = opens an Excel workbook to run a macro then saves and closes
      3.au3 = Open two seperate workbooks and transfers data from one to the other then saves and closes
      4.au3 = .......etc
      5.au3 = .......etc
      These 5 separate scripts, doing completely different tasks, need to each run once per day at 5 different designated times within a day and then close. For example:
      1.au3 = 10am
      2.au3 = 12pm
      3.au3 = 2pm
      4.au3 = 4pm
      5.au3 = 5pm
      Problem
      I can not get these different scripts to reliably run at their designated times. When I manually run these scripts individually by using 'Go F5' they work perfectly. If I convert these scripts to an .exe and manually run each one they work about 98% of time.
      How can I schedule these different .au3 files or associated .exe files to reliably run each day at different times?
      Attempts To Fix The Issue
      1. I have tried converting each .au3 script into their own .exe file and use Window's Task Scheduler to run these .exe files at their designated time but the success rate  of running each .exe in full, to completion, without error is very low at about 30%. Things that commonly go wrong include a browser not opening but movement still continues on the desk top. Other times things just do not happen at all.
      2. I have Windows 7 64 bit and have tried creating and running both (x86) and (x64) .exe files but again reliability problems exist;
      3. I have also tried moving each .exe file to the My Documents folder as I read someone that keeping your files on your desktop ties your files to individual Windows user profiles which can cause AutoIt operating errors. Not sure if this is correct but thought I would try it anyway. It did not fix my issue.
      4. I installed a program called AlwaysUp which supposedly always reliably runs in the background and will reliably execute your AutoIt script or .exe files. Still have significant reliability issues.
      Therefore, can someone please provide advice on how I can get my 5 different .au3 files to run at 5 designated times through the day, every day, without fail? Overtime I will be creating more and more different .au3 files to run certain tasks throughout the day and do not want to create one large AutoIt file that continually runs and attempts to do all the different tasks itself.
      Any help is very appreciated.
      Thanks
      Dan
       
       
    • FrancescoDiMuro
      By FrancescoDiMuro
      Good evening everyone
      Before all, I want to say that I'm doing this script to see how _IE* functions work, and see if my studs can hack a quiz I'm working on.
      I want to clarify that I'm not automating any game, bypassing any CAPTCHAs, or anything that could damage anyone.
      I was trying to autofill a form, based on which question is displayed.
      The question is always stored in here:
      <header> <h1><span class="questionid">1. </span>Here goes the question</h1> </header> And answers are stored in here:
      <ul class="answers"> <li><label><span><input id="answer_0" name="answer[]" type="radio" value="0">Answer 1</span></label></li> <li><label><span><input id="answer_1" name="answer[]" type="radio" value="1">Answer 2</span></label></li> <li><label><span><input id="answer_2" name="answer[]" type="radio" value="2">Anwser 3</span></label></li> <li><label><span><input id="answer_3" name="answer[]" type="radio" value="3">Answer 4</span></label></li> </ul></fieldset></form></div> And, there are 15 questions like this.
      How can automatically fill my form?
      Thanks in advance
      Francesco
    • Psyllex
      By Psyllex
      I have a super simple login screen I'm trying to access that is written in java.  My java testing tools can't access the login screen because it's a modal window.  So I figured I'd see if AutoIt can manipulate 'something' on it.  I can enter text within the text boxes for user name and password.  But I can't see to click on the login button.  I've tried just tabbing to it and hitting the enter key (as I really wouldn't have to be completely interacting with the frame).  But that didn't work.  I was hoping to throw it some coordinates and just double click in that relative area, but when I get the whole " ==> Subscript used on non-accessible variable.:" when I attempt to use ControlGetPos() I'm assuming because it can't truly interact with the Java frame.  So I'm kind of stuck here...can't use AutoIt, can't use a Java automation testing tool to do this due to the modal issues.  Does anyone have any ideas?  My code is below though I think it's less to do with code and more what AutoIt can and can't do.
      #include <EditConstants.au3> #include <GUIConstantsEx.au3> #include <StaticConstants.au3> #include <WindowsConstants.au3> Local $hWnd = WinActivate("[CLASS:sunawtframe]", "Login") Local $aPos = ControlGetPos($hWnd, "[CLASS:SUNAWTFRAME]", "Login") Local $myXPos = $aPos[0] + 420 Local $myYPos = $aPos[1] + 270 Send("guest") Send("{TAB}") Send("guest") Send("{TAB}") ;Tried Control Click it failed ControlClick($hWnd, "", "Login") ;Tried Mouse Click and that failed MouseClick("Left", $myXPos, $myYPos, 2)  
      Thanks for any help!