Jump to content

Sky Slate Blueberry Blackcurrant Watermelon Strawberry Orange Banana Apple Emerald Chocolate

Flash/HTML in Gui


  • Please log in to reply
17 replies to this topic
Flash/HTML in Gui
  • Guests
  • Last active:
  • Joined: --
Hey all,
Have you any idea to screen a flash element or a html file in the gui?
pleas can you help me with code...

SoLong&Thx4AllTheFish
  • Members
  • 4999 posts
  • Last active:
  • Joined: 27 May 2007
Did you search the forum? If you did you would have found the answer :wink:

  • Guests
  • Last active:
  • Joined: --
But in this code you can see that the buttons infront of the webpage how can i make it so that the webpage is left in a own controle?

000sixzeros000
  • Members
  • 43 posts
  • Last active: Apr 23 2011 08:11 AM
  • Joined: 17 Oct 2009
Ive searched hundreds of posts on this subject to no avail...it couldnt be more frustrating.

there used to be a thing called IE.ahk, that is no longer supported.. that would have done it..

most of the latest posts say to use COM.. but there are no examples of how to embed a HTML control into a GUI.. it seems to be assumed that just because there is a way to do this with COM that we should know how to modify the GUI to embed a control of this type into it.

tank has something called IWeb.. but I couldnt work out how that would display HTML within a specific custom GUI.. and theres that post asking for web recorder help... that is supposed to somehow allow you to create HTML documents..

The gui docs say to use some IE_functions .. and there are many examples around that use these functions.. but they are from IE.ahk and dont work anymore. The help sends you to a deprecated method which refers to another deprecated method, which refers to yet another deprecated method, which refers to the standard COM lib.. which then tells you how to do EVERYTHING under the sun EXCEPT how to display HTML within a custom gui.

If your head isnt bleeding after 5 hours of searching this forum to solve this problem, then my hat's off to you.

There are many examples of people loading hidden urls, and accessing DOM.. but this is not embedding a html control into a gui..

I would like to just load HTML into a variable and display it in my GUI or tooltip...

 htmlCSS:="<span style='background-color: #ffffff; color: #000000;'><font color=blaa><b>Anything</b></font></span>"

If I find a way to do it.. I will post it here.. because this is the first post you are sent to when looking for help on this subject.

a4u
  • Guests
  • Last active:
  • Joined: --

most of the latest posts say to use COM.. but there are no examples of how to embed a HTML control into a GUI..

I assume you mean this, which should lead you to this example. Since that example is a but a snippet of an actual example, see this post by Sean. Here's a stripped down version:
COM_AtlAxWinInit()

[color=DarkRed]Gui[/color], +Resize +LastFound

[color=DarkRed]Gui[/color], Show, w500 h500



pweb := COM_AtlAxCreateControl( [color=DarkRed]WinExist[/color](), [color=CornFlowerBlue]"Shell.Explorer"[/color])

COM_Invoke(pweb, [color=CornFlowerBlue]"Navigate2"[/color], [color=CornFlowerBlue]"http://www.autohotkey.com/forum/topic59563.html"[/color] )

[color=DarkRed]Return[/color]



GuiClose:

	[color=DarkRed]Gui[/color], Destroy

	COM_Release(pweb), COM_AtlAxWinTerm()

	[color=DarkRed]ExitApp[/color]


000sixzeros000
  • Members
  • 43 posts
  • Last active: Apr 23 2011 08:11 AM
  • Joined: 17 Oct 2009
lol, seriously.. I'm in awe..

jethrow
  • Moderators
  • 2854 posts
  • Last active:
  • Joined: 24 May 2009

I would like to just load HTML into a variable and display it in my GUI or tooltip...

