Jump to content

Need help with MouseGetPos :/


Go to solution Solved by JohnOne,

Recommended Posts

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
Link to comment
Share on other sites

  • Moderators

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.

"Profanity is the last vestige of the feeble mind. For the man who cannot express himself forcibly through intellect must do so through shock and awe" - Spencer W. Kimball

How to get your question answered on this forum!

Link to comment
Share on other sites

  • Solution

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

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