Jump to content

Question| MouseClick Function


Recommended Posts

Hello all AutoIt users :)

I'm new on this forum (just registered) and also new on the autoit subject :}}

I got to say, that it seems very useful and awesome software !

Well, I made a script and tested the functions, and I have a little question about the "MouseClick" function:

If I'm writing the next lines for exmaple:

WinWaitActive ( "notepad", "" )

MouseClick("left", 798, 536, 1)]

That script will work on all computer resolutions?

I mean, because the mouseclick positions ..

I saw on the help file that I need to use AutoIt Info to find the mouseclick positions (On my script its: 798,536),

So I fount it. so I wonder if this position can be found on all computer, all screens and all resoulutions? or it get changed from computer to another computer?

How can I find common position for all computers?

Thank you so so much for the help,

AnotherOne.

Edited by AnotherOne
Link to comment
Share on other sites

First, thank you :)

And.. what do you mean?

It's just an example the position.. it can click on "File" in the notepad for exmaple ..

Why can't I use MouseClick instead of Control Click?

Edited by AnotherOne
Link to comment
Share on other sites

First, thank you :)

And.. what do you mean?

It's just an example the position.. it can click on "File" in the notepad for exmaple ..

Why can't I use MouseClick instead of Control Click?

I don't say you can't use it, i just suggest that controlclick is more usefull, no need to coordinates, just get the controlID of the control you want to click ! Posted Image

Edit : with mouseclick, it depends of the window position who can be different.

Edited by wakillon

AutoIt 3.3.14.2 X86 - SciTE 3.6.0WIN 8.1 X64 - Other Example Scripts

Link to comment
Share on other sites

Ohh.. ok :)

So.. I'm trying to install now a software with ControlClick, but I don't get it ..

in the auto it info, the ControlID (the number) always changed ! why ?

How can I do that? :S

and can you show me the full syntax, or example how should I use this function?

and one more thing: the ControlClick it's like MouseClick, but instead of positions it based on ID? it will show me the clicks of the mouse ?

Link to comment
Share on other sites

Ohh.. ok :)

So.. I'm trying to install now a software with ControlClick, but I don't get it ..

in the auto it info, the ControlID (the number) always changed ! why ?

How can I do that? :S

and can you show me the full syntax, or example how should I use this function?

and one more thing: the ControlClick it's like MouseClick, but instead of positions it based on ID? it will show me the clicks of the mouse ?

Installation of software, you should have start with that question.

Which soft ? ( perhaps you can use silent switches )

And yes it's based on ID, but you 'll not see clicks.

Edited by wakillon

AutoIt 3.3.14.2 X86 - SciTE 3.6.0WIN 8.1 X64 - Other Example Scripts

Link to comment
Share on other sites

How can I use silent switch ?

And I want to see the clicks .. if I can't see the clicks on ControlClick, it's the same like the "Send" function, no? (ENTER,TAB,SPACE..).

My point is I want to see the clicks of the mouse, like in mouse click ..

There's another way to use a command to see the mouse clicks except MouseClick?

If no, and the only way is MouseClick, we just back to my first question:

I wonder if this position can be found on all computer, all screens and all resoulutions? or it get changed from computer to another computer?

How can I find common position for all computers?

Link to comment
Share on other sites

How can I use silent switch ?

And I want to see the clicks .. if I can't see the clicks on ControlClick, it's the same like the "Send" function, no? (ENTER,TAB,SPACE..).

My point is I want to see the clicks of the mouse, like in mouse click ..

There's another way to use a command to see the mouse clicks except MouseClick?

If no, and the only way is MouseClick, we just back to my first question:

Ok, so you can use : Opt ( "MouseCoordMode", 0 )

Sets the way coords are used in the mouse functions, either absolute coords or coords relative to the current active window:

0 = relative coords to the active window

1 = absolute screen coordinates (default)

2 = relative coords to the client area of the active window

like this, coordinates are relative to the active window, not to the window position on the screen.

Edited by wakillon

AutoIt 3.3.14.2 X86 - SciTE 3.6.0WIN 8.1 X64 - Other Example Scripts

Link to comment
Share on other sites

Ohh.. ok :)

So.. I'm trying to install now a software with ControlClick, but I don't get it ..

