Sign in to follow this  
Followers 0
reverse

ControlClick help needed :)

12 posts in this topic

#1 ·  Posted (edited)

Hi,

I'd like my script to click 3 times at a defined coords in Photoshop but I just can't figure out how the syntax should look like.

This is how I wrote it but it doesn't work :/

#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#include <Misc.au3>

$Coordss = AskUser()

MsgBox(0, "", $Coordss[0] & "       " & $Coordss[1])


Func AskUser()
    MsgBox(262144, "User Input", "Please click the screen on a certain spot" & @CRLF & "Press OK, and then move your mouse there and click")
    Do
        Sleep(50)
    Until _IsPressed(01)
    $Coordss = MouseGetPos()
    ;MsgBox(0, "Thank You", "Your coords have been stored for later use")
    Return $Coordss
EndFunc  ;==>AskUser



$Input = InputBox("InputBox", "Coords", $Coordss[0] &"," & $Coordss[1])
$aCoords = StringSplit($Input, ",", 2)

Sleep(3000)

ControlClick("[CLASS:Photoshop]","","","left",3,$aCoords[0],$aCoords[1])
Edited by reverse

Share this post


Link to post
Share on other sites



Without being able to test...the first param should be the window handle/title/class, and the third should be the ControlID of the control you want to click.  Like I said, I can't test it, but I'm guessing your third param ([CLASS:Photoshop]) may be be the window and not the control.  I'm not even sure if you can inspect the control you want (or if ContrlClick can even interact with it). 

You may end up having to use WinActivate and MouseClick instead...of course the biggest limitation of this is you'll loose any ability to interact with the application while the computer is locked.

Share this post


Link to post
Share on other sites

I just edited my first post to show you entire script.

But it still doesn't work :/

Share this post


Link to post
Share on other sites

#5 ·  Posted (edited)

This is what I get when I use Window Info

5l9g8w.jpg

I tried something like this:

ControlClick("[CLASS:Photoshop]","", 6715 ,"left",3,176,255)

but it doesn't work :/

I know I'm doing something wrong but I don't know what :/

Edited by reverse

Share this post


Link to post
Share on other sites

#7 ·  Posted (edited)

The script should click 3 times on a text layer (which is at those coords) in photoshop to select all text in this layer.

Then it should paste new text from clipboard and save file (it does that part well).

Edited by reverse

Share this post


Link to post
Share on other sites

You could try changing the ID number to the class name (in your example above change 6715 to "Static20"), but I'm not sure it'll work that way either.

Share this post


Link to post
Share on other sites

You could try changing the ID number to the class name (in your example above change 6715 to "Static20"), but I'm not sure it'll work that way either.

It didn't help :/

Maybe I should stay with mouseclick

Share this post


Link to post
Share on other sites

#10 ·  Posted (edited)

you could try and add in

Opt("WinTitleMatchMode", 2)

ControlClick("Photoshop","","[CLASS:Static; INSTANCE:20]","left",3,$aCoords[0],$aCoords[1])

I have to use WinTitleMatchMode, 2 to access most of the programs I am using as setting by control alone has been a nightmare for me (user error more than likely)

Corrected typos number 1 reason I edit :(

Edited by tweakster2010

Share this post


Link to post
Share on other sites

why do you want to automate photoshop??? silly question..


ill get to that... i still need to learn and understand a lot of codes graduated.gif

Correct answer, learn to walk before you take on that marathon.

Share this post


Link to post
Share on other sites

Maybe a dump newbie remark of mine.

But had a simular problem with a setup i was trying to controlclick, i had to use #requireadmin

otherwise the script did nothing.

Hope this helps

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