Jump to content

Sky Slate Blueberry Blackcurrant Watermelon Strawberry Orange Banana Apple Emerald Chocolate
Photo

Generate GUIs easily!


  • Please log in to reply
18 replies to this topic
Rajat
  • Members
  • 1904 posts
  • Last active: Jul 17 2015 07:45 AM
  • Joined: 28 Mar 2004
This isn't usually known either... any .htm (or .html) file can be renamed to .hta (Hyper Text Application) to make it run actually like an application, no browser address bar, no toolbar buttons... no nonsenese! also fewer message boxes while clicking on links. (i've used it in the winamp info display example i posted)

one can make good use of it by generating html files using 'FileAppend' and run them using '%comspec% /c start'. they can have animated gifs, tables, buttons, input fields... anything u need to create a GUI. the java guys can make the inputs inserted in the fields be written to files, that the source script can use. (don't ask me how, i don't know java, maybe somebody will care to put up an example here)

also for making cool looking splashtexts just after generating the .hta file do this:

runwait, %comspec% /c start generated.hta,,hide
sleep, 1000
winclose, (the title of the page here)

MIA

CleanNews.in : Bite sized latest news headlines from India with zero bloat


Chris
  • Administrators
  • 10727 posts
  • Last active:
  • Joined: 02 Mar 2004
Wow you're a goldmine of info. Why reinvent the wheel when you can use a cool tip from Rajat! :)

beardboy
  • Members
  • 443 posts
  • Last active: May 27 2017 08:41 AM
  • Joined: 02 Mar 2004
Keep them coming Rajat!!!

thanks,
beardboy

Chris
  • Administrators
  • 10727 posts
  • Last active:
  • Joined: 02 Mar 2004

runwait, %comspec% /c start generated.hta,,hide

I think you can run those files directly. AHK can run just about any file extension as long as it's associated with something. So it probably performs a little better this way:
runwait, generated.hta

Rajat
  • Members
  • 1904 posts
  • Last active: Jul 17 2015 07:45 AM
  • Joined: 28 Mar 2004
oh that's great!... i was still living with AU2 usage!

though now it's reqd to be changed to:
run, generated.hta

or the script won't move ahead! (unless one wants the script to stop untill the window is closed)

MIA

CleanNews.in : Bite sized latest news headlines from India with zero bloat


Beastmaster
  • Members
  • 191 posts
  • Last active: Apr 23 2007 02:58 PM
  • Joined: 15 Apr 2004
Building HTA Solutions: Writing and distributing hypertext applications By Andrew Barfield

Thx, guys. :D

Rajat
  • Members
  • 1904 posts
  • Last active: Jul 17 2015 07:45 AM
  • Joined: 28 Mar 2004
:idea: thanx for the link BeastMaster, was good help.

MIA

CleanNews.in : Bite sized latest news headlines from India with zero bloat


tank
  • Administrators
  • 4345 posts
  • AutoHotkey Foundation
  • Last active: May 02 2019 09:16 PM
  • Joined: 21 Dec 2007
Digging thru all of the forum articles
good god man
i have been doing html for 10 years and programming for 4+
where the heck do you come up with this stuff
wow

no more using javascript for modeless windows for me this solves so many issues its just not funny
Never lose.
WIN or LEARN.

ChalamiuS
  • Moderators
  • 176 posts
  • Last active:
  • Joined: 04 Jun 2006
hah I found out this a week ago and this has been here for longer than that :lol:

TylerK
  • Members
  • 7 posts
  • Last active: Nov 09 2008 08:49 PM
  • Joined: 21 Aug 2007
Ohhhhh, this is awesome! Lately I've been setting up custom scripts for various buttons on my PC's remote control and I must say that this method is a heck of a lot easier for certain things than a normal GUI would be.

One thing that's very fun to do is have a script download several different web pages, then use RegExReplace to strip out all the junk you don't want from them. Once that's done you can easily insert the isolated content into a new .hta document and have the script run it maximized. You could even have your computer read certain parts to you if you so choose (I like to do it for weather, news, descriptions on "picture of the day" websites, titles of new threads on forums that I frequent, etc).

garry
  • Spam Officer
  • 3219 posts
  • Last active: Sep 20 2018 02:47 PM
  • Joined: 19 Apr 2005
is it possible to give x,y coordinate width and height and only see video ?
example , start youtube, select movie, then start a new small xy.hta see only video

related, see video in internet with black background
http://www.autohotke...topic26935.html
http://www.autohotke...topic26834.html

can watch film here, after a few seconds the background will be black
http://quicksilverscreen.com/

starturl.hta: (no success with margin)
<HTML>
<!This comment will not be displayed>
<HEAD><TITLE>Browser</TITLE></HEAD>
<BODY>

<BODY BGCOLOR="#000000"
   TEXT=WHITE
   LINK=BLUE
   VLINK=PURPLE
   ALINK=RED
   >

