Skip to content

Instantly share code, notes, and snippets.

@JoeGlines
Created July 13, 2020 12:08
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save JoeGlines/463d32ada6c1a417a19acd57f7d49d47 to your computer and use it in GitHub Desktop.
Save JoeGlines/463d32ada6c1a417a19acd57f7d49d47 to your computer and use it in GitHub Desktop.
Quickly display HTML for a simple preview
#SingleInstance, Force
#NoEnv
SplitPath,A_ahkPath,,Root
Menu,tray,icon,%A_WinDir%\system32\netshell.dll,86
try=
(
<div style="width:75`%" id="specialNote">
<h3>Sampling</h3>
<p>To evaluate the TM4C1230, please sample the parent device: <a href="http://www.ti.com/product/tm4c1230h6pm/samplebuy">TM4C1230H6PM</a>.</p>
)
FileDelete, test.html
gui, font, s11 bold, Verdana ; Set 10-point Verdana.
Gui, add, Edit, vtestHTML cBlue x0 y40 r40 w700, %try%
Gui, Add, Button, x550 y10 Default, Run
Gui, Submit, NoHide
Gui, Show,h600 w700, HTML Test
testHTML:=""
return
;**********************reload*********************************
RAlt::
Browser_Forward::Reload
;*******************************************************
ButtonRun:
Gui, Submit ,NoHide
;~ MsgBox,,title, % testHTML
gosub Write_HTML
Gosub Display_HTML
return
ButtonCancel:
Gui, Destroy
FileDelete,test.html
Return
OnExit:
FileDelete,test.html ;clean tmp file
ExitApp
;*******************************************************
Write_HTML:
HTML_page =
( Ltrim Join
<!DOCTYPE html>
<html>
<head>
</head>
<body>
%testHTML%
</body>
</html>
)
FileAppend, %html_Page%, test.html, UTF-8
Return
Display_HTML:
Clipboard:=path:=A_WorkingDir . "\test.html"
gui, new
Gui Add, ActiveX, w980 h640 vWB, Shell.Explorer ; The final parameter is the name of the ActiveX component.
WB.Navigate(Path) ; This is specific to the web browser control.
Gui Show
testHTML:="" , html_page:="" ;clear variables
FileDelete,test.html
return
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment