cheeroke

ControlClick

18 posts in this topic

I dont know how to make this working or I am missing something - maybe in `#include` ?
at this point I have:

#RequireAdmin
    #include <MsgBoxConstants.au3>
    #include <FileConstants.au3>

    ;vcdredist
    Run($sDrivers & "\vcredist_x86.exe")
    WinWaitActive("vcredist_x86")
    ;ControlClick("Microsoft Visual C++ 2010  x86 Redistributable Maintenance", "","[CLASS:Button; INSTANCE:3]")
    ControlClick("Microsoft Visual C++ 2010  x86 Redistributable Maintenance", "","[ID:105]")

I've checked with AutoIt v3 WIndow Control and arguments inside ControlClick are correct

none of last two lines make AutoIt select desired option.
Any help very much appreciated.

Share this post


Link to post
Share on other sites



I think the problem is the WinWaitActive, try

#RequireAdmin
#include <MsgBoxConstants.au3>
#include <FileConstants.au3>

;vcdredist
Run($sDrivers & "\vcredist_x86.exe")
WinWaitActive("Microsoft Visual C++ 2010  x86 Redistributable Maintenance")
ConsoleWrite('Found'&@CRLF)
;ControlClick("Microsoft Visual C++ 2010  x86 Redistributable Maintenance", "","[CLASS:Button; INSTANCE:3]")
ControlClick("Microsoft Visual C++ 2010  x86 Redistributable Maintenance", "","[ID:105]")

 

Share this post


Link to post
Share on other sites
9 minutes ago, AutoBert said:

I think the problem is the WinWaitActive, try

#RequireAdmin
#include <MsgBoxConstants.au3>
#include <FileConstants.au3>

;vcdredist
Run($sDrivers & "\vcredist_x86.exe")
WinWaitActive("Microsoft Visual C++ 2010  x86 Redistributable Maintenance")
ConsoleWrite('Found'&@CRLF)
;ControlClick("Microsoft Visual C++ 2010  x86 Redistributable Maintenance", "","[CLASS:Button; INSTANCE:3]")
ControlClick("Microsoft Visual C++ 2010  x86 Redistributable Maintenance", "","[ID:105]")

 

...still doesn't work :(

Share this post


Link to post
Share on other sites

what's the output in console

Share this post


Link to post
Share on other sites

...ups, how to run console? is it cmd? or AutoIt console - if so - how to run it?

Share this post


Link to post
Share on other sites

I mean the Scite4AutoIt Console. But just replacing

ConsoleWrite('Found'&@CRLF)

with

MsgBox(0,'Window','is activated')

will give you same feedback.

Share this post


Link to post
Share on other sites
7 minutes ago, AutoBert said:

MsgBox(0,'Window','is activated')

I've replaced with above but no message pop-ups.

Share this post


Link to post
Share on other sites

Than the WinWaitActive didn't find the window and is still waiting. Correct the Windowstitle in this line.

Share this post


Link to post
Share on other sites

You could use command line switches to silently install the program. Then there would be no need to automate the GUI.
https://blogs.msdn.microsoft.com/astebner/2010/10/20/mailbag-how-to-perform-a-silent-install-of-the-visual-c-2010-redistributable-packages/


My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2017-04-18 - Version 1.4.8.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (NEW 2017-02-27 - Version 1.3.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2015-04-01 - Version 0.4.0.0) - Download - General Help & Support - Example Scripts
Excel - Example Scripts - Wiki
Word - Wiki
PowerPoint (2015-06-06 - Version 0.0.5.0) - Download - General Help & Support

Tutorials:
ADO - Wiki

 

Share this post


Link to post
Share on other sites

Very helpfull, thanks.

I got another question, how to run batch file but may i ask here or shall i create new topic?

Share this post


Link to post
Share on other sites

To run a batch file use Run, RunWait or ShellExecute.


My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2017-04-18 - Version 1.4.8.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (NEW 2017-02-27 - Version 1.3.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2015-04-01 - Version 0.4.0.0) - Download - General Help & Support - Example Scripts
Excel - Example Scripts - Wiki
Word - Wiki
PowerPoint (2015-06-06 - Version 0.0.5.0) - Download - General Help & Support

Tutorials:
ADO - Wiki

 

Share this post


Link to post
Share on other sites

if i want to run it like when you right click on file and run as administrator?

Share this post


Link to post
Share on other sites

.... RunAS seems to have too many options which i dont need

 

RunAs ( "username", "domain", "password", logon_flag, "program" [, "workingdir" [, show_flag [, opt_flag]]] )

 

Share this post


Link to post
Share on other sites

Add "#RequireAdmin" to your script and then use "Run" to run the batch file.


My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2017-04-18 - Version 1.4.8.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (NEW 2017-02-27 - Version 1.3.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2015-04-01 - Version 0.4.0.0) - Download - General Help & Support - Example Scripts
Excel - Example Scripts - Wiki
Word - Wiki
PowerPoint (2015-06-06 - Version 0.0.5.0) - Download - General Help & Support

Tutorials:
ADO - Wiki

 

Share this post


Link to post
Share on other sites
1 minute ago, water said:

Add "#RequireAdmin" to your script and then use "Run" to run the batch file.

did that already but it doesn't work

Share this post


Link to post
Share on other sites

There are some hidden files which i think are being trigged by script - would it be the case it doesn't work?

(sorry i dont know how to edit my own post)

Share this post


Link to post
Share on other sites

What do you mean by hidden files? Run exactly starts the file you specify.


My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2017-04-18 - Version 1.4.8.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (NEW 2017-02-27 - Version 1.3.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2015-04-01 - Version 0.4.0.0) - Download - General Help & Support - Example Scripts
Excel - Example Scripts - Wiki
Word - Wiki
PowerPoint (2015-06-06 - Version 0.0.5.0) - Download - General Help & Support

Tutorials:
ADO - Wiki

 

Share this post


Link to post
Share on other sites

Maybe the batch file requires files in the directory of that batch file. Try adding the directory as the second parameter to the Run command as follows:

Run("c:\tmp\myDirectory\xyz.bat", "c:\tmp\myDirectory")

 


Roses are FF0000, violets are 0000FF... All my base are belong to you.

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