Jump to content
CzarnyKhaki

Move mouse and click script

Recommended Posts

31 minutes ago, CzarnyKhaki said:

For example, when I search for "Send" it gives me "SciTE-LUA Interface"

Place the cursor on the command/function you want to search for. Then press F1.

This is a help, and besides, an excellent one, not a book.

Edited by Musashi

Musashi-C64.png

"In the beginning the Universe was created. This has made a lot of people very angry and been widely regarded as a bad move."

Share this post


Link to post
Share on other sites
2 hours ago, CzarnyKhaki said:

Edit: And why dahell is that F12 not working?

See Help : HotKeySet

The following hotkeys cannot be set:

ASC nnnn Cannot be used as in Send(). It will use "A" first char as Send() does when the "{...}" is invalid.
Ctrl+Alt+Delete It is reserved by Windows
F12 It is also reserved by Windows, according to its API.
NumPad's Enter Key Instead, use {Enter} which captures both Enter keys on the keyboard.
Win+B,D,E,F,L,M,R,U; and Win+Shift+M These are built-in Windows shortcuts. Note: Win+B and Win+L might only be reserved on Windows XP and above.
Alt, Ctrl, Shift, Win These are the modifier keys themselves!
Other Any global hotkeys a user has defined using third-party software, any combos of two or more "base keys" such as '{F1}{F2}', and any keys of the form '{LALT}' or '{ALTDOWN}'.

Musashi-C64.png

"In the beginning the Universe was created. This has made a lot of people very angry and been widely regarded as a bad move."

Share this post


Link to post
Share on other sites
On 11/6/2019 at 1:08 PM, Nine said:

Open help file look under at the functions that I used.

To the other members :

"I would like to apologize for posting three replies in a row, but this might be useful for beginners :)."

@CzarnyKhaki :

I haven't mentioned one variation to open the help yet. 

Move the cursor to the desired command or function in the source code below (i.e. StringReplace).

#include <Date.au3>
Const $x = 300, $y = 200 ; to be modify for position of the date field
MouseClick ("left", $x, $y, 2, 1) ; double click the date field to highlight it
Send ("^c") ; copy field in clipboard
$sDateField = ClipGet () ; retrieve date string
$sDateField = StringReplace ($sDateField, "-", "/") ; field must be formatted YYYY/MM/DD
$sNewDate = _DateAdd ("D", 1, $sDateField) ; add one day
MsgBox ($MB_SYSTEMMODAL,"",$sNewDate)

Now simply click on it or press right mouse button -> open new window or tab.

Edited by Musashi

Musashi-C64.png

"In the beginning the Universe was created. This has made a lot of people very angry and been widely regarded as a bad move."

Share this post


Link to post
Share on other sites
Quote

"Place the cursor on the command/function you want to search for. Then press F1."

nothing is happening, 

even after going to menu Help>Help(F1) nothing is shown

error help.png

Edited by CzarnyKhaki

Share this post


Link to post
Share on other sites

Cool. I have it now partially working.

The date is replaced correctly with hour element disabled, but with the hour element enabled it is all not working. Where is the mistake?

;F6
Func _Przelozenie()

    ToolTip("PRZEŁOŻENIE ROZMOWY NA JUTRO PO 17:00", 0, 0)
    MouseMove (98, 76)
    MouseClick ("left")
    Sleep(540)
    MouseMove (296, 506)
    MouseClick ("left")
    Sleep(540)
    MouseMove (226, 811)
    MouseClick ("left")
    
    MouseClickDrag ( "left", 462, 465, 409, 461, 2)   ; (2 is speed)
    Send ("^c") ; copy field in clipboard
    $sHourField = ClipGet () ; retrieve hour string
    Local $sRandomTime
    $sRandomTime = StringFormat("%02i:%02i", Random(17, 19, 1) , Random(0, 56, 1))
    $sRandomTime = ClipGet () ; retrieve hour string
    ClipPut($sRandomTime)
    Send ("^v") ; paste hour

    MouseClickDrag ( "left", 335, 465, 238, 460, 2)   ; (2 is speed)
    Send ("^c") ; copy field in clipboard
    $sDateField = ClipGet () ; retrieve date string
    $sDateField = StringReplace ($sDateField, "-", "/") ; field must be formatted YYYY/MM/DD
    $sNewDate = _DateAdd ("D", 1, $sDateField) ; add one day
    $sNewDate = StringReplace ($sNewDate, "/", "-") ; replacing strings back
    ClipPut($sNewDate)
    Send ("^v") ; paste field

    MouseMove (590, 871)
    MouseClick ("left")
    MouseMove (167, 809)
    MouseClick ("left")
    Sleep(560)
    MouseMove (245, 867)
    Sleep(560)
    MouseClick ("left")
    ToolTip("", 0, 0)
    MouseMove (600, 520)