<IFRAME SRC="http://www.youtube.com/watch?v=iCKMzrPy4t4"
  WIDTH=490 HEIGHT=390
  ALIGN=LEFT
  HSPACE=100 VSPACE=60
  MARGINWIDTH=-260
  MARGINHEIGHT=-230
  FRAMEBORDER=1
  SCROLLING=AUTO
</IFRAME>

</BODY>
</HTML>


starturl.hta
Posted Image

TylerK
  • Members
  • 7 posts
  • Last active: Nov 09 2008 08:49 PM
  • Joined: 21 Aug 2007

is it possible to give x,y coordinate width and height and only see video ?
example , start youtube, select movie, then start a new small xy.hta see only video

A better way to do it would be to use the embed code that YouTube gives you for the video. People usually use it for blogs and myspace, but there's no reason it won't work in an .hta file.

I thought your idea was neat, however, so I decided to take a shot at coding it. Basically the script grabs a basic (local) template for displaying a YouTube video but replaces the video ID with one that you specify, then it creates a new hta file, executes it, and resizes it so it's just big enough for the video to be displayed.

Here's the html template (in the code it's referenced as YouTubeTemplate.txt, which is stored in the same directory as the script):
<HTML>
<HEAD>

<TITLE>YouTube Viewer</TITLE>

<style type="text/css">
  body {
		background-color: #000000;
		margin: 0px;
		padding: 0px;
    color: #fff;
    overflow-y: hidden;
  }

</style>

</HEAD>

<BODY>

<object width="425" height="355"><param name="movie" value="http://www.youtube.com/v/--vidID--&rel=1"></param><param name="wmode" value="transparent"></param><embed src="http://www.youtube.com/v/--vidID--&rel=1" type="application/x-shockwave-flash" wmode="transparent" width="425" height="355"></embed></object>

</BODY>
</HTML>

The "overflow-y: hidden;" bit of CSS will hide the vertical scrollbar since it's not needed and is just taking up space.

And here's the script:
; Prompt user for URL to the YouTube video.
InputBox, videoURL, Enter the video's url

; Strip everything but the last bit (the video ID, basically)
videoURL := RegExReplace(videoURL, ".*\?v=", " ")

; Trim the space we just made
StringTrimLeft, videoURL, videoURL, 1

; Grab our template...
FileRead, outputHTML, %A_ScriptDir%\YouTubeTemplate.txt

; Replace the --vidID-- with the actual video ID
StringReplace, outputHTML, outputHTML, --vidID--, %videoURL%, All

; Delete the hta file if it exists so that we don't keep adding to it
FileDelete, %A_ScriptDir%\YouTubeViewer.hta

; Then make a new one and put the output HTML into it and run it
FileAppend, %outputHTML%, %A_ScriptDir%\YouTubeViewer.hta
Run, %A_ScriptDir%\YouTubeViewer.hta

; This will resize the window so it's only big enough to show the video. 
; You may need to change the dimensions below since title bar thickness
; can vary depending on desktop themes and such.
WinWait, YouTube Viewer
WinMove, YouTube Viewer,,,,440,395

Getting the video's URL via InputBox is just a quick, dirty, proof-of-concept way to do it. You could do some clever stuff like scan your internet bookmarks for YouTube links and present a list of them in a GUI - a YouTube DVR of sorts.

garry
  • Spam Officer
  • 3219 posts
  • Last active: Sep 20 2018 02:47 PM
  • Joined: 19 Apr 2005
thank you very much TylerK, works perfect
should learn html , some links to learn html:

http://www.htmlcodet.../quicklist.html
http://www.w3schools.../html_quick.asp
http://www.w3schools...ags/default.asp
http://en.wikipedia.... ... references


added:
last question:
is it possible to add / or embed this to an AHK-script ?
I have seen an example with cwebpage.dll, can give x,y and size, but don't know how to select to show just a part (like above)

TylerK
  • Members
  • 7 posts
  • Last active: Nov 09 2008 08:49 PM
  • Joined: 21 Aug 2007
If I'm understanding you correctly, you want to have the video displayed in an AHK GUI? If so you'd have to embed an IE control first. Then, using the script above, you could easily have it output to a .html file instead of a .hta file, then have the IE control in your GUI load the local .html file.

garry
  • Spam Officer
  • 3219 posts
  • Last active: Sep 20 2018 02:47 PM
  • Joined: 19 Apr 2005
thank you TylerK,
it works now , I used the script from ahklerner with cwebpage.dll
http://www.autohotke...2071.html#92071

cwebpage.dll is InternetExplorer (IE) ,
can I use made a script also use Mozilla FireFox ?
when I use FireFox the video is already downloaded in cache while watching video
-------------------------------------------------------------------------------



here some examples:
Howto download 50 videos while watching ( FireFox cache )
http://www.autohotke...topic26561.html

watching video in internet with blackscreen
http://www.autohotke...pic.php?t=26834

Youtube, start script and copy link (rightlick or ctrl+c)
download starts, automatically rename
http://www.autohotke...topic14882.html