How can I shorten a repetative task in Windows 10?

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
Lebowski
Posts: 4
Joined: 11 May 2021, 12:23

How can I shorten a repetative task in Windows 10?

13 May 2021, 13:13

How to shorten repetitive tasks in Windows 10,

In Windows 10 Pro, I use a shipping program in which I select an Order and go through the steps below to print a document. Same steps/selections each and every time. This is done many times throughout the day and I have always wished there was some sort of "script" that could shorten this repetitive process. I am not too familiar with AutoHotkey, and seems a little advanced for me. My only experience so far with this sort of thing would be in programs like "Excel" using various macro's and writing scripts in VBA. I was hoping to use "AutoScrptWriter" with this program, and figured I would be able to teach myself basic script writing from playing around with it. But unfortunately I have had no luck in getting that program to work (dll load errors), and such. Is there anyone that could give me some help with this problem? Or perhaps write out some sample scripts to get me started? I have video of the entire process and can provide more information if needed. Here is the basic process I would like to shorten,


With each and every document I print I have to go through the following steps/mouse clicks which are the same for every order,


Step 1: User left click on "Print Preview (button)" in "Shipping Program" window,

Step 2: User left double click on "Report Type" in "Shipping Program" window,

Step 3: User left click on "Less (button)" in "Print Window"

Step 4: User left click on "Print (button)" in "Print Window"

Step 5: User left click on "Print (button)" in "Print Window"

Step 6: User left click on "Cancel (button)" in "Print Window"

Step 7: User left click on "Cancel (button)" in "Print Window"

Step 8: User left click on "Cancel (button)" in "Print Window"

Step 9: User left click on "Close (button)" in "Shipping Program" to close the program.



Perhaps AutoHotkey is not the best way to go about this?
If anyone knows of a better way to go about this problem, I would be grateful for any alternative solutions.
Let me know what you guys think, and thanks again for taking the time to help.

Much appreciated.
User avatar
Smile_
Posts: 858
Joined: 03 May 2020, 00:51

Re: How can I shorten a repetative task in Windows 10?

13 May 2021, 13:44

Well I think there is a thing that might can help you which is MouseClick command.
And this an example left clicks at x = 100 and y = 100 pixel positions in screen starting from top left (x = 0, y = 0).
Note: After you launch the script, It waits for F1 button to be clicked to send the left button mouse click at that position.

Code: Select all

CoordMode, Mouse, Screen
F1::
    MouseClick, Left, 100, 100
Return

Esc::ExitApp
To exit the running script press ESC button.
Lebowski
Posts: 4
Joined: 11 May 2021, 12:23

Re: How can I shorten a repetative task in Windows 10?

14 May 2021, 09:41

This looks interesting, (sorry for the lack of knowledge, this program is completely new to me), let me see if I understand this correctly. A script will be launched (possibly from a set of hotkeys?) that will repeat a certain amount of "mouse clicks" in various windows to automate my task? I assume all the windows will need to open in the same location each time for this to work. Will I need to get the coordinates for each "mouseclick" location I want to perform? And there delays that will need to be set between each action? (I noticed there was a bundled program in AutoHotkey called AU3.spy that could be used to get mouse coordinates?) Or is that what the script you gave will do? Could you give a couple more examples? Once I learn how to write the script how exactly would it be launched? I think we are on the right track with this, thanks for your help, in the meantime Im going to read up some more on the "mouseclick" command from the link you provided.
thanks again
Lebowski
Posts: 4
Joined: 11 May 2021, 12:23

Re: How can I shorten a repetative task in Windows 10?

27 May 2021, 13:58

Just wanted to follow up and say thanks. Your suggestion worked great. I was also able to find a script that recorded my mouse moves as well, and with that was able to take a look at it and see how it worked. (was able to shorten it in a lot of areas and such).
very basic code that gets done exactly what i needed, thanks.

example of the start of script below

Code: Select all

#b::
SetBatchLines,-1
CoordMode,Mouse,Screen
Mousemove,930,196,0 
Mousemove,930,196,0 
Mousemove,930,196,0 
Mousemove,930,196,0 
Mousemove,930,196,0 
Mousemove,930,196,0 
MouseClick,Left,930,196,,0,D  	;Print preview
Mousemove,930,196,0 
Mousemove,930,196,0................................
[Mod edit: [code][/code] tags added.]
User avatar
WalkerOfTheDay
Posts: 710
Joined: 24 Mar 2016, 03:01

Re: How can I shorten a repetative task in Windows 10?

28 May 2021, 05:12

Why are you repeating the mousemoves six times before clicking ?
If it's because of timing issues, you could just apply a sleep. Something like this:

Code: Select all

#b::
SetBatchLines,-1
CoordMode,Mouse,Screen
Sleep, 1000  ; wait one second (adapt to your need)
Mousemove,930,196,0 ; actually this could be deleted too since you already put in the coordinates of the mouseclick
MouseClick,Left,930,196,,0,D  	;Print preview
Last edited by WalkerOfTheDay on 28 May 2021, 07:32, edited 1 time in total.
User avatar
boiler
Posts: 16925
Joined: 21 Dec 2014, 02:44

Re: How can I shorten a repetative task in Windows 10?

28 May 2021, 07:05

WalkerOfTheDay wrote: Why are you repeating the mousemoves six times before clicking ?
It’s most likely because the mouse recorder script sampled several times while the mouse was in the same place, and all of its output was left in unnecessarily. Since the Click statement contains the location, it should be fine to just delete every MouseMove command (as you noted in your comment).
Lebowski
Posts: 4
Joined: 11 May 2021, 12:23

Re: How can I shorten a repetative task in Windows 10?

01 Jun 2021, 11:17

That is correct,
That is how the recorder script dealt with timing, and in my case there needed to be delays between certain actions. Sure I could go through and shorten it immensely, (and add sleep delays) but for what it was, it got the job done. Plus I learned a lot about how it functions. thanks guys

Return to “Ask for Help (v1)”

Who is online

Users browsing this forum: Lamron750, septrinus and 269 guests