Display resizable website in resizable GUI (using chrome- or Firefox Browser) Topic is solved

Ask for help, how to use AHK_H, etc.
ADi1024
Posts: 4
Joined: 10 Mar 2020, 05:39

Display resizable website in resizable GUI (using chrome- or Firefox Browser)

10 Mar 2020, 06:32

[NOOBALARM]

Hello everyone,
I'm trying to display any websites in a resizable GUI and don't know how to make the actual website resize while I'm resizing my GUI window.
But most importantly, I'm hoping to be able to display the page by using either Chrome, Firefox or Edge browser as apposed to IE.
Thank you in advance!

Here's my code so far:

Code: Select all

#SingleInstance force
#NoEnv  ; Recommended for performance and compatibility with future AutoHotkey releases.
; #Warn  ; Enable warnings to assist with detecting common errors.
SendMode Input  ; Recommended for new scripts due to its superior speed and reliability.
SetWorkingDir %A_ScriptDir%  ; Ensures a consistent starting directory.

gui +resize
Gui Add, Edit, w1080 r1 vURL, www.google.com			
URL=www.google.com
Gui Add, ActiveX, xm w1080 h920 vWB, Shell.Explorer
Gui Show,, Fenster
Gui, Maximize
WB.Silent := True
WB.Navigate(URL)
ComObjConnect(WB, WB_events)

Loop 6
{
    Gui Flash
    Sleep 500
}

class WB_events
{
    NavigateComplete2(wb, NewURL)
    {
        GuiControl,, URL, %NewURL%  ; Update the URL edit control.
    }
}

ESC::
	ExitApp
	
kyuuuri
Posts: 340
Joined: 09 Jan 2016, 19:20

Re: Display resizable website in resizable GUI (using chrome- or Firefox Browser)

10 Mar 2020, 08:40

The problem is that you use an specific width and height for the ActiveX control. You can hook the resize message using onMessage to use a function that resizes the control according to the new gui size.
HotKeyIt
Posts: 2364
Joined: 29 Sep 2013, 18:35
Contact:

Re: Display resizable website in resizable GUI (using chrome- or Firefox Browser)

10 Mar 2020, 09:47

Since you posted in AHK_H, see Gui features:

Code: Select all

#SingleInstance force
#NoEnv  ; Recommended for performance and compatibility with future AutoHotkey releases.
; #Warn  ; Enable warnings to assist with detecting common errors.
SendMode Input  ; Recommended for new scripts due to its superior speed and reliability.
SetWorkingDir %A_ScriptDir%  ; Ensures a consistent starting directory.

gui +resize
Gui Add, Edit, w100 aw r1 vURL, www.google.com			
URL=www.google.com
Gui Add, ActiveX, aw ah xm w100 h100 vWB, Shell.Explorer
Gui Show,, Fenster
Gui, Maximize
WB.Silent := True
WB.Navigate(URL)
ComObjConnect(WB, WB_events)

Loop 6
{
    Gui Flash
    Sleep 500
}

class WB_events
{
    NavigateComplete2(wb, NewURL)
    {
        GuiControl,, URL, %NewURL%  ; Update the URL edit control.
    }
}

ESC::
	ExitApp
ADi1024
Posts: 4
Joined: 10 Mar 2020, 05:39

Re: Display resizable website in resizable GUI (using chrome- or Firefox Browser)

11 Mar 2020, 03:54

kyuuuri wrote: The problem is that you use an specific width and height for the ActiveX control. You can hook the resize message using onMessage to use a function that resizes the control according to the new gui size.
Thanks kyuuuri,
would you have an example of that.
I don't seem to be smart enough to understand the functions explanation in the help documentation.
kyuuuri
Posts: 340
Joined: 09 Jan 2016, 19:20

Re: Display resizable website in resizable GUI (using chrome- or Firefox Browser)

11 Mar 2020, 07:36

ADi1024 wrote:
11 Mar 2020, 03:54
kyuuuri wrote: The problem is that you use an specific width and height for the ActiveX control. You can hook the resize message using onMessage to use a function that resizes the control according to the new gui size.
Thanks kyuuuri,
would you have an example of that.
I don't seem to be smart enough to understand the functions explanation in the help documentation.
Actually, HotKeyIt's example is way better and it's the right approach. Try it, it works fine.
ADi1024
Posts: 4
Joined: 10 Mar 2020, 05:39

Re: Display resizable website in resizable GUI (using chrome- or Firefox Browser)

11 Mar 2020, 08:30

HotKeyIt wrote:
10 Mar 2020, 09:47
Since you posted in AHK_H, see Gui Broken Link for safety features:

Code: Select all

#SingleInstance force
#NoEnv  ; Recommended for performance and compatibility with future AutoHotkey releases.
; #Warn  ; Enable warnings to assist with detecting common errors.
SendMode Input  ; Recommended for new scripts due to its superior speed and reliability.
SetWorkingDir %A_ScriptDir%  ; Ensures a consistent starting directory.

gui +resize
Gui Add, Edit, w100 aw r1 vURL, www.google.com			
URL=www.google.com
Gui Add, ActiveX, aw ah xm w100 h100 vWB, Shell.Explorer
Gui Show,, Fenster
Gui, Maximize
WB.Silent := True
WB.Navigate(URL)
ComObjConnect(WB, WB_events)

Loop 6
{
    Gui Flash
    Sleep 500
}

class WB_events
{
    NavigateComplete2(wb, NewURL)
    {
        GuiControl,, URL, %NewURL%  ; Update the URL edit control.
    }
}

ESC::
	ExitApp
Thank you HotKeyIt,
that was a mistake (posting in Hotkey_H).
I'm only using Autohotkey. Is there a good example you could share with me, similar to your first example? I like that approach
:thumbup:
ADi1024
Posts: 4
Joined: 10 Mar 2020, 05:39

Re: Display resizable website in resizable GUI (using chrome- or Firefox Browser)

11 Mar 2020, 10:02

Cool, thanks @HotKeyIt!
Now I have some digging to do :)
Also, to my 2nd question, is there a way to use a different browser than the Internet Explorer?

Return to “Ask for Help”

Who is online

Users browsing this forum: No registered users and 2 guests