Jump to content

Getting started, Mouseclick\!n


louwho
 Share

Recommended Posts

This is all new to me. I ran au3recorder and have created a script of the install of a new version of a product. In the script there are lines like 'MouseClick("left", 356,352,1)'. If I look at an older script that someone else did of the previous version of the install, there are lines like 'Send("!n")', which I am told is the equivalent of the 'Next' button. I know that I want the '!n' because the positioning on the screens are different from monitor to monitor. Is there a setting somewhere that changes what goes to the script file, or, do I now have to manually edit and change the script file? Please point me to the help document that would explain things like '!n', etc. Thanks.

Link to comment
Share on other sites

Hello louwho,

First Welcome to the AutoIt Forums ;)

The Send() function has all the documentation that I believe you are looking for.

If you have any further questions, feel free to ask.

Realm

My Contributions: Unix Timestamp: Calculate Unix time, or seconds since Epoch, accounting for your local timezone and daylight savings time. RegEdit Jumper: A Small & Simple interface based on Yashied's Reg Jumper Function, for searching Hives in your registry. 

Link to comment
Share on other sites

when i look at scripts that someone else created, I see a comment block at the top #Cs...(AutoIt version, etc) #Ce. When I run SciTE, I do not get this automatically, is there a setting, or was this generated by a different editor?

Link to comment
Share on other sites

My first attempt here. I get all the way through to the last dialog (see attached), that only has the Finish button active, but it does not click it and end the installation. I have to manually press the finish button to complete the install...any ideas.

BlockInput(1)

Run("setup.exe")

WinWaitActive("[TITLE:LOU - InstallShield Wizard; CLASS:#32770; INSTANCE:1]", "")

Send("!n")

WinWaitActive("[TITLE:LOU - InstallShield Wizard; CLASS:#32770; INSTANCE:1]", "")

ControlSend("LOU - InstallShield Wizard", "", "[CLASS:Edit; INSTANCE:1]", "N/A")

ControlSetText("LOU - InstallShield Wizard", "", "[CLASS:Edit; INSTANCE:2]", "N/A")

Send("!n")

WinWaitActive("", "")

ControlClick("", "", "[CLASS:Button; Text:OK]")

WinWaitActive("[TITLE:LOU - InstallShield Wizard; CLASS:#32770; INSTANCE:1]", "")

Send("!n")

WinWaitActive("[TITLE:LOU - InstallShield Wizard; CLASS:#32770; INSTANCE:1]", "")

Send("!n")

WinSetState("[TITLE:LOU - InstallShield Wizard; CLASS:#32770", "", @SW_MINIMIZE)

WinWaitActive("[TITLE:LOU - InstallShield Wizard; CLASS:#32770; INSTANCE:1]", "")

ControlClick("PFPS - InstallShield Wizard", "", "controlID [, middle [, 323 [, 319]]]")

BlockInput(0)

Link to comment
Share on other sites

louwho,

First, You will get a faster and better response if you put code in the AutoIt tags like I have below. To do so put your code inbetween these tags [AutoIt ][/AutoIt ] just delete the trailing spaces in each bracket.

Second, on your ControlClick (btw, glad to see your using the Help File) the square brackets designate that those parameters of the function are optional. meaning you don't have to include them if they are to be left as the default settings. I corrected that for you below.

Try This:

BlockInput(1)
Run("setup.exe")
WinWaitActive("[TITLE:LOU - InstallShield Wizard; CLASS:#32770; INSTANCE:1]", "")
Send("!n")
WinWaitActive("[TITLE:LOU - InstallShield Wizard; CLASS:#32770; INSTANCE:1]", "")
ControlSend("LOU - InstallShield Wizard", "", "[CLASS:Edit; INSTANCE:1]", "N/A")
ControlSetText("LOU - InstallShield Wizard", "", "[CLASS:Edit; INSTANCE:2]", "N/A")
Send("!n")
WinWaitActive("", "")
ControlClick("", "", "[CLASS:Button; Text:OK]")
WinWaitActive("[TITLE:LOU - InstallShield Wizard; CLASS:#32770; INSTANCE:1]", "")
Send("!n")
WinWaitActive("[TITLE:LOU - InstallShield Wizard; CLASS:#32770; INSTANCE:1]", "")
Send("!n")
WinSetState("[TITLE:LOU - InstallShield Wizard; CLASS:#32770", "", @SW_MINIMIZE)
WinWaitActive("[TITLE:LOU - InstallShield Wizard; CLASS:#32770; INSTANCE:1]", "")
ControlClick("PFPS - InstallShield Wizard", "", "controlID , middle , 323, 319") ;Brackets designate that these parameters are optional
BlockInput(0)

Realm

My Contributions: Unix Timestamp: Calculate Unix time, or seconds since Epoch, accounting for your local timezone and daylight savings time. RegEdit Jumper: A Small & Simple interface based on Yashied's Reg Jumper Function, for searching Hives in your registry. 

Link to comment
Share on other sites

I changed that last line and it still did not work. I then added the

tags (see below), compiled to an exe, and wehn I run the .exe I get a "Line one error, Unable to parse line."

#cs ----------------------------------------------------------------------------

 AutoIt Version: 3.3.6.1
 Author:         myName

 Script Function:
    Template AutoIt script.
