AutoHotkey: insert-image & attach file on EE site

Hello experts,
I would like to set up an AutoHotkey script to swiftly manage the following EE processes executed on a regular basis:
Insert-image which requires 3 mouse click:
Embed-image-1.pngEmbed-image-2.pngAttach a file which requires 3 mouse click:
Attach-file.pngI am aware that mouse click is complicated to manage with AutoHotkey however there must be a smart and swiftly way to manage this.
If you have some feedback and advice on this, please let me know.
Thank you for your help.
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
Joe WinogradDeveloper
Fellow 2017
Most Valuable Expert 2018

Commented:
Hi Luis,

I'm working on an AutoHotkey script to do this...I'm calling it InsertImageEE. As always, you'll be able to include it in your main AutoHotkey hotkeys/hotstrings script with whatever hotkey or hotstring you want. My design of InsertImageEE currently has two assumptions:

(1) The full path of the image file to embed will be on the clipboard before you fire the InsertImageEE hotkey/hotstring.

(2) The cursor will be positioned in an active EE Comment box before you fire the InsertImageEE hotkey/hotstring.

Are you OK with those two assumptions? If not, how would you like it to work? Regards, Joe
Luis DiazIT consultant

Author

Commented:
Hi Joe,
Thank you for your comment.
I am ok with those two assumptions.
Thank you again.
Joe WinogradDeveloper
Fellow 2017
Most Valuable Expert 2018

Commented:
Hi Luis,
Attached is a short video (less than a minute) demonstrating where the AutoHotkey script stands right now. Everything that you see in the video after I typed the hotstring is completely automated...I didn't touch the mouse or keyboard after the hotstring fired. Is this what you want or are you looking for something else? Regards, Joe
InsertImageEE.mp4
Luis DiazIT consultant

Author

Commented:
Joe, I saw the video and it is exactly what I am looking for. I was wondering if we can add a preliminary control in case I forgot to copy the path before calling the script. I was thinking to preliminary check if clipboard is empty return and don't execute the script.
Let me know what do you think.
Joe WinogradDeveloper
Fellow 2017
Most Valuable Expert 2018

Commented:
> it is exactly what I am looking for

Glad to hear it.

> I was thinking to preliminary check if clipboard is empty return and don't execute the script.

It already does that. In fact, it does one better...it checks that the file exists. It's actually a good example of a question you asked earlier about IfWinNotExist being deprecated and how to do the "opposition" of WinExist. Here's the code for your viewing pleasure:

If (!FileExist(UploadFile))
{
  MsgBox,4144,Error,File name on clipboard does not exist:`n%UploadFile%
  Return
}

Open in new window


Regards, Joe
Luis DiazIT consultant

Author

Commented:
Excellent Joe!
So your opinion and preference about opposition is to use ! instead of Not?
Thank you for your help.
Joe WinogradDeveloper
Fellow 2017
Most Valuable Expert 2018

Commented:
It's a matter of preference/style, although there is one important technical difference, namely, NOT has a lower precedence than the ! operator. That never matters to me because I don't like relying on implicit operator precedence in languages...I always force explicit precedence with parentheses...but that's me. :) Anyway, for reasons that I can't explain, I prefer to use ! as the NOT Boolean, yet prefer to use AND rather than && and OR rather than ||. For me, it's clarity and readability of code, but I can see how someone would think differently on it. Regards, Joe
Luis DiazIT consultant

Author

Commented:
Thank you Joe for your feedback!
Luis DiazIT consultant

Author

Commented:
Hi Joe,

I was wondering if you have some updates about this question? I will be happy to test if you have some update about it.

Thank you in advance for your help.
Joe WinogradDeveloper
Fellow 2017
Most Valuable Expert 2018

Commented:
Hi Luis,
I completed the AutoHotkey script (it is 104 lines of code). I decided to publish a two-part EE video Micro Tutorial series with the solution. The first one discusses the program; the second one is a demo with Chrome and Firefox. I completed both videos...first one is 5:31; second one is 5:22. Now I'm working on the Decsription and Steps for them. I hope to publish them this weekend and I've been in touch with an Experts Exchange Article/Video Editor who said that he'll review them for publication as soon as I complete them. Regards, Joe
Luis DiazIT consultant

Author

Commented:
Ok, Thank you for your feedback.
Developer
Fellow 2017
Most Valuable Expert 2018
Commented:
Hi Luis,
While working on the two five-minute EE video Micro Tutorials during the weekend, I decided that I want to enhance the AutoHotkey script and re-record the videos. However, since you seem to be eager for this solution, I'll send you the current script and videos in a PM. But I do not want to publish the script and/or videos in their current state, so please consider them to be for your personal use and not for further dissemination. Thanks, Joe
Luis DiazIT consultant

Author

Commented:
Hi Joe,
I understand. I will consider them exclusively for personal use and I will not create new questions related to them.
They will help me a lot and allows me to effectively create question at EE.
Joe WinogradDeveloper
Fellow 2017
Most Valuable Expert 2018

Commented:
Thanks for your cooperation, Luis...much appreciated! Regards, Joe
Luis DiazIT consultant

Author

Commented:
Thank you Joe!
Joe WinogradDeveloper
Fellow 2017
Most Valuable Expert 2018

Commented:
For other EE members following this thread, here's an update. Luis and I have been working on it via PM. I don't feel confident enough of the AutoHotkey script, or even of the method (based on ImageSearch) to expose it yet to a broad audience here.

Luis ran into the issues that I anticipated, particularly ImageSearch coming back with ErrorLevel=1, which means that the image was not found in the specified region. Luis eventually got the ImageSearch calls to work by creating his own images and changing the ImageSearch variation factor, which is a number between 0 and 255 that indicates the permitted variation for the shades/intensity of the RGB components of the pixels (he found that a variation of 10 worked well, whereas I did better with a variation of 25).

Luis is now working on extending it to other areas where files are uploaded in EE, such as Attach File under the standard Comment box and Attach File under the message box in a PM. Regards, Joe

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial