Take screenshot and upload the same screenshot | OpenFileDialog Control

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
newbie007
Posts: 20
Joined: 21 Jan 2022, 06:34

Take screenshot and upload the same screenshot | OpenFileDialog Control

09 Jun 2022, 00:24

Hello everyone,

I want to take screenshot of a specific area of my screen and save it somewhere, then I want to upload it on any website with a FileDialog.

1. Which is the best method to do the first step? Can I take a screenshot of a specific area and directly save it somewhere in autohotkey? Also delete it after uploading it?

2. Is it possible to control the OpenFileDialog without ImageSearch in AHK? Like navigating where I saved the screenshot and select it etc.

I'm asking a way without methods like ImageSearch because I want to run the script on many other PC's, so wouldn't it be safer if we click on objects (like a button in OFD) rather than ImageSearch since it wouldn't fit when the resolution changes?

I wanted to automate the website part with selenium or Rufaydium, which one is better? Since you guys have experience with both. I would like to know what professional coders think of those. Or another web automation library?


Thanks in advance
Lepes
Posts: 141
Joined: 06 May 2021, 07:32
Location: Spain

Re: Take screenshot and upload the same screenshot | OpenFileDialog Control

09 Jun 2022, 01:05

I use this modified version of ScreenClipper by Learning One.
It saves screenshot on D:/temp and uses Datetime to name it: dd_mm_yyyy__hh_mm_ss
It also copy the new filename to the Clipboard, so, if you already have a FileDialog, you can just paste on it (Filename TextBox, or EditBox not sure how you call it).
I really don't understand what "FileDialog" you have. I mean, a FileDialog is part of Windows and some application just call it when you want to save or load from a file. So it relay on the application you are using. Most time Ctrl + O call Open File Dialog and maybe CTRL + S or CTRL + G call Save File Dialog; maybe you can Send those Shortcut from AutoHotkey to the active window.

If you already have a website to upload it, you can use: Run, www.theweb.com
Attachments
ScreenClipper.ahk
(87.79 KiB) Downloaded 35 times
newbie007
Posts: 20
Joined: 21 Jan 2022, 06:34

Re: Take screenshot and upload the same screenshot | OpenFileDialog Control

09 Jun 2022, 01:20

Lepes wrote:
09 Jun 2022, 01:05
I use this modified version of ScreenClipper by Learning One.
It saves screenshot on D:/temp and uses Datetime to name it: dd_mm_yyyy__hh_mm_ss
It also copy the new filename to the Clipboard, so, if you already have a FileDialog, you can just paste on it (Filename TextBox, or EditBox not sure how you call it).
I really don't understand what "FileDialog" you have. I mean, a FileDialog is part of Windows and some application just call it when you want to save or load from a file. So it relay on the application you are using. Most time Ctrl + O call Open File Dialog and maybe CTRL + S or CTRL + G call Save File Dialog; maybe you can Send those Shortcut from AutoHotkey to the active window.

If you already have a website to upload it, you can use: Run, www.theweb.com
Thanks for your answer.

Although I'm not searching an advanced Screenshot tool, I can take the screenshot with LightShot or any similar light-weight tool.

I also want to automate all the stuff. So the question is, can find and press a button or a text field in an OpenFileDialog (Windows standard) and press it.

Like here;
https://prnt.sc/-7HQZkO_NK6r

You see that the name of the button is Button1, can I find it also within AHK ? If yes, how do I find the ClassNN Object?
BoBo
Posts: 6564
Joined: 13 May 2014, 17:15

Re: Take screenshot and upload the same screenshot | OpenFileDialog Control

09 Jun 2022, 01:51

What's the web service link you wanna upload the file to?
newbie007
Posts: 20
Joined: 21 Jan 2022, 06:34

Re: Take screenshot and upload the same screenshot | OpenFileDialog Control

09 Jun 2022, 02:05

BoBo wrote:
09 Jun 2022, 01:51
What's the web service link you wanna upload the file to?
One with an OpenFileDialog when you press on "Choose Image" like this one
https://prnt.sc/
BoBo
Posts: 6564
Joined: 13 May 2014, 17:15

Re: Take screenshot and upload the same screenshot | OpenFileDialog Control

09 Jun 2022, 03:20

@newbie007 - You can detect that pages Upload-Button ("Wähle Bilder aus") using UIAViewer.exe or AccViewer.exe (where btw, that button has the acc-path '4.1.1.2.2.2.4.1.1.1.1.1' (Chrome Version 102.0.5005.62 (Official Build - 64-Bit)). Once OpenFileDialog opens you can enter the full path of your screenshot/image to its filename/Dateiname-field (that should have the focus already). That will simply overwrite the Dialogs preset/default filepath, without forcing you to meander through a directory tree beforehand. HTH, good luck :)

Edit: meanwhile UIAViewer can detect acc-paths! As explained here: viewtopic.php?p=467030#p467030
Well, as its developer mentioned explicitly: "... but I think I don't want to work with legacy code anymore (Oleacc/MSAA is not actively being developed anymore, but UIA is)". So, going with UIA is preferable.
newbie007
Posts: 20
Joined: 21 Jan 2022, 06:34

Re: Take screenshot and upload the same screenshot | OpenFileDialog Control

10 Jun 2022, 05:40

BoBo wrote:
09 Jun 2022, 03:20
@newbie007 - You can detect that pages Upload-Button ("Wähle Bilder aus") using UIAViewer.exe or AccViewer.exe (where btw, that button has the acc-path '4.1.1.2.2.2.4.1.1.1.1.1' (Chrome Version 102.0.5005.62 (Official Build - 64-Bit)). Once OpenFileDialog opens you can enter the full path of your screenshot/image to its filename/Dateiname-field (that should have the focus already). That will simply overwrite the Dialogs preset/default file path, without forcing you to meander through a directory tree beforehand. HTH, good luck :)

Edit: meanwhile UIAViewer can detect acc-paths! As explained here: viewtopic.php?p=467030#p467030
Well, as its developer mentioned explicitly: "... but I think I don't want to work with legacy code anymore (Oleacc/MSAA is not actively being developed anymore, but UIA is)".
So, going with UIA is preferable.
I read that but what do you guys mean with "Acc"? I'm not that advanced :D
User avatar
boiler
Posts: 17319
Joined: 21 Dec 2014, 02:44

Re: Take screenshot and upload the same screenshot | OpenFileDialog Control

10 Jun 2022, 05:58

See Microsoft Active Accessibility (MSAA). That interface allows for accessing text associated with controls that otherwise wouldn’t be available. An AHK library supporting MSAA was posted here.

Return to “Ask for Help (v1)”

Who is online

Users browsing this forum: Google [Bot], Yahoo [Bot] and 109 guests