SavePictureAs - (Save Image/Picture)

Post your working scripts, libraries and tools for AHK v1.1 and older
User avatar
BGM
Posts: 507
Joined: 20 Nov 2013, 20:56
Contact:

Re: SavePictureAs - (Save Image/Picture)

27 May 2018, 15:44

Also, if I choose "restart SavePictureAs" from the tray menu, it erases many of my carefully chosen settings.
User avatar
DataLife
Posts: 447
Joined: 29 Sep 2013, 19:52

Re: SavePictureAs - (Save Image/Picture)

27 May 2018, 17:40

@BGM
thanks for the compliments and constructive criticism. I do appreciate both.

I agree with the too many screens during setup. That is on my list. I have been working on SavePictureAs for 10 years. It was easier to add a screen then it was to rewrite alot of code to simplify the screens.

Here are my proposed changes. What do you think?
[uncompiled planned changes]
- Keep (UAC information)
- Keep (Configure Hotkeys & Folders)
- Keep (Setup is complete)

- remove SplashScreen (explains portable and installer option)
- remove New Features (Capturing active, entire and selected areas)
- remove Create shortcuts (desktop and start with windows)
- remove Change System Tray Icon
- remove Survey feedback
- remove Saving Picture Mode

[compiled planned changes]
- Keep Installer or Portable options screen
- Keep Select Destination Location (Innosetup screen)
- Keep Select Start Menu Folder (Innosetup screen)
- Keep Ready to Install (Innosetup screen)
- Keep Completing the SavePictureAs Setup Wizard "Start SavePictureAs Now" (Innosetup screen)
- Keep (UAC information)
- Keep (Configure Hotkeys & Folders)
- Keep (Setup is complete)

- remove SplashScreen (General information)
- remove New Features (Capturing active, entire and selected areas)
- remove Create shortcuts (desktop and start with windows)
- remove Change System Tray Icon
- remove Survey feedback
- remove Saving Picture Mode

thanks
Datalife
Last edited by DataLife on 29 May 2019, 13:09, edited 1 time in total.
Check out my scripts. (MyIpChanger) (ClipBoard Manager) (SavePictureAs)
All my scripts are tested on Windows 10, AutoHotkey 32 bit Ansi unless otherwise stated.
User avatar
DataLife
Posts: 447
Joined: 29 Sep 2013, 19:52

Re: SavePictureAs - (Save Image/Picture)

27 May 2018, 17:44

BGM wrote:Also, if I choose "restart SavePictureAs" from the tray menu, it erases many of my carefully chosen settings.
Here is the code for the restart

Code: Select all

ReloadSavePictureAs:
Reload
return
What folder is SavePictureAs located in?
Are you using the uncompiled script?
Settings are not saved on the "Additional Settings" screen until you click the Apply & Close button. If you restart SavePictureAs before clicking Apply & Close then the settings will not be saved.
Please tell me what settings were changed or lost. I do not see how that is possible. I did have one user that put SavePictureAs in a non writable folder. So of course the settings could not be saved.

thanks
DataLife
Last edited by DataLife on 27 May 2018, 17:52, edited 1 time in total.
Check out my scripts. (MyIpChanger) (ClipBoard Manager) (SavePictureAs)
All my scripts are tested on Windows 10, AutoHotkey 32 bit Ansi unless otherwise stated.
User avatar
BGM
Posts: 507
Joined: 20 Nov 2013, 20:56
Contact:

Re: SavePictureAs - (Save Image/Picture)

27 May 2018, 17:46

Well, I like the idea of being able to choose portable or installed. Maybe this could be in the installer itself? Right now, that part is kind of confusing. But you sure propose to remove a lot of windows! That's really great, I think. I would say that upon installation, he should only be asked as few questions as necessary.
If you have your feedback link in the about menu, that would be sufficient, I think.

However, "create shortcuts" and "start with windows" could be an option in the installer windows - it's pretty typical to ask that during setup process.
User avatar
DataLife
Posts: 447
Joined: 29 Sep 2013, 19:52

Re: SavePictureAs - (Save Image/Picture)

27 May 2018, 17:49

BGM wrote:On my Windows, the "SavePictureAs" dialogue has it's text cut off partway through. Looks like the panel is a bit too small.

screenshot_[SavePictureAs]_002.png

Just sayin!
This may have something to do with the dpi that your computer is set to.

I have mine at set to 96 dpi which is what windows calls 100 percent.

You can see what yours is set for with...

Code: Select all

MsgBox % A_ScreenDPI
See my SavePIctureAs dialogue screen here...https://www.dropbox.com/s/dz8c5xss59zgr ... e.PNG?dl=0

thanks
Datalife
Check out my scripts. (MyIpChanger) (ClipBoard Manager) (SavePictureAs)
All my scripts are tested on Windows 10, AutoHotkey 32 bit Ansi unless otherwise stated.
User avatar
DataLife
Posts: 447
Joined: 29 Sep 2013, 19:52

Re: SavePictureAs - (Save Image/Picture)

27 May 2018, 19:40

