Jump to content
Sign in to follow this  
cheeroke

ControlClick

Recommended Posts

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

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 2020-09-05 - Version 1.5.1.1) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (NEW 2020-06-27 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX_GUI (NEW 2020-06-27 - Version 1.3.2.0) - Download
Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - 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
Task Scheduler (2019-12-03 - Version 1.5.1.0) - Download - General Help & Support - Wiki

Tutorials:
ADO - Wiki, WebDriver - 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 2020-09-05 - Version 1.5.1.1) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (NEW 2020-06-27 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX_GUI (NEW 2020-06-27 - Version 1.3.2.0) - Download
Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - 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
Task Scheduler (2019-12-03 - Version 1.5.1.0) - Download - General Help & Support - Wiki

Tutorials:
ADO - Wiki, WebDriver - Wiki

 

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 2020-09-05 - Version 1.5.1.1) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (NEW 2020-06-27 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX_GUI (NEW 2020-06-27 - Version 1.3.2.0) - Download
Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - 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
Task Scheduler (2019-12-03 - Version 1.5.1.0) - Download - General Help & Support - Wiki

Tutorials:
ADO - Wiki, WebDriver - 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 2020-09-05 - Version 1.5.1.1) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (NEW 2020-06-27 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX_GUI (NEW 2020-06-27 - Version 1.3.2.0) - Download
Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - 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
Task Scheduler (2019-12-03 - Version 1.5.1.0) - Download - General Help & Support - Wiki

Tutorials:
ADO - Wiki, WebDriver - 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
Sign in to follow this  

  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...