Sign in to follow this  
Followers 0
cjs78

Need help on script

5 posts in this topic

Hi Guys,

I'm new to this and have followed some of the tutorials etc.  I am starting to make my first script to automate a installation of a program - Unfortunately there is no silent install.

This is what I have so far however even though it recognises that the window is active it will not simulate pressing enter to proceed to next screen. Even using Send("!n") doesn't work.

AM I missing something?

My platform is Win 7 64bit

#include <MsgBoxConstants.au3>
#include <Constants.au3>

Run('OridionPCUtilities.exe')
Sleep(20000) ; Wait for splash screen to disappear
Local $hWnd = WinWait("[TITLE:Setup - Oridion PCUtilities]", "", 20)

WinActivate($hWnd)

If WinActive("Setup - Oridion PCUtilities") Then ; Check if Notepad is currently active.
    ;MsgBox($MB_SYSTEMMODAL, "", "WinActive" & @CRLF & "Window is active.")
    Send("{ENTER}")

Else
    MsgBox($MB_SYSTEMMODAL, "", "WinActive" & @CRLF & "Window is not active.")
EndIf

Here is a simmary of the infomation provided by au3info:

 

>>>> Window <<<<
Title: Setup - Oridion PCUtilities
Class: TWizardForm
Position: 606, 346
Size: 503, 388
Style: 0x16CA0000
ExStyle: 0x00000100
Handle: 0x0000000000100F42

>>>> Control <<<<
Class: TNewStaticText
Instance: 2
ClassnameNN: TNewStaticText2
Name: 
Advanced (Class): [CLASS:TNewStaticText; INSTANCE:2]
ID: 921522
Text: This will install Oridion PCUtilities 3.31.3.7 on your computer.

It is recommended that you close all other applications before continuing.

Click Next to continue, or Cancel to exit Setup.
Position: 176, 71
Size: 301, 239
ControlClick Coords: 121, 165
Style: 0x54000180
ExStyle: 0x00000000
Handle: 0x00000000000E0FB2

>>>> Mouse <<<<
Position: 906, 607
Cursor ID: 13
Color: 0xFFFFFF

>>>> StatusBar <<<<

>>>> ToolsBar <<<<

>>>> Visible Text <<<<
Welcome to the Oridion PCUtilities Setup Wizard

This will install Oridion PCUtilities 3.31.3.7 on your computer.

It is recommended that you close all other applications before continuing.

Click Next to continue, or Cancel to exit Setup.
&Next >
Cancel

>>>> Hidden Text <<<<
Please enter the Installation Code, then click Next.

SOFTWARE LICENSE  AGREEMENT

< &Back

 

Share this post


Link to post
Share on other sites



Think you can do it better with ControlClick to click the "Next" button than sending a Enter keypress:

ControlClick ( "title", "text", controlID [, button [, clicks [, x [, y]]]] )

Share this post


Link to post
Share on other sites

Thanks for the quick response! :-)

Tried experimenting with ControlClick and tried the commands below separately but it still did not work.  Any other ideas?

ControlClick("Setup - Oridion PCUtilities", "", "[CLASS:TNewButton; INSTANCE:2]")
ControlClick("Setup - Oridion PCUtilities", "", "[ID:987054]")

Here is the snapshot from Au3Info when mouse cursor over button:

 

Class: TNewButton

Instance: 2

ClassnameNN: TNewButton2

Name:

Advanced Mode: [CLASS:TNewButton; INSTANCE:2]

ID: 987054

Text: &Next >

Position: 327, 327

Size: 75, 23

ControlClick Coords: 34, 9

 

Share this post


Link to post
Share on other sites

OK. To update,

I have used the same code changing the variables to automate another installation and this work so it appears the issue is with the actual installer rather than my code.

Strange, Has anyone seen this type of thing before?

 

Share this post


Link to post
Share on other sites

OK To update,  The issue was with a splash screen being produced.  I removed the sleep command and added a loop in the code to wait till the first button was enabled before proceeding.

I then followed Seekers advise and used ControlClick instead of Send.

Run('OridionPCUtilities.exe')

    Local $hWnd = WinWait("[TITLE:Setup - Oridion PCUtilities]", "")

    Do
        WinActivate($hWnd)
    Until ControlCommand("[TITLE:Setup - Oridion PCUtilities]", "&Next >", "[CLASS:TNewButton; INSTANCE:1]", "IsEnabled")

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  
Followers 0