BGM wrote:It's set to 96.
I will make the gui's larger to display larger fonts. Please let me know if you see other screens that have display issues. Screenshots would be great.

The changes will be included in version 11.1 and I will update this thread when I release it.

Also, in the above post I replied to your issue of not saving changes on a restart.

thanks
Robert
Check out my scripts. (MyIpChanger) (ClipBoard Manager) (SavePictureAs)
All my scripts are tested on Windows 10, AutoHotkey 32 bit Ansi unless otherwise stated.
User avatar
BGM
Posts: 507
Joined: 20 Nov 2013, 20:56
Contact:

Re: SavePictureAs - (Save Image/Picture)

27 May 2018, 20:25

DataLife wrote:
BGM wrote:Also, if I choose "restart SavePictureAs" from the tray menu, it erases many of my carefully chosen settings.
What folder is SavePictureAs located in?
Are you using the uncompiled script?
Settings are not saved on the "Additional Settings" screen until you click the Apply & Close button. If you restart SavePictureAs before clicking Apply & Close then the settings will not be saved.
Please tell me what settings were changed or lost. I do not see how that is possible. I did have one user that put SavePictureAs in a non writable folder. So of course the settings could not be saved.
I know I clicked the apply & save button. But I lost the hotkey for the first save location, and the hotkey for renaming the last file. The latter I had saved in a previous time.
I'll play around with things for awhile and let you know if anything is amiss. I don't really have time to troubleshoot at the moment. But I appreciate your being zealous!
User avatar
BGM
Posts: 507
Joined: 20 Nov 2013, 20:56
Contact:

Re: SavePictureAs - (Save Image/Picture)

24 Jun 2019, 11:06

I'm still using this script! I like it quite abit. Sometime it misses and fails to save, but most of the time it works great.

Sometimes when I try to save images out of thunderbird, it tries to save the image as "mail.htm" and then tells me "This is not an savable picture".
So then I have to go and manually save it.

However, I do notice on these images, if I simply right-click to save as, then the default option is to save it as an htm file, too. I have to change the save-as dialogue to "* all files" and add the .jpg extension myself. I think that SPA is just using the save dialogue's defaults, but that it needs to be more specific, maybe.
User avatar
DataLife
Posts: 447
Joined: 29 Sep 2013, 19:52

Re: SavePictureAs - (Save Image/Picture)

24 Jun 2019, 19:08

BGM wrote:
24 Jun 2019, 11:06
I'm still using this script! I like it quite abit. Sometime it misses and fails to save, but most of the time it works great.

Sometimes when I try to save images out of thunderbird, it tries to save the image as "mail.htm" and then tells me "This is not an savable picture".
So then I have to go and manually save it.

However, I do notice on these images, if I simply right-click to save as, then the default option is to save it as an htm file, too. I have to change the save-as dialogue to "* all files" and add the .jpg extension myself. I think that SPA is just using the save dialogue's defaults, but that it needs to be more specific, maybe.
I don't use Thunderbird but it sounds like Thunderbird uses your default browser for browsing the web.

If you manually right click and choose Save As and the windows dialog box detects it as an htm file then there must be an issue between windows and that browser.

What browser does this happen in? If you could provide a link to the image that this happens with then I could figure out what is going on. I wonder if SavePictureAs is selecting "Save As" instead of "Save Image"

