Jump to content

Script improvement


caramen
 Share

Recommended Posts

Hello guys. i whould like to know if someone can help me to do a proper script

Here is my script

; Script Start - Add your code below here
#include <Misc.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#include <Array.au3>
#include <File.au3>
#include <Word.au3>
#include <FileConstants.au3>
#include <MsgBoxConstants.au3>
#include <ColorConstantS.au3>
#include <ButtonConstants.au3>
#include <EditConstants.au3>
#include <ListViewConstants.au3>
#include <GuiListView.au3>
#include <ProgressConstants.au3>
#include <StaticConstants.au3>
#include <GDIPlus.au3>
#include <WinAPI.au3>
#include <_IsUACAdmin.au3>

Opt("WinTitleMatchMode", 2)
Opt("WinTextMatchMode", 2)



MsgBox ( $MB_SYSTEMMODAL , "Reparation windows update", "La reparation va debuter")

 $file_loc = @ScriptDir & "\sources\1 Delete KEY REGEDIT AU.au3"

               If @Compiled = 1 Then
                  $file_exe = FileGetShortName(@AutoItExe & ' /AutoIt3ExecuteScript "' & $file_loc & '"')
                  Run($file_exe)
               Else
                  $file_au3 = FileGetShortName($file_loc)
                  Run(@AutoItExe & " " & $file_au3, "", @SW_HIDE)
               EndIf


ShellExecute ( @ScriptDir & "\sources\3 WindowsUpdateAgent-7.6-x64.exe")
ShellExecute ( @ScriptDir & "\sources\4 windows6.1-kb3205394-x64_71d0c657d24bc852f074996c32987fb936c07774 OK.msu")

This working fine...

Now i am gonna add some KB install in silent mode.

But i whould like to use the error return can you guys give some exemple of how to do ?

Exemple I am gonna addd KB installation in quiet mode:

ShellExecute ( @ScriptDir & "\sources\7 - Windows6.1-KB3020369-x64 OK.msu /quiet /norestart")

How can i react with autoit with the return value of the installation of the KB ?

 

Exemple of return value :

1 Already installed

2 Not applicable on my system

3 installation failed

 

And react with the returned value. is that possible in the easyest way ?

My video tutorials : ( In construction )  || My Discord : https://discord.gg/S9AnwHw

How to Ask Help ||  UIAutomation From Junkew || WebDriver From Danp2 || And Water's UDFs in the Quote

Spoiler

 Water's UDFs:
Active Directory (NEW 2018-10-19 - Version 1.4.10.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

 

Link to comment
Share on other sites

@JohnOne Ty for your answer i have no time yet to continu the devlopement of the script but in Two week  i am gonna get back to that script.

 

Can you explain at lest how that will help me to add error reading in my script and by witch way ?

Edit btw i have something like 12 command in powershell and i dont need to wait since it wont luch the second command before the first one is not returning a vlue so i dont even get how that gonna help

 

EDIT2 after watching the help file i may understand now why you say that.

i am gonna reformulate the question later ;).

Edited by caramen

My video tutorials : ( In construction )  || My Discord : https://discord.gg/S9AnwHw

How to Ask Help ||  UIAutomation From Junkew || WebDriver From Danp2 || And Water's UDFs in the Quote

Spoiler

 Water's UDFs:
Active Directory (NEW 2018-10-19 - Version 1.4.10.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

 

Link to comment
Share on other sites

Example

Switch ShellExecuteWait ( @ScriptDir & "\sources\7 - Windows6.1-KB3020369-x64 OK.msu /quiet /norestart")
    Case 1
        ;Already installed code
    Case 2
        ;N/A code
    case 3
        ;failed code
EndSwitch

 

AutoIt Absolute Beginners    Require a serial    Pause Script    Video Tutorials by Morthawt   ipify 

Monkey's are, like, natures humans.

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...