Post
by mikeyww » 05 Feb 2023, 07:23
Hello,
Here is how the script works. It waits for the button to be released. It then sends "v" to the context menu, triggering the "Save Image As..." menu option. It then gets the text from the edit control, which contains the file name. It prepends the user's desktop path. If that file already exists, the existing file is recycled. The edit control is updated to include the full path with the desktop. A line feed or Enter is sent to submit the dialog and save the file. The file is then opened by the default image viewer. It may be possible to use ControlClick instead of Enter, but my success with ControlClick varies.
In testing the script, I found that the sleeps are important, because some of the steps, such as setting the control and saving the file, take significant time. If you increase the sleeps, the script should be OK. The script contains three sleeps. If you receive the error when the dialog window is visible, increase the second sleep. Otherwise, increase the third sleep. I experienced the same error in my testing, which is why I increased the second sleep, but I showed it only in my v2 script as posted.
There are undoubtedly some other ways to save images on Web pages, too. This is a relatively simple approach that would typically work.