EndFunc   ;==>_Przelozenie

 

Edited by CzarnyKhaki

Share this post


Link to post
Share on other sites
2 hours ago, CzarnyKhaki said:

Cool. I have it now partially working.

:)

2 hours ago, CzarnyKhaki said:

Where is the mistake?

The fields MUST be highlighted (one after the other) for this to work...Not sure that the drag also highlights the field ?

Share this post


Link to post
Share on other sites

ok I removed the line.

Now, the thing is, that when I disable the hour part, the date is working well, but when I enable the hour part, it writes "0" in date, and the hour works well.


 

;F6
Func _Przelozenie()

    ToolTip("PRZEŁOŻENIE ROZMOWY NA JUTRO PO 17:00", 0, 0)
    MouseMove (98, 76)
    MouseClick ("left")
    Sleep(540)
    MouseMove (296, 506)
    MouseClick ("left")
    Sleep(540)
    MouseMove (226, 811)
    MouseClick ("left")
    
    MouseClickDrag ( "left", 462, 465, 409, 461, 2)   ; (2 is speed)
    Send ("{Delete}") ;
    $sHourField = ClipGet () ; retrieve hour string
    Local $sRandomTime
    $sRandomTime = StringFormat("%02i:%02i", Random(17, 19, 1) , Random(0, 56, 1))
    $sHourField = $sRandomTime
    ClipPut($sRandomTime)
    Send ("^v") ; paste hour

    MouseClickDrag ( "left", 335, 465, 238, 460, 2)   ; (2 is speed)
    Send ("^c") ; copy field in clipboard
    $sDateField = ClipGet () ; retrieve date string
    $sDateField = StringReplace ($sDateField, "-", "/") ; field must be formatted YYYY/MM/DD
    $sNewDate = _DateAdd ("D", 1, $sDateField) ; add one day
    $sNewDate = StringReplace ($sNewDate, "/", "-") ; replacing strings back
    ClipPut($sNewDate)
    Send ("^v") ; paste field

    MouseMove (590, 871)
    MouseClick ("left")
    Send("{Enter}")
    MouseMove (167, 809)
    MouseClick ("left")
    Sleep(560)
    MouseMove (245, 867)
    Sleep(560)
    MouseClick ("left")
    ToolTip("", 0, 0)
    MouseMove (600, 520)
EndFunc   ;==>_Przelozenie

 

Edited by CzarnyKhaki

Share this post


Link to post
Share on other sites

Now you need to learn how to debug a script.  In the date part, insert after each line a ConsoleWrite that shows the current value of the variables you are manipulating.  Run it and show us the result of the Scite console, along with the modified script...

EDIT : what is that ?

Send ("{Delete}")
Edited by Nine

Share this post


Link to post
Share on other sites
;F6
Func _Przelozenie()

    ToolTip("PRZEŁOŻENIE ROZMOWY NA JUTRO PO 17:00", 0, 0)
    MouseMove (98, 76)
    MouseClick ("left")
    Sleep(540)
    MouseMove (296, 506)
    MouseClick ("left")
    Sleep(540)
    MouseMove (226, 811)
    MouseClick ("left")

    MouseClickDrag ( "left", 462, 465, 409, 461, 2)   ; (2 is speed)
    $sHourField = ClipGet () ; retrieve hour string
    Local $sRandomTime
    $sRandomTime = StringFormat("%02i:%02i", Random(17, 19, 1) , Random(0, 56, 1))
    $sHourField = $sRandomTime
    ClipPut($sRandomTime)
    Send ("^v") ; paste hour

    MouseClickDrag ( "left", 335, 465, 238, 460, 2)   ; (2 is speed)
    Send ("^c") ; copy field in clipboard
     ConsoleWrite('date() -> Send ("^c")' & @CRLF)
    $sDateField = ClipGet () ; retrieve date string
     ConsoleWrite('date() -> $sDateField = ClipGet ()' & @CRLF)
    $sDateField = StringReplace ($sDateField, "-", "/") ; field must be formatted YYYY/MM/DD
     ConsoleWrite('date() -> $sDateField = StringReplace ($sDateField, "-", "/")' & @CRLF)
    $sNewDate = _DateAdd ("D", 1, $sDateField) ; add one day
     ConsoleWrite('date() -> $sNewDate = _DateAdd ("D", 1, $sDateField)' & @CRLF)
    $sNewDate = StringReplace ($sNewDate, "/", "-") ; replacing strings back
     ConsoleWrite('date() -> $sNewDate = StringReplace ($sNewDate, "/", "-")' & @CRLF)
    ClipPut($sNewDate)
     ConsoleWrite('date() -> ClipPut($sNewDate)' & @CRLF)
    Send ("^v") ; paste field
     ConsoleWrite('date() -> Send ("^v")' & @CRLF)

    MouseMove (590, 871)
    MouseClick ("left")
    Send("{Enter}")
    MouseMove (167, 809)
    MouseClick ("left")
    Sleep(560)
    MouseMove (245, 867)
    Sleep(560)
    MouseClick ("left")
    ToolTip("", 0, 0)
    MouseMove (600, 520)