#ce ----------------------------------------------------------------------------
; Script Start - Add your code below here
[code]
BlockInput(1)
Run("setup.exe")
WinWaitActive("[TITLE:PFPS - InstallShield Wizard; CLASS:#32770; INSTANCE:1]", "")
Send("!n")
WinWaitActive("[TITLE:PFPS - InstallShield Wizard; CLASS:#32770; INSTANCE:1]", "")
ControlSend("PFPS - InstallShield Wizard", "", "[CLASS:Edit; INSTANCE:1]", "N/A")
ControlSetText("PFPS - InstallShield Wizard", "", "[CLASS:Edit; INSTANCE:2]", "N/A")
Send("!n")
WinWaitActive("", "")
ControlClick("", "", "[CLASS:Button; Text:OK]")
WinWaitActive("[TITLE:PFPS - InstallShield Wizard; CLASS:#32770; INSTANCE:1]", "")
Send("!n")
WinWaitActive("[TITLE:PFPS - InstallShield Wizard; CLASS:#32770; INSTANCE:1]", "")
Send("!n")
WinSetState("[TITLE:PFPS - InstallShield Wizard; CLASS:#32770", "", @SW_MINIMIZE)
WinWaitActive("[TITLE:PFPS - InstallShield Wizard; CLASS:#32770; INSTANCE:1]", "")
ControlClick("PFPS - InstallShield Wizard", "", "controlID , middle , 323, 319")
BlockInput(0)

Link to comment
Share on other sites

louwho,

Sorry I did not catch this the first time, but the button needs to be in quotes as well. Also you need to enter the ControlID you can use the 'AutoIt Window Info' tool in your AutoIt folder to identify this control, the property will be 'ClassnameNN'.

ControlClick("PFPS - InstallShield Wizard", "", controlID , "middle" , 323, 319"

Realm

Edited by Realm

My Contributions: Unix Timestamp: Calculate Unix time, or seconds since Epoch, accounting for your local timezone and daylight savings time. RegEdit Jumper: A Small & Simple interface based on Yashied's Reg Jumper Function, for searching Hives in your registry. 

Link to comment
Share on other sites

This is getting frustrating. I think that the help file needs a help file of it's own.

This is my latest attempt, and it still does not work...

ControlClick("PFPS - InstallShield Wizard", "", 1 , "middle")

I have attached a screen print of the au3inbfo tool, on the Finish button.

post-60753-12879241519811_thumb.jpg

Link to comment
Share on other sites

Are you sure that you want to simulate a 'middle' mouse button click. A button on a GUI will normally expect a 'left' or 'primary' mouse button click.

Try

ControlClick("PFPS - InstallShield Wizard", "", 1 , "primary")

instead of 

ControlClick("PFPS - InstallShield Wizard", "", 1 , "middle")

Edit: Change second example to "middle" from "primary"

Edited by Bowmore

"Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the universe trying to build bigger and better idiots. So far, the universe is winning."- Rick Cook

Link to comment
Share on other sites

louwho,

Don't let it get you frustrated so easily. AutoIt was my first language, and I definately did not learn it overnight. I am still learning new things all the time, and still do not know everything there is to know with AutoIt. Have patience, It will all fall in place if you so desire it. The Help File is fine as it is. programming structure and it's parameters that makes it difficult at first. One day you going to look back, and laugh at these days, just as I occasionally look back at my first posts, and laugh at myself.

Now, on your 'AutoIt Window Info' tool screen there is a list of properties. You can use either 'Advanced Mode' or 'Classname NN' Properties for ControlID's in most cases.

Either of these 2 should work for you:

ControlClick("PFPS - InstallShield Wizard", '', 'Button2','middle')

; OR
ControlClick("PFPS - InstallShield Wizard", '', '[CLASS:Button;INSTANCE:2]','middle')

Realm

Edited by Realm

My Contributions: Unix Timestamp: Calculate Unix time, or seconds since Epoch, accounting for your local timezone and daylight savings time. RegEdit Jumper: A Small & Simple interface based on Yashied's Reg Jumper Function, for searching Hives in your registry. 

Link to comment
Share on other sites

Are you sure that you want to simulate a 'middle' mouse button click. A button on a GUI will normally expect a 'left' or 'primary' mouse button click.

Try

ControlClick("PFPS - InstallShield Wizard", "", 1 , "primary")

instead of

ControlClick("PFPS - InstallShield Wizard", "", 1 , "primary")

What is the difference between those 2 examples?

Edited by Realm

My Contributions: Unix Timestamp: Calculate Unix time, or seconds since Epoch, accounting for your local timezone and daylight savings time. RegEdit Jumper: A Small & Simple interface based on Yashied's Reg Jumper Function, for searching Hives in your registry. 

Link to comment
Share on other sites

@Realm

I've edited my post to show what I meant it to. 

The perils of cutting and pasting code.  Posted Image

"Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the universe trying to build bigger and better idiots. So far, the universe is winning."- Rick Cook

Link to comment
Share on other sites

Nothing that was posed here, has worked.

I have a thought. When you get to the point in an install that the copying of files, registering dll's, etc., takes place, a window appears and

displays this progress. Because the BlockInpuut(1) is turned on in my script, no one can click on the one (cancel), button on this form. This is the window that I have used the WinSetState on. That window eventually disappears, and the final "install completed" dialog appears with the left and right buttons disabled and only the middle 'Finish' button enabled. Am I wrong to use the WinSetState call, do I need to do something to remove\counter it so that the 'Finish' button on the final dialog is now enabled (a reversal of SW_Minimize)?

Send("!n")

WinSetState("[TITLE:PFPS - InstallShield Wizard; CLASS:#32770", "", @SW_MINIMIZE)

WinWaitActive("[TITLE:PFPS - InstallShield Wizard; CLASS:#32770; INSTANCE:1]", "")

ControlClick("PFPS - InstallShield Wizard", '', '[CLASS:Button;INSTANCE:2]','middle')

BlockInput(0)

Link to comment
Share on other sites

mia Culpa

The error was mine in that my dialog count was off. It was not that it wasn't clicking the button, it was hanging because it was expecting one more dialog in the script. I had first used Au3Recorder to generate a script, but for some reason it did not record one very small user generated dialog, that threw off my dialog count in my script.

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