Sign in to follow this  
Followers 0
reverse

Need help with MouseGetPos :/

4 posts in this topic

#1 ·  Posted (edited)

Hi

I'd like my script to ask me where it should click.

First it should ask me where I'd like it to click (maybe save the position in a variable) and then click the same position all the time.

I'm making a script for photoshop for inputing names and saving files each in seperate pdf.

Everything works great but  everytime I run it on different file the position I need it to click on is different.

I need it to ask me where it should click everytime I run it.

Here's my script:

#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
Local $file = FileOpen("lista.txt", 0)

; Check if file opened for reading OK
If $file = -1 Then
    MsgBox(0, "Error", "Unable to open file.")
    Exit
EndIf


; Read in lines of text until the EOF is reached
While 1
    Local $line = FileReadLine($file)
Local $i
    If @error = -1 Then MsgBox(262144,"The End", "The End !!!") ExitLoop
       
       Clipput($line)



While 1
   
   Local $hWnd = WinWait("[CLASS:Photoshop]", "", 10)

    ; Activate the Photoshop window using the handle returned by WinWait.
    WinActivate($hWnd)

    MouseClick("left", 562, 613, 3) ; <<<<------ THIS IS THE THING THAT BOTHERS ME <<<<-------

    Sleep(1000)
    Send("^v")
    sleep(300)
    send("^s")
    Do
    sleep(200) 
    until PixelGetColor(342, 299)=0xFFF791
    
    sleep(200)
    $i=$i+1
    Send($i)
    Sleep(500)
    Send("{ENTER}")
    Do
    sleep(200) 
 until PixelGetColor(416, 319)=0x21A121
 Send("{ENTER}")
 Do
    sleep(200) 
 until PixelGetColor(447, 438)=0xFFFFFF
    
    
    
    ExitLoop
 
WEnd
WEnd
FileClose($file)

Thx for your help ;)

Edited by reverse

Share this post


Link to post
Share on other sites



If you are using photoshop, why are you using MouseGetPos, rather than just the menu items?? Whole lot easier to activate the window and walk through the menu using WinMenuSelectItem rather than using MouseClicks.


√-1 2^3 ∑ π, and it was delicious!

Share this post


Link to post
Share on other sites

#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
Local $file = FileOpen("lista.txt", 0)

; Check if file opened for reading OK
If $file = -1 Then
    MsgBox(0, "Error", "Unable to open file.")
    Exit
EndIf

$Input - InputBox("InputBox", "Coords", "562,613")
$aCoords = StringSplit($Input, ",", 2)


; Read in lines of text until the EOF is reached
While 1
    Local $line = FileReadLine($file)
    Local $i
    If @error = -1 Then MsgBox(262144, "The End", "The End !!!") ExitLoop

    ClipPut($line)



    While 1

        Local $hWnd = WinWait("[CLASS:Photoshop]", "", 10)

        ; Activate the Photoshop window using the handle returned by WinWait.
        WinActivate($hWnd)

        MouseClick("left", $aCoords[0], $aCoords[1], 3) ; <<<<------ THIS IS THE THING THAT BOTHERS ME <<<<-------

        Sleep(1000)
        Send("^v")
        Sleep(300)
        Send("^s")
        Do
            Sleep(200)
        Until PixelGetColor(342, 299) = 0xFFF791

        Sleep(200)
        $i = $i + 1
        Send($i)
        Sleep(500)
        Send("{ENTER}")
        Do
            Sleep(200)
        Until PixelGetColor(416, 319) = 0x21A121
        Send("{ENTER}")
        Do
            Sleep(200)
        Until PixelGetColor(447, 438) = 0xFFFFFF



        ExitLoop

    WEnd
WEnd
FileClose($file)


AutoIt Absolute Beginners    Require a serial    Pause Script    Video Tutorials by Morthawt   ipify 

Monkey's are, like, natures humans.

Share this post


Link to post
Share on other sites

#4 ·  Posted (edited)

Thank you JohnOne.

You really made my day  :D

Edited by reverse

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