EndFunc   ;==>_Przelozenie

 

 

>"C:\Users\agent01\Downloads\autoit-v3\install\SciTe\..\autoit3.exe" /ErrorStdOut "C:\Users\agent01\Downloads\autoit-v3\install\Examples\aukon2.au3"    
date() -> Send ("^c")
date() -> $sDateField = ClipGet ()
date() -> $sDateField = StringReplace ($sDateField, "-", "/")
date() -> $sNewDate = _DateAdd ("D", 1, $sDateField)
date() -> $sNewDate = StringReplace ($sNewDate, "/", "-")
date() -> ClipPut($sNewDate)
date() -> Send ("^v")

>Process failed to respond; forcing abrupt termination...
>Exit code: 1    Time: 23.69

Edited by CzarnyKhaki

Share this post


Link to post
Share on other sites
44 minutes ago, Nine said:

The clipget in the hour section is useless, do you know why ?

I guess because I don't need to manipulate anything present in clipboard.

___

Is anywhere better explanation of ConsoleWrite?

The help about this function sux

Edited by CzarnyKhaki

Share this post


Link to post
Share on other sites
28 minutes ago, CzarnyKhaki said:

Is anywhere better explanation of ConsoleWrite?

Help file says it all.  It is just a way to easily show informations about what going on in a script.  It is mainly an easy way to debug...

Share this post


Link to post
Share on other sites

help about this function is totally unclear for me...

 

;F6
Func _Przelozenie()

    ToolTip("PRZEŁOŻENIE ROZMOWY NA JUTRO PO 17:00", 0, 0)
    MouseMove (98, 76)
    MouseClick ("left")
    Sleep(540)
    MouseMove (296, 506)
    MouseClick ("left")
    Sleep(540)
    MouseMove (226, 811)
    MouseClick ("left")

    MouseClickDrag ( "left", 462, 465, 409, 461, 2)   ; (2 is speed)
    Local $sRandomTime
    $sRandomTime = StringFormat("%02i:%02i", Random(17, 19, 1) , Random(0, 56, 1))
    $sHourField = $sRandomTime
    ClipPut($sRandomTime)
    Send ("^v") ; paste hour

    MouseClickDrag ( "left", 335, 465, 238, 460, 2)   ; (2 is speed)
    Send ("^c") ; copy field in clipboard
         ConsoleWrite('date() -> Send ("^c")' & @CRLF)
    $sDateField = ClipGet () ; retrieve date string
         ConsoleWrite('date() -> $sDateField = ClipGet () => ' & $sDateField & @CRLF)
    $sDateField = StringReplace ($sDateField, "-", "/") ; field must be formatted YYYY/MM/DD
         ConsoleWrite('date() -> $sDateField = StringReplace ($sDateField, "-", "/")' & $sDateField & @CRLF)
    $sNewDate = _DateAdd ("D", 1, $sDateField) ; add one day
         ConsoleWrite('date() -> $sNewDate = _DateAdd ("D", 1, $sDateField)' & $sDateField & @CRLF)
    $sNewDate = StringReplace ($sNewDate, "/", "-") ; replacing strings back
         ConsoleWrite('date() -> $sNewDate = StringReplace ($sNewDate, "/", "-")' & $sNewDate & @CRLF)
    ClipPut($sNewDate)
         ConsoleWrite('date() -> ClipPut($sNewDate)' & $sNewDate & @CRLF)
    Send ("^v") ; paste field
         ConsoleWrite('date() -> Send ("^v")' & @CRLF)

    MouseMove (590, 871)
    MouseClick ("left")
    Send("{Enter}")
    MouseMove (167, 809)
    MouseClick ("left")
    Sleep(560)
    MouseMove (245, 867)
    Sleep(560)
    MouseClick ("left")
    ToolTip("", 0, 0)
    MouseMove (600, 520)
EndFunc   ;==>_Przelozenie
Quote

>"C:\Users\agent01\Downloads\autoit-v3\install\SciTe\..\autoit3.exe" /ErrorStdOut "C:\Users\agent01\Downloads\autoit-v3\install\Examples\aukon2.au3"    
date() -> Send ("^c")
date() -> $sDateField = ClipGet () => 
date() -> $sDateField = StringReplace ($sDateField, "-", "/")
date() -> $sNewDate = _DateAdd ("D", 1, $sDateField)
date() -> $sNewDate = StringReplace ($sNewDate, "/", "-")0
date() -> ClipPut($sNewDate)0
date() -> Send ("^v")
 

 

Edited by CzarnyKhaki

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

×
×
  • Create New...