in the auto it info, the ControlID (the number) always changed ! why ?

How can I do that? :S

and can you show me the full syntax, or example how should I use this function?

and one more thing: the ControlClick it's like MouseClick, but instead of positions it based on ID? it will show me the clicks of the mouse ?

To answer the first question, yes that will work on any resolution, but it will not be reliable, because the installation window may be in a different place.

For example, to click the edit box in notepad, you could run:

ControlClick("[CLASS:Notepad]", "", "[CLASS:Edit; INSTANCE:1]")

A If you need to click a certain area within a window for any reason and cannot use a control click, a more robust way of doing so would be to find the position that the window is in by using a command such as:

$window = WinGetPos("Example Window")

I believe there is a way to mouseclick at a certain position within a window, IE, (5, 10) would click the file menu regardless of where the window is positioned, but I am still new to autoit and do not know the answer to this one, so I will leave this one to the pros.

EDIT: Damn you guys are fast, looks like I was beat to my reply when I went on lunch :)

Edited by ShadowedStranger
Link to comment
Share on other sites

Will, ok, nvm, thanks, I don't need this anymore :)

But now I have another question:

How can I run the exe file I compiled in Silent mode / Silent switch?

For exmaple: I made a program install script by the Send function (Send Enter).

So eventually, when I run the script, I can see the program installed on the screen.

How can I do that in Silent mode?

Which means that I run the exe file, and the installation will run in silent mode?

Thank you,

AnotherOne.

Link to comment
Share on other sites

Will, ok, nvm, thanks, I don't need this anymore :)

But now I have another question:

How can I run the exe file I compiled in Silent mode / Silent switch?

For exmaple: I made a program install script by the Send function (Send Enter).

So eventually, when I run the script, I can see the program installed on the screen.

How can I do that in Silent mode?

Which means that I run the exe file, and the installation will run in silent mode?

Thank you,

AnotherOne.

I may be misunderstanding what exactly you want, but are you wanting to run the actual installer with the silent switch but still have autoit automate it? Is your goal just to not see the installation? If it is the second, you could use ControlSend and WinSetState

Run(@WindowsDir & "\Notepad.exe", "", @SW_MAXIMIZE)
WinSetState("[CLASS:Notepad]", "", @SW_HIDE)
Sleep(1000)
ControlSend("[CLASS:Notepad]", "", "Edit1", "This is a line of text in the notepad window")
Sleep(1000)
WinSetState("[CLASS:Notepad]", "", @SW_SHOW)
Link to comment
Share on other sites

Well, something like that..

I create a script that install AutoIt for example automaticly with the Send Enter function.

So when I run the script, it run the auto it install and send enter enter every time until the setup finish.

So what I want is, to install that AutoIt install but in SILENT MODE .. ok?

If I run the script and I can see the auto install, I want to run it in very silent mode, that you can't see the window, got it ?

so.. how can I do that? :)

Link to comment
Share on other sites

Well, something like that..

I create a script that install AutoIt for example automaticly with the Send Enter function.

So when I run the script, it run the auto it install and send enter enter every time until the setup finish.

So what I want is, to install that AutoIt install but in SILENT MODE .. ok?

If I run the script and I can see the auto install, I want to run it in very silent mode, that you can't see the window, got it ?

so.. how can I do that? :)

The sleeps were added for lulz.

Run(@WindowsDir & "\Notepad.exe", "", @SW_MAXIMIZE)
WinWait("[CLASS:Notepad]")
Sleep(500)
WinSetState("[CLASS:Notepad]", "", @SW_HIDE)
Sleep(500)
ControlSend("[CLASS:Notepad]", "", "Edit1", "Below this line we will send enter.")
Sleep(500)
ControlSend("[CLASS:Notepad]", "", "Edit1", "{ENTER}")
Sleep(500)
ControlSend("[CLASS:Notepad]", "", "Edit1", "Above this line we sent enter.")
Sleep(500)
WinSetState("[CLASS:Notepad]", "", @SW_SHOW)
Link to comment
Share on other sites

  • Developers

I'll hire you as corrector and believe me you'll have lot of work ! Posted Image

I wasn't referring to the typo and the emphasis was on the word again. I am sure the OP understands :)

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

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