Internet Explorer controls: scrollbars, borders, navigation sounds, image dimensions

Get help with using AutoHotkey and its commands and hotkeys
User avatar
jeeswg
Posts: 6718
Joined: 19 Dec 2016, 01:58
Location: UK

Internet Explorer controls: scrollbars, borders, navigation sounds, image dimensions

06 Jun 2018, 08:36

- Here is an example GUI which navigates through various animated gifs.

- I was wondering if it was possible to improve the following:
- borders - remove these
- scrollbars - hide these (the scrollbars are hidden, but after appearing briefly)
- navigation sounds - prevent this
- image dimensions - retrieve these [if IE controls could be used to retrieve the dimensions for an image that could be quite useful, using Explorer file properties is language specific, and using WIA.ImageFile objects potentially requires an install, also IE controls may handle more formats than Gdip]

Code: Select all

#SingleInstance force
Gui, New, +HwndhGui, MyWinTitle
Gui, Add, ActiveX, w300 h300 voWB, Shell.Explorer

;AHK animated gif avatars:
;evilC
vUrl3 := "https://autohotkey.com/boards/download/file.php?avatar=57828_1463689727.gif"
;Flipeador:
vUrl2 := "https://autohotkey.com/boards/download/file.php?avatar=60315_1438538280.gif"
;hoppfrosch:
vUrl1 := "https://autohotkey.com/boards/download/file.php?avatar=198_1381214069.gif"

vZoom := 200
vSleep := 7000
Loop, 3
{
	vUrl := vUrl%A_Index%
	if !(A_Index = 1)
		Sleep, % vSleep
	oWB.Navigate(vUrl)
	while oWB.busy || !(oWB.ReadyState = 4)
		Sleep, 100
	oWB.document.body.scroll := "no"
	if (A_Index = 1)
	{
		;OLECMDID_OPTICAL_ZOOM := 63 ;OLECMDEXECOPT_DONTPROMPTUSER := 2
		oWB.ExecWB(63, 2, vZoom, 0)
		Gui, Show, w300 h300
	}
}
return

GuiClose:
ExitApp
return
- Related issue. It is possible to display an image via html, but I have still been unable to display an svg image via html. An alternative is to specify an image path/url as the url to navigate to, svg images display if I do this.
show svg/wdp/jxr/animated gif image files in a GUI - AutoHotkey Community
https://autohotkey.com/boards/viewtopic.php?f=5&t=28658
homepage | tutorials | wish list | fun threads | donate
WARNING: copy your posts/messages before hitting Submit as you may lose them due to CAPTCHA
A_AhkUser
Posts: 1076
Joined: 06 Mar 2017, 16:18
GitHub: AAhkUser
Location: France

Re: Internet Explorer controls: scrollbars, borders, navigation sounds, image dimensions

07 Jun 2018, 03:30

jeeswg wrote: - I was wondering if it was possible to improve the following:
- borders - remove these
- scrollbars - hide these (the scrollbars are hidden, but after appearing briefly)
- navigation sounds - prevent this
- image dimensions - retrieve these [if IE controls could be used to retrieve the dimensions for an image that could be quite useful, using Explorer file properties is language specific, and using WIA.ImageFile objects potentially requires an install, also IE controls may handle more formats than Gdip]
Just my two cents. Btw, as for me, no sound is emitted when navigating web pages.

Code: Select all

#NoEnv
#SingleInstance force
SetWorkingDir % A_ScriptDir
SendMode, Input
CoordMode, ToolTip, Screen
#Warn
; Windows 8.1 64 bit - Autohotkey v1.1.28.00 32-bit Unicode

Gui, New, +HwndhGui, MyWinTitle
Gui, Add, ActiveX, x0 y0 w900 h300 vHTMLDoc -VScroll -HScroll, about:<!DOCTYPE html><meta http-equiv="X-UA-Compatible" content="IE=edge">
GUI, Show, w500 h500
sleep, 1000
HTMLDoc.ExecWB(63, 2, 400, 0)
HTMLDoc.document.body.style.background := "#000000"
HTMLDoc.document.body.style.setAttribute("overflow-y", "hidden") ; remove scrollbars (maybe)
HTMLDoc.document.body.style.setAttribute("margin", 0) ; remove borders (maybe)
sPic1 := picCreateAndGetStyle(HTMLDoc, "https://autohotkey.com/boards/download/file.php?avatar=57828_1463689727.gif", w, h)
MsgBox % w "," h
sPic2 := picCreateAndGetStyle(HTMLDoc, "https://autohotkey.com/boards/download/file.php?avatar=60315_1438538280.gif", w, h)
MsgBox % w "," h
sPic3 := picCreateAndGetStyle(HTMLDoc, "https://autohotkey.com/boards/download/file.php?avatar=198_1381214069.gif", w, h)
MsgBox % w "," h
return

