Jump to content

Trying to create autoit script to install software on windows install


Recommended Posts

Hi All,

 

I am trying to create a script to record the actions off a program installer using au3recorder and then compile it to exe to run on the windows installation. The problems i have is it selecting the folder it is in just now but in the windows install it will be a different folder also it not recording all actions i do so i need to manually press buttons. yes most software have slient switches but i want to be able to customise my installs like i would after a windows installation

Link to comment
Share on other sites

You will need to give us a tad more information than that.  What is the application you are trying to install ?  Have you try to use au3info.exe tool to see if the screen objects are detectable ?  Instead of Send and MouseClick, using Control* functions might greatly help you and provide a more robust solution.

Link to comment
Share on other sites

Most of the programs provide a silent installation. This way you can pre-record the configuration of the program. So you avoid the need to automate the installation GUI.

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2022-02-19 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download
Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki
PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki
Task Scheduler (NEW 2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki

Standard UDFs:
Excel - Example Scripts - Wiki
Word - Wiki

Tutorials:
ADO - Wiki
WebDriver - Wiki

 

Link to comment
Share on other sites

Link to comment
Share on other sites

On 5/31/2021 at 1:50 PM, Nine said:

You will need to give us a tad more information than that.  What is the application you are trying to install ?  Have you try to use au3info.exe tool to see if the screen objects are detectable ?  Instead of Send and MouseClick, using Control* functions might greatly help you and provide a more robust solution.

What information do you need? im all for any solution that works but i will need a guide on how to write teh scripts myself

Link to comment
Share on other sites

On 5/31/2021 at 1:57 PM, water said:

Most of the programs provide a silent installation. This way you can pre-record the configuration of the program. So you avoid the need to automate the installation GUI.

Yes but example one of the software i want to use give silent install but it install opera as well i dnt want that i want to customise the install fully so i need to work out how to use autoit correctly, also silent installs dnt get rid of windows smartscan popup

Link to comment
Share on other sites

7 minutes ago, andrewcrawford131 said:

What information do you need?

Well, let start with the 2 questions that follow the first sentence...You could also post the result of the au3info tool along with a screen shot of the installer windows.  And of course, the most important information that we need is a first draft of your script.  Do not expect us to write it for you, as you will be terribly be disappointed.

Link to comment
Share on other sites

  • 1 month later...
On 6/3/2021 at 8:28 PM, Nine said:

Well, let start with the 2 questions that follow the first sentence...You could also post the result of the au3info tool along with a screen shot of the installer windows.  And of course, the most important information that we need is a first draft of your script.  Do not expect us to write it for you, as you will be terribly be disappointed.

I dnt expect anyone but me to write it, i am just looking for guidance how to do it and pointers to where i need to look. sorry i work a lot so not had time to reply will reply with the basic script soon

Link to comment
Share on other sites

 

On 6/3/2021 at 8:28 PM, Nine said:

Well, let start with the 2 questions that follow the first sentence...You could also post the result of the au3info tool along with a screen shot of the installer windows.  And of course, the most important information that we need is a first draft of your script.  Do not expect us to write it for you, as you will be terribly be disappointed.

Here is the script

#region --- Au3Recorder generated code Start (v3.3.9.5 KeyboardLayout=00000809)  ---

#region --- Internal functions Au3Recorder Start ---
Func _Au3RecordSetup()
Opt('WinWaitDelay',100)
Opt('WinDetectHiddenText',1)
Opt('MouseCoordMode',0)
Local $aResult = DllCall('User32.dll', 'int', 'GetKeyboardLayoutNameW', 'wstr', '')
If $aResult[1] <> '00000809' Then
  MsgBox(64, 'Warning', 'Recording has been done under a different Keyboard layout' & @CRLF & '(00000809->' & $aResult[1] & ')')
EndIf

EndFunc

Func _WinWaitActivate($title,$text,$timeout=0)
    WinWait($title,$text,$timeout)
    If Not WinActive($title,$text) Then WinActivate($title,$text)
    WinWaitActive($title,$text,$timeout)
EndFunc

_AU3RecordSetup()
#endregion --- Internal functions Au3Recorder End ---

_WinWaitActivate("Downloads","")
MouseClick("left",237,191,1)
MouseDown("left")
MouseMove(237,190)
MouseUp("left")
_WinWaitActivate("Microsoft Visual C++ 2015 Redistributable (x64) - 14.0.23026 Setup","")
MouseClick("left",170,237,1)
MouseMove(357,261)
MouseDown("left")
MouseMove(357,260)
MouseUp("left")
MouseClick("left",359,277,1)
MouseClick("left",443,281,1)
#endregion --- Au3Recorder generated code End ---
 

Dnt know how to use au3info or where it is located

what do you mean screenshot of the installer windows?

i am happy to do this "  Instead of Send and MouseClick, using Control* functions might greatly help you and provide a more robust solution." but i have never programs a au3 script before so i need so basics of how i do it it and how the commands works

the first application i am trying to install is Microsoft Visual C++ 2015 Redistributable (x64) - 14.0.23026 but i have loads more i want to perfect this and then i use the skills to do other and then i will only post for bug finding.

Link to comment
Share on other sites

This appears to be all generated code based on the recording, not any that you added, correct?

If so, you might be able to remedy your original problem:

On 5/31/2021 at 5:32 AM, andrewcrawford131 said:

The problems i have is it selecting the folder it is in just now but in the windows install it will be a different folder

It appears from the recording that you just clicked on the folder you wanted it to be installed in, which obviously will not be portable, as the directory could be shown at different x,y coords for many reasons.

Instead, you should record again, but this time when choosing the directory, use the keyboard to enter the destination folder name manually.  This at least will be repeatable.  Even if the folder name still varies at runtime, recording again will at least show us where in the code to manipulate and send the destination directory.

Still, as @Ninealluded to, using recorder related commands like Send and Mouseclick, are often very brittle. Even if you are successful here in the short term, you should consider Control functions ultimately.  Try typing au3info in your Windows search bar.

 

 

Code hard, but don’t hard code...

Link to comment
Share on other sites

Did you have a look at the Vollatran project?

 

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2022-02-19 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download
Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki
PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki
Task Scheduler (NEW 2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki

Standard UDFs:
Excel - Example Scripts - Wiki
Word - Wiki

Tutorials:
ADO - Wiki
WebDriver - Wiki

 

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