I only know of 2 ways to determine the image type in this context.
1. read the "Save As type" control when the Windows "Save As" dialog box is open (this apparently would not work if the default is htm)
2. read the file extension after the file is downloaded (uses save dialog's defaults) if SavePictureAs detects the file extension is htm then it knows it is not an image and presents the error message. It has been along time since I coded that part of the script. I did a quick search and so far this is all I see that filters invalid image extensions.

Code: Select all

if ( OutExtension = "htm" or OutExtension = "webarchive" or OutExtension = "html" or OutExtension = "xhtml")
Many years ago I started with the 1st option. That proved to be very unreliable for several reasons. One reason is the control does not have the same ID among the many browsers, I had difficulty retrieving some of the controls contents on some of the browsers even when I knew the ID.

So now I use option 2. All I have to do send right click, select Save Image As or Save Picture As depending on which browser then wait for the Save As window to open then click the Save button. The file is downloaded into an empty folder. Then I read the file extension of the only file in that folder and use it for the many user configurable file naming options.

Can you think of any other way that Autohotkey can determine the file type before the file is downloaded?
Check out my scripts. (MyIpChanger) (ClipBoard Manager) (SavePictureAs)
All my scripts are tested on Windows 10, AutoHotkey 32 bit Ansi unless otherwise stated.
User avatar
DataLife
Posts: 447
Joined: 29 Sep 2013, 19:52

Re: SavePictureAs - (Save Image/Picture)

24 Jun 2019, 23:03

@BGM
I just remembered that if you try to save a picture before the page completely loads the right click "Save image" / "Save Picture As" will try to save the page and not the picture. This was intermittent and I do not remember what browser I was using.
Check out my scripts. (MyIpChanger) (ClipBoard Manager) (SavePictureAs)
All my scripts are tested on Windows 10, AutoHotkey 32 bit Ansi unless otherwise stated.
User avatar
BGM
Posts: 507
Joined: 20 Nov 2013, 20:56
Contact:

Re: SavePictureAs - (Save Image/Picture)

25 Jun 2019, 11:55

@DataLife Thunderbird is the Mozilla mail client - it uses the same engines as Firefox beneath, though.

I'm pretty sure that SPA is choosing "save" and not "save as". If I save the image myself, it also saves as .htm. This doesn't happen on all images, just some of them. So I manually "save as" and then choose * all files and supply a .jpg extension myself in the save file text box.

I'd say this isn't something SPA is doing wrong. I have no idea why the email browser thinks the images are .htm - honestly, this surprises me. The thing is that only *some* of the images are that way. The rest are almost all jpgs. (My Mom sends me daily anthologies of cat and dog shame, mixed with various memes - sometimes they catch my fancy so I save about 1 in every 250 of them).

I can use "copy image" and the bitmap goes right to the clipboard as you'd think.

Here is the html from the message source's html. The image will "save" as: h2EE9EF0D.htm. Sometimes SPA will save it like that, other times it will tell me "This is not an savable picture"

Code: Select all

    <p><img class="resp-media lazyloaded" [b]src[/b]="https://i.chzbgr.com/full/3849905408/[b]h2EE9EF0D[/b]/" data-src="https://i.chzbgr.com/full/3849905408/h2EE9EF0D/" id="_r_a_3849905408" alt="r2d2 vacuum cleaner - 3849905408" title="R2D2 Totally Looks Like Vacuum cleaner" width="401" height="271"></p>
So, I'm wondering, if maybe SPA can detect the file extension, and if it is .htm, to switch it to .jpg?
Attachments
screenshot_MainType_001.png
screenshot_MainType_001.png (3.5 KiB) Viewed 3362 times
snipaste20190625_114503.png
snipaste20190625_114503.png (5.59 KiB) Viewed 3362 times
User avatar
DataLife
Posts: 447
Joined: 29 Sep 2013, 19:52

Re: SavePictureAs - (Save Image/Picture)

25 Jun 2019, 16:25

BGM...So, I'm wondering, if maybe SPA can detect the file extension, and if it is .htm, to switch it to .jpg?
What if it is not a jpg? Maybe it is a png, or bmp or some other video format.
Check out my scripts. (MyIpChanger) (ClipBoard Manager) (SavePictureAs)
All my scripts are tested on Windows 10, AutoHotkey 32 bit Ansi unless otherwise stated.
User avatar
BGM
Posts: 507
Joined: 20 Nov 2013, 20:56
Contact:

Re: SavePictureAs - (Save Image/Picture)

25 Jun 2019, 16:29

Yeah, I wondered about that, too. There's no way to know without doing some advanced analysis of the data arrangement after the file is gotten. You know what I mean - sometimes a certain bit order denotes what kind of file it is even if the extension is wrong. I'm not asking you to do *that* however.

But, I agree with your question - what it it's a png or gif, etc. No way to know! Hmmph!
User avatar
DataLife
Posts: 447
Joined: 29 Sep 2013, 19:52

Re: SavePictureAs - (Save Image/Picture)

25 Jun 2019, 17:22

I downloaded Thunderbird and the first picture I tried to save did not have an extension.

Here is a partial solution.

I can let SavePictureAs download the picture.

Get the image dimensions of the downloaded file.
In the Get Image Size code below if the file is not an image it returns 0x0.
If it is an image it returns the dimensions.
The function does not care what extension the file has, even no extension, but will only return valid dimensions for GIF, JPG, TIF and BMP
So if it returns dimensions then rename it JPG. The file that downloaded without an extension I renamed with JPG, Gif, PNG and BMP and my windows default image viewer displayed it properly.

Code: Select all

FileName := ("INBOX)4478.htm")
MsgBox, % ImageWxH(FileName)
ExitApp

;function found here https://autohotkey.com/board/topic/63697-filegetproperties/
ImageWxH(ImageFile) {
IfNotExist, %ImageFile%
  Return ""
Size=2592
DHW:=A_DetectHiddenWindows
DetectHiddenWindows, ON
Gui, 99:-Caption
Gui, 99:Margin, 0, 0
Gui, 99:Show,Hide w%Size% h%Size%, ImageWxH.Temporary.GUI
Gui, 99:Add, Picture, x0 y0 , % ImageFile
Gui, 99:Show,AutoSize Hide, ImageWxH.Temporary.GUI
WinGetPos, , ,w,h, ImageWxH.Temporary.GUI
Gui, 99:Destroy
DetectHiddenWindows, %DHW%
Return w "x" h
}
Check out my scripts. (MyIpChanger) (ClipBoard Manager) (SavePictureAs)
All my scripts are tested on Windows 10, AutoHotkey 32 bit Ansi unless otherwise stated.

Return to “Scripts and Functions (v1)”

Who is online

Users browsing this forum: No registered users and 241 guests