Link to home
Start Free TrialLog in
Avatar of Luis Diaz
Luis DiazFlag for Colombia

asked on

AutoHotkey: click not working

Hello,

I am trying to send a click to close document recovery pane button in excel .
The objective is to close the process through reading the image however for the moment I want to understand why click is not applied. I attached a video.
Could you please advice me on how the click should be performed?
I don’t know how to make the click work.


Thank you for your help.


:*:drx::
If (winactive("ahk_exe excel.exe"))
{
  
  WinMaximize
  Sleep, 200
  Click, left,235,1120,4
  Return
}
else
  MsgBox,4112,Fatal Error, Program not supported
Return

Open in new window



Thank you for your help.
20191003_175954-testing-document-reco.7z
Avatar of Joe Winograd
Joe Winograd
Flag of United States of America image

Click,left,235,1120,4
The X and Y coordinates (235,1120) depend on the value of CoordMode. What is the value of CoordMode when the hotstring fires? If you haven't changed the value of CoordMode, the X and Y coordinates are relative to the active window...is that what you want? In other words, is that the X/Y location of the document recovery pane button in Excel?

Also, the 4 param at the end means to click the mouse four times...is that what you want?

As I've sometimes wondered in your questions, why are you trying to automate a single mouse click? That's not typically what we're after in Windows automation work. Regards, Joe
Avatar of Luis Diaz

ASKER


In other words, is that the X/Y location of the document recovery pane button in Excel?
Yes it is the case as you can see in the video X/Y location are in line with the close button. What I would like to understand is why the click is not properly performed.

Also, the 4 param at the end means to click the mouse four times...is that what you want?
I send 4 clicks to reconfirm the click but even with 4 click it doesn't work.
I don't know if there is a way in AutoHotkey to play with the speed of the click if I slow down the speed probably the click can work.

 why are you trying to automate a single mouse click
I use keyboard in Excel for 90% of the actions as a result I would like to automate this flow. I dislike use the mouse.
ASKER CERTIFIED SOLUTION
Avatar of Joe Winograd
Joe Winograd
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Joe,

I realized that the mouseclick was not the most appropriate.
I also try to send {Enter} to catch the button without success.
I also found that there is another way to close recovery document pane control through sending F6 *2 Tab *3 and Enter.
If I see the necessity to add to my AutoHotkey file I will do it but for the moment and as recommended the best is to maintain this action through the mouseclick.
Thank you for your help.
Hi Luis,
I wrote a post for you a couple of days ago but neglected to upload it. As you know, I write all of my posts offline in my fav text editor and then post them online via copy/paste. In this case, I wrote the comment, but then got sidetracked by something else, and wound up never posting it for you. Fortunately, I have an AutoHotkey script that saves all my copied text. :) So, I was able to dig it up (time-stamped 4-Oct-19 10:33:36). It is below. Regards, Joe

Hi Luis,
First, let me say that the video is very helpful...and even more so with your spoken commentary. After watching it, I could see right away what the problem is, namely, when you type the hotstring into the cell, Excel thinks that you are still doing data entry in that cell...it won't let you click the Close button until you finish the data entry in that cell. There are many ways to solve that problem...here are two:

(1) Make it a hotkey instead of a hotstring so that Excel doesn't think you're doing data entry in that cell.

(2) Send an Enter key before you do the Click. That will close out the data entry in the cell. In other words, put this code before the Click command:

Send {Enter} ; send Enter key to end data entry in the cell
Sleep,100 ; as always, experiment to get a Sleep time that works

Open in new window

Regards, Joe