David
Joined: 08 Aug 2004 Posts: 25 Location: Lubbock, Texas
|
Posted: Tue Mar 21, 2006 3:03 am Post subject: Multi-Window Browser |
|
|
A short program that creates and runs an HTM file displaying your favorite sites, with each site in a separate full-window iframe. Your sites are found in mwb.dat, one line per site, with each line containing a title, a comma (with no following space), and the URL. Lots of room for improvement but it does the job for me.
| Code: | ; Multi-Window Browser (mwb.ahk)
;
; This program creates an HTML file containing one window for each URL
; in the mwb.dat file, which must exist in the same directory as mwb.ahk.
; Example mwb.dat file (start in column one, omit semicolons):
; Fox News,http://www.foxnews.com/
; Drudge,http://www.drudgereport.com/
; Late Night Jokes,http://www.newsmax.com/liners.shtml
; Sudoku,http://www.websudoku.com/
fileName = %A_WorkingDir%\mwb
htmFile = %fileName%.htm
datFile = %fileName%.dat
IfNotExist, %datFile%
{
MsgBox, URL file not found:`n`n%datFile%`n`nExiting ...
Exit
}
IfExist, %htmFile%
FileRecycle, %htmFile%
FileAppend, <html>`n, %htmFile%
FileAppend, <head>`n, %htmFile%
FileAppend, <title>MultiWindow Browser</title>`n, %htmFile%
FileAppend, <style type="text/css">`n, %htmFile%
FileAppend, /*<![CDATA[*/`n, %htmFile%
FileAppend, body { margin: 0px 0px 0px 0px }`n, %htmFile%
; Next line is long
FileAppend, h1 { background-color: #000000; color: #ffffff; text-align: center; margin-top: 0px; margin-bottom: 0px; padding-top: 16px; padding-bottom: 16px; }`n, %htmFile%
FileAppend, /*]]>*/`n, %htmFile%
FileAppend, </style>`n, %htmFile%
FileAppend, </head>`n, %htmFile%
FileAppend, <body>`n, %htmFile%
Loop, Read, %datFile%, %htmFile%
{
Loop, Parse, A_LoopReadLine, CSV
{
IfEqual, A_Index, 1
{
FileAppend, <h1>
FileAppend, %A_LoopField%
FileAppend </h1>`n
}
Else
{
FileAppend, <iframe src="
FileAppend, %A_LoopField%
FileAppend, " width="100`%" height="100`%" frameborder="0"></iframe>`n
}
}
}
FileAppend, </body>`n</html>`n, %htmFile%
Run, %htmFile%, %A_WorkingDir%
Exit |
|
|