This got me thinking, what about creating an HTML-Based GUI? Here is a basic example: ( NOTE - please excuse the blandness - I'm not a webpage developer :p)**THIS EXAMPLE WAS WRITTEN FOR AHKL v1.1.03

SKAN
  • Administrators
  • 9115 posts
  • Last active:
  • Joined: 26 Dec 2005
Crazy Scripting : MiniBrowser 27L for TamilDailyCalendar.com

000sixzeros000
  • Members
  • 43 posts
  • Last active: Apr 23 2011 08:11 AM
  • Joined: 17 Oct 2009
WOW jethrow, for a PHP/mysql/javascript guy trying to get his head around AHK, that is one hell of a helpful idea...

I just wanted to be able to display some dynamically formatted data, but to be able to also attach functions and write back into the document.. :shock:

Im assuming then that AHK could access the .innerHTML property of any element with just a ...

pweb.document.all.ELEMENTID.innerHTML:="blaaa"

where ELEMENTID is the ID of any DIV / SPAN, etc...

but now you have me wondering too.. does that mean we could we also call javascript functions? If so how would that work?
pweb.document.all.JS_FUNCTION_NAME() ?

000sixzeros000
  • Members
  • 43 posts
  • Last active: Apr 23 2011 08:11 AM
  • Joined: 17 Oct 2009
For any other newbs trying to this..
I was using tabs2 within a GUI and needed to display my html report under one of the tabs.. but it kept destroying all the other controls and tabs and flooding out to the edge of the gui....

Turns out you need to place the IE control inside another control, and reference that instead...

So after including COM.ahk and creating the basic GUI and tabs... you add a groupbox to bound the HTML, get the handle into a hwnd.. and create your explorer shell within it.

 ;create your GUI first.. then this will add a tab with IE in it..

   gui,tab,2
   Gui, Add, GroupBox, h400 hwndGroupArea, Html Area
   
   html:="<html><body><b>stuff </b>here</body></html>"
  
   COM_AtlAxWinInit()
   pweb := COM_AtlAxCreateControl( GroupArea, "Shell.Explorer") 
   COM_Invoke(pweb, "Navigate2", "" ) 
   COM_Invoke(pweb, "stop") 
   COM_Invoke(pweb, "document.write",html) 


GuiClose: 
   Gui, Destroy 
   COM_Release(pweb), COM_AtlAxWinTerm() 
   ExitApp



tank
  • Administrators
  • 4345 posts
  • AutoHotkey Foundation
  • Last active: Oct 13 2016 01:04 AM
  • Joined: 21 Dec 2007

does that mean we could we also call javascript functions? If so how would that work?
pweb.document.all.JS_FUNCTION_NAME() ?

pweb.document.parentwindow.execscript("JS_FUNCTION_NAME()")
this has so been explored like a gaggilion times tho
Never lose.
WIN or LEARN.

flyingDman
  • Spam Officer
  • 2186 posts
  • Last active: Nov 07 2015 08:15 AM
  • Joined: 27 Feb 2009
Taking 000sixzeros000 code and elaborating on it for browsers in multiple tabs. My code for Tabclick obviously does not work. Document.write seems to append to the existing html rather than overwriting it. Any suggestions on how to fix that?
Also, is there a groupbox style that make the border invisible? Looks a bit sloppy like this as the browser does not seem to fit neatly inside the groupbox outline.

#SingleInstance force

Gui, Add, Tab2, x1 y1 w820 h630 vMyTab gtabclick, tab1|tab2 
loop, 2 {
html%a_index% = <html><body>Page%a_index%</body></html>
Gui, Tab, %a_index%
Gui, Add, GroupBox, x10 y25 w800 h600 hwndGroupArea%a_index%, 
}
Gui, -caption +LastFound
Gui, Show, w820 h630

COM_AtlAxWinInit()
pweb1 := COM_AtlAxCreateControl( GroupArea1, "Shell.Explorer")
pweb2 := COM_AtlAxCreateControl( GroupArea2, "Shell.Explorer")
return

tabclick:
gui, submit, nohide
if mytab = tab1
{
COM_Invoke(pweb1, "stop")
COM_Invoke(pweb1, "document.write",html1)    
}
else if mytab = tab2
{
COM_Invoke(pweb2, "stop")
COM_Invoke(pweb2, "document.write",html2)    
}
Return

Guiescape:
GuiClose:
   Gui, Destroy
   COM_Release(pweb), COM_AtlAxWinTerm()
   ExitApp

Marine Corps Gen. Joseph Dunford told senators at his Joint Chiefs of Staff confirmation hearing : “If you want to talk about a nation that could pose an existential threat to the United States, I'd have to point to Russia. And if you look at their behavior, it's nothing short of alarming.”


tank
  • Administrators
  • 4345 posts
  • AutoHotkey Foundation
  • Last active: Oct 13 2016 01:04 AM
  • Joined: 21 Dec 2007
Way more elaborate than requested use
COM_Invoke(pweb1, "document.body.innerHTML",html1)
instead of document write if you wish to overwrite
or close the document between calls by calling

COM_Invoke(pweb1, "document.write",html1) 
COM_Invoke(pweb1, "document.close") ; you have to close the document between calls

Never lose.
WIN or LEARN.

flyingDman
  • Spam Officer
  • 2186 posts
  • Last active: Nov 07 2015 08:15 AM
  • Joined: 27 Feb 2009
Awesome... Thanks Tank!

Marine Corps Gen. Joseph Dunford told senators at his Joint Chiefs of Staff confirmation hearing : “If you want to talk about a nation that could pose an existential threat to the United States, I'd have to point to Russia. And if you look at their behavior, it's nothing short of alarming.”


HelloWorld
  • Guests
  • Last active:
  • Joined: --

I would like to just load HTML into a variable and display it in my GUI or tooltip...

This got me thinking, what about creating an HTML-Based GUI? Here is a basic example:

@jethrow, I think it would be good to post your example/idea in its own thread as it can be overlooked here - and that's a pity.