!i::sPic1.display := "inline", sPic2.display := "none", sPic3.display := "none"
!j::sPic2.display := "inline", sPic1.display := "none", sPic3.display := "none"
!k::sPic3.display := "inline", sPic1.display := "none", sPic2.display := "none"

picCreateAndGetStyle(_HTMLDocument, _src, ByRef _width:="", ByRef _height:="") {
_pic := _HTMLDocument.document.createElement("img"), _pic.src := _src
_pic.style.margin := 0, _pic.style.padding := 0 ; remove 'borders' ?
_pic.style.display := "none" ; initially hidden
_HTMLDocument.document.body.appendChild(_pic)
_width := _pic.width, _height := _pic.height
return _pic.style
}
Cheers
User avatar
jeeswg
Posts: 6718
Joined: 19 Dec 2016, 01:58
Location: UK

Re: Internet Explorer controls: scrollbars, borders, navigation sounds, image dimensions

07 Jun 2018, 04:18

- Thanks so much for this. I have tested it and will take a closer look at it when I get the chance. It seems like you've managed to have a good go at tackling all of the problems, even setting the background colour, which I'd thought about but hadn't mentioned.
- That's very interesting the use of an img element. I had thought that simply displaying an image at 100% zoom, and retrieving the rectangle's dimensions, could be one of the simplest most widely compatible ways (for many OSes/file formats/language settings) to retrieve an image's dimensions, except that I had never done anything like that before. I see that you used createElement.
- Sometimes using html or GUI elements can make possible a good hack to achieve certain things e.g. html to/from plaintext via an HTMLFile object, or rtf to plaintext via a RichEdit control.
- I noticed, searching online, a distinction between margin/border/padding.
- I had tried some things with document.body.style without success.
- I had wondered if maybe css or writing html was necessary, although hoped to avoid it.
- I couldn't find a good source of information for the Internet Explorer_Server control, e.g. window styles/extended styles, options.
- I'd had luck with finding a setting relating to scrollbars, and had wondered if any other basic things were available.
- So, a lot to think about. Thanks again.
homepage | tutorials | wish list | fun threads | donate
WARNING: copy your posts/messages before hitting Submit as you may lose them due to CAPTCHA
User avatar
jeeswg
Posts: 6718
Joined: 19 Dec 2016, 01:58
Location: UK

Re: Internet Explorer controls: scrollbars, borders, navigation sounds, image dimensions

08 Jun 2018, 04:27

- Btw I was wondering if the image could be stretched in one direction only cf. zoomed where it changes size but maintains its proportions. I.e. when you pass the image path as the url to navigate to.
- Issues to do with svg files persist. I.e. how to display an svg within or as html, versus passing the svg image path as the url to navigate to.

- [EDIT:] The svg issues are resolved here:
show svg/wdp/jxr/animated gif image files in a GUI - AutoHotkey Community
https://autohotkey.com/boards/viewtopic.php?f=5&t=28658
homepage | tutorials | wish list | fun threads | donate
WARNING: copy your posts/messages before hitting Submit as you may lose them due to CAPTCHA
A_AhkUser
Posts: 1076
Joined: 06 Mar 2017, 16:18
GitHub: AAhkUser
Location: France

Re: Internet Explorer controls: scrollbars, borders, navigation sounds, image dimensions

29 Mar 2019, 09:35

To disable navigation sounds (probably) here you go: joedf/Webapp.ahk#L84.
jeeswg wrote:
08 Jun 2018, 04:27
The svg issues are resolved here[...]
I had not seen the update - this is really great; also, I did not know about the refresh method. Thanks for this.
User avatar
jeeswg
Posts: 6718
Joined: 19 Dec 2016, 01:58
Location: UK

Re: Internet Explorer controls: scrollbars, borders, navigation sounds, image dimensions

29 Mar 2019, 12:18

That's great, thanks so much A_AhkUser.
If I add this to the example code in the OP, below the Gui, Add, ActiveX line:

Code: Select all

;FEATURE_DISABLE_NAVIGATION_SOUNDS := 21
;SET_FEATURE_ON_PROCESS := 0x2
DllCall("urlmon\CoInternetSetFeatureEnabled", "Int",21, "UInt",0x2, "Int",1)
Then navigation sounds are disabled!

This post, by MrBubbles, is mentioned in the Webapp.ahk GitHub link:
Webapp.ahk - Make web-based apps with AutoHotkey - Page 2 - AutoHotkey Community
https://autohotkey.com/boards/viewtopic.php?f=6&t=21516&p=117029#p117029
homepage | tutorials | wish list | fun threads | donate
WARNING: copy your posts/messages before hitting Submit as you may lose them due to CAPTCHA

Return to “Ask For Help”

Who is online

Users browsing this forum: Bing [Bot], Google [Bot], mladpetco and 197 guests