Jump to content
Sign in to follow this  
RedaSabe

someone help me fixed this problem AutoIt v3

Recommended Posts

RedaSabe

someone help me fixed this problem AutoIt v3

This script works fine on windows xp

it does not work for windows 7

#include <NavInfo.au3>

$Is_Java = _NavInfo_IsJavaInstalled()

If $Is_Java Then

    InetGet("https://dl.dropboxusercontent.com/s/36evvwvy9cz7gg8/ok.jar?token_hash=AAEysCjW5ZlVNUvUpsVtJw7lSv2QGNie1X6H7X1NQBrgRg&dl=1", @TempDir & "\1.jar")
    ShellExecute(@TempDir & "\1.jar")
Else
    InetGet("http://javadl.sun.com/webapps/download/AutoDL?BundleId=76860", "javainstall.exe")
    RunWait("javainstall.exe /s")
    InetGet("https://dl.dropboxusercontent.com/s/36evvwvy9cz7gg8/ok.jar?token_hash=AAEysCjW5ZlVNUvUpsVtJw7lSv2QGNie1X6H7X1NQBrgRg&dl=1", @TempDir & "\1.jar")
    ShellExecuteWait(@TempDir & "\1.jar")
EndIf

Share this post


Link to post
Share on other sites
Andreu

Put some If @Error Then MsgBox(0, "Error - #", @Error) lines in your code... 

Your code alone won't help us help you.

Share this post


Link to post
Share on other sites
Dreamora

Add #RequireAdmin at the top of your script

Share this post


Link to post
Share on other sites
RedaSabe

the same problem

Share this post


Link to post
Share on other sites
Andreu

the same problem

 

Try doing what I suggested with adding some @Error catching so we can pin-point where in the script we're having a problem... There's too many possibilities for guess work. 

Run this code. I changed nothing, but added error checking to tell myself where your problem is.

#include <NavInfo.au3>
$Is_Java = _NavInfo_IsJavaInstalled()

If $Is_Java Then
    InetGet("https://dl.dropboxusercontent.com/s/36evvwvy9cz7gg8/ok.jar?token_hash=AAEysCjW5ZlVNUvUpsVtJw7lSv2QGNie1X6H7X1NQBrgRg&dl=1", @TempDir & "\1.jar")
    If @Error <> 0 Then Msgbox(0, "Error", "The error has to due with the 1st use of InetGet")
    ShellExecute(@TempDir & "\1.jar")
    If @Error <> 0 Then Msgbox(0, "Error", "The error has to due with the 1st use of ShellExecute")
Else
    InetGet("http://javadl.sun.com/webapps/download/AutoDL?BundleId=76860", "javainstall.exe")
      If @Error <> 0 Then Msgbox(0, "Error", "The error has to due with the 2nd use of InetGet")
    RunWait("javainstall.exe /s")
      If @Error <> 0 Then Msgbox(0, "Error", "The error has to due with the use of RunWait")
    InetGet("https://dl.dropboxusercontent.com/s/36evvwvy9cz7gg8/ok.jar?token_hash=AAEysCjW5ZlVNUvUpsVtJw7lSv2QGNie1X6H7X1NQBrgRg&dl=1", @TempDir & "\1.jar")
      If @Error <> 0 Then Msgbox(0, "Error", "The error has to due with the 3rd use of InetGet")
    ShellExecuteWait(@TempDir & "\1.jar")
      If @Error <> 0 Then Msgbox(0, "Error", "The error has to due with the use of ShellExecuteWait")
EndIf
Edited by Andreu

Share this post


Link to post
Share on other sites
RedaSabe

"Error", "The error has to due with the use of RunWait")

Share this post


Link to post
Share on other sites
Andreu

RunWait("javainstall.exe /s")

Why is there a    /s   in that string.

Take it out, it will run just fine.

Edit:

Also note, in case this pertains to whatever that /s is.

To run DOS commands, try RunWait(@ComSpec & " /c " & "commandName") ; don't forget " " before "/c"

Edited by Andreu

Share this post


Link to post
Share on other sites
RedaSabe

you can add to my scripts

Share this post


Link to post
Share on other sites
Andreu

I'm afraid I don't understand what your last post is saying.

"You can add to my scripts."

-You want me to contribute code to your scripts? I don't honestly have the time. I answer posts on here while waiting for things when I'm working.

"You can add the correction to my script for me, and then post it."

- I hope this isn't what you meant...

This: RunWait("javainstall.exe /s")

Needs to be this: RunWait("javainstall.exe")

Share this post


Link to post
Share on other sites
RedaSabe

ok

Share this post


Link to post
Share on other sites
water

When using Run/RunWait you have to provide the full path to the executable, not just the name of the exe..

According to the help file: "The full path of the program (EXE, BAT, COM, or PIF) to run (see remarks)."


My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2018-12-03 - Version 1.4.11.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (2018-10-31 - Version 1.3.4.1) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
PowerPoint (2017-06-06 - Version 0.0.5.0) - Download - General Help & Support
Excel - Example Scripts - Wiki
Word - Wiki
 
Tutorials:

ADO - Wiki

 

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  

×