Skip to main content
Code Review

Return to Answer

added 4 characters in body
Source Link

I recommend that you put the data in a separate text file and then build the page dynamically.

A separate file for the data allows the 300+ entries to be in a simple list format (i.e. no html) that's easy to maintain, even by a non-programmer. It eliminates the need to touch the HTA code every time there's an update to the data.

Below is an example of how this can be done. Note that this example code generates a button for the user to open each URL, but the code could easily be modified to make the URL a clickable link.

Sitelist.txt

https://www.yahoo.com|This site is not used much anymore except for webmail
https://www.AOL.com|This site is old
https://www.duckduckgo.com|This site is newer and spies less than Google

Sitelist.hta

<!DOCTYPE html>
<html>
<head>
<title>Reference Websites</title>
<meta charset="UTF-8" http-equiv="X-UA-Compatible" content="IE=9">
<HTA:APPLICATION
 Icon=Magnify.exe
>
<script language="VBScript">
w = 1024
h = 600
window.resizeTo w, h
window.moveTo (screen.availWidth - w)/2, (screen.availHeight - h)/2
Set oWSH = CreateObject("Wscript.Shell")
Set oFSO = CreateObject("Scripting.FileSystemObject")
dataFile = ".\SiteList.txt"
Data = oFSO.OpenTextFile(dataFile).ReadAll
aData = Split(Data,VBCRLF)
Sub CopyURL(URL)
 document.parentwindow.clipboardData.SetData "text", URL
 MsgBox URL,,"On Clipboard:"
End Sub
Sub GotoURL(URL)
 oWSH.Run "chrome.exe -new-window -start-maximized -url " & URL
End Sub
</script>
<style>
 body {background-color:#B8D8E9; font-family:Segoe UI; font-size:11pt}
 input[type="button"] {font-family:Segoe UI Emoji; font-size:11pt}
 .url { font-family:Comic Sans MS; color:blue }
 .info { color:gray }
</style>
</head>
<body>
<script language="VBScript">
For i = 0 To UBound(aData)
 If InStr(aData(i),"|")>0 Then
 aLine = Split(aData(i),"|")
 h01 = "<input type=button value=πŸ“‹ onclick=CopyURL(""" & aLine(0) & """)> "
 h02 = "<input type=button value=🌐 onclick=GotoURL(""" & aLine(0) & """)> "
 h03 = "<span class=url>" & aLine(0) & "</span> "
 h04 = "<span class=info>(" & aLine(1) & ")</span><br><br>"
 document.write (h01 & h02 & h03 & h04)
 End If
Next
</script>
</body>
</html>

I recommend that you put the data in a separate text file and then build the page dynamically.

A separate file for the data allows the 300+ entries to be in a simple list format (i.e. no html) that's easy to maintain, even by a non-programmer. It eliminates the need to touch the HTA code every time there's an update to the data.

Below is an example of how this can be done. Note that this example code generates a button for the user to open each URL, but the code could easily be modified to make the URL a clickable link.

Sitelist.txt

https://www.yahoo.com|This site is not used much anymore except for webmail
https://www.AOL.com|This site is old
https://www.duckduckgo.com|This site is newer and spies less than Google

Sitelist.hta

<!DOCTYPE html>
<html>
<head>
<title>Reference Websites</title>
<meta charset="UTF-8" http-equiv="X-UA-Compatible" content="IE=9">
<HTA:APPLICATION
 Icon=Magnify.exe
>
<script language="VBScript">
w = 1024
h = 600
window.resizeTo w, h
window.moveTo (screen.availWidth - w)/2, (screen.availHeight - h)/2
Set oWSH = CreateObject("Wscript.Shell")
Set oFSO = CreateObject("Scripting.FileSystemObject")
dataFile = ".\SiteList.txt"
Data = oFSO.OpenTextFile(dataFile).ReadAll
aData = Split(Data,VBCRLF)
Sub CopyURL(URL)
 document.parentwindow.clipboardData.SetData "text", URL
 MsgBox URL,,"On Clipboard:"
End Sub
Sub GotoURL(URL)
 oWSH.Run "chrome.exe -new-window -start-maximized -url " & URL
End Sub
</script>
<style>
 body {background-color:#B8D8E9; font-family:Segoe UI; font-size:11pt}
 input[type="button"] {font-family:Segoe UI Emoji; font-size:11pt}
 .url { font-family:Comic Sans MS; color:blue }
 .info { color:gray }
</style>
</head>
<body>
<script language="VBScript">
For i = 0 To UBound(aData)
 If InStr(aData(i),"|")>0 Then
 aLine = Split(aData(i),"|")
 h01 = "<input type=button value=πŸ“‹ onclick=CopyURL(""" & aLine(0) & """)> "
 h02 = "<input type=button value=🌐 onclick=GotoURL(""" & aLine(0) & """)> "
 h03 = "<span class=url>" & aLine(0) & "</span> "
 h04 = "<span class=info>(" & aLine(1) & ")</span><br><br>"
 document.write (h01 & h02 & h03 & h04)
 End If
Next
</script>
</body>
</html>

I recommend that you put the data in a separate text file and then build the page dynamically.

A separate file for the data allows the 300+ entries to be in a simple list format (i.e. no html) that's easy to maintain, even by a non-programmer. It eliminates the need to touch the HTA code every time there's an update to the data.

Below is an example of how this can be done. Note that this example code generates a button for the user to open each URL, but the code could easily be modified to make the URL a clickable link.

Sitelist.txt

https://www.yahoo.com|This site is not used much anymore except for webmail
https://www.AOL.com|This site is old
https://www.duckduckgo.com|This site is newer and spies less than Google

Sitelist.hta

<!DOCTYPE html>
<html>
<head>
<title>Reference Websites</title>
<meta charset="UTF-8" http-equiv="X-UA-Compatible" content="IE=9">
<HTA:APPLICATION
 Icon=Magnify.exe
>
<script language="VBScript">
w = 1024
h = 600
window.resizeTo w, h
window.moveTo (screen.availWidth - w)/2, (screen.availHeight - h)/2
Set oWSH = CreateObject("Wscript.Shell")
Set oFSO = CreateObject("Scripting.FileSystemObject")
dataFile = ".\SiteList.txt"
Data = oFSO.OpenTextFile(dataFile).ReadAll
aData = Split(Data,VBCRLF)
Sub CopyURL(URL)
 document.parentwindow.clipboardData.SetData "text", URL
 MsgBox URL,,"On Clipboard:"
End Sub
Sub GotoURL(URL)
 oWSH.Run "chrome.exe -new-window -start-maximized -url " & URL
End Sub
</script>
<style>
 body {background-color:#B8D8E9; font-family:Segoe UI; font-size:11pt}
 input[type="button"] {font-family:Segoe UI Emoji; font-size:11pt}
 .url { font-family:Comic Sans MS; color:blue }
 .info { color:gray }
</style>
</head>
<body>
<script language="VBScript">
For i = 0 To UBound(aData)
 If InStr(aData(i),"|")>0 Then
 aLine = Split(aData(i),"|")
 h01 = "<input type=button value=πŸ“‹ onclick=CopyURL(""" & aLine(0) & """)> "
 h02 = "<input type=button value=🌐 onclick=GotoURL(""" & aLine(0) & """)> "
 h03 = "<span class=url>" & aLine(0) & "</span> "
 h04 = "<span class=info>(" & aLine(1) & ")</span><br><br>"
 document.write (h01 & h02 & h03 & h04)
 End If
Next
</script>
</body>
</html>
added 39 characters in body
Source Link
<!DOCTYPE html>
<html>
<head>
<title>Reference Websites</title>
<meta charset="UTF-8" http-equiv="X-UA-Compatible" content="IE=9">
<HTA:APPLICATION
 Icon=Magnify.exe
>
<script language="VBScript">
w = 1024
h = 600
window.resizeTo w, h
window.moveTo (screen.availWidth - w)/2, (screen.availHeight - h)/2
Set oWSH = CreateObject("Wscript.Shell")
Set oFSO = CreateObject("Scripting.FileSystemObject")
dataFile = ".\SiteList.txt"
Data = oFSO.OpenTextFile(dataFile).ReadAll
aData = Split(Data,VBCRLF)
Sub CopyURL(URL)
 document.parentwindow.clipboardData.SetData "text", URL
 MsgBox URL,,"On Clipboard:"
End Sub
Sub GotoURL(URL)
 oWSH.Run "chrome.exe -new-window -start-maximized -url " & URL
End Sub
</script>
<style>
 body {background-color:#B8D8E9; font-family:Segoe UI; font-size:11pt}
 input[type="button"] {font-family:Segoe UI Emoji; font-size:11pt}
 .url { font-family:Comic Sans MS; color:blue }
 .info { color:gray }
</style>
</head>
<body>
<script language="VBScript">
For i = 0 To UBound(aData)
 If InStr(aData(i),"|")>0 Then
 aLine = Split(aData(i),"|")
 h01 = "<input type=button value=πŸ“‹ onclick=CopyURL(""" & aLine(0) & """)> "
 h02 = "<input type=button value=🌐 onclick=GotoURL(""" & aLine(0) & """)> "
 h03 = "<span class=url>" & aLine(0) & "</span> "
 h04 = "<span class=info>(" & aLine(1) & ")</span><br><br>"
 document.write (h01 & h02 & h03 & h04)
 End If
Next
Sub CopyURL(URL)
 document.parentwindow.clipboardData.SetData "text", URL
 MsgBox URL,,"On Clipboard:"
End Sub
Sub GotoURL(URL)
 oWSH.Run "chrome.exe -new-window -start-maximized -url " & URL
End Sub
</script>
<style>
 body {background-color:#B8D8E9; font-family:Segoe UI; font-size:11pt}
 input[type="button"] {font-family:Segoe UI Emoji; font-size:11pt}
 .url { font-family:Comic Sans MS; color:blue }
 .info { color:gray }
</style>
</head>
<body>
</body>
</html>
<!DOCTYPE html>
<html>
<head>
<title>Reference Websites</title>
<meta charset="UTF-8" http-equiv="X-UA-Compatible" content="IE=9">
<HTA:APPLICATION
 Icon=Magnify.exe
>
<script language="VBScript">
w = 1024
h = 600
window.resizeTo w, h
window.moveTo (screen.availWidth - w)/2, (screen.availHeight - h)/2
Set oWSH = CreateObject("Wscript.Shell")
Set oFSO = CreateObject("Scripting.FileSystemObject")
dataFile = ".\SiteList.txt"
Data = oFSO.OpenTextFile(dataFile).ReadAll
aData = Split(Data,VBCRLF)
For i = 0 To UBound(aData)
 If InStr(aData(i),"|")>0 Then
 aLine = Split(aData(i),"|")
 h01 = "<input type=button value=πŸ“‹ onclick=CopyURL(""" & aLine(0) & """)> "
 h02 = "<input type=button value=🌐 onclick=GotoURL(""" & aLine(0) & """)> "
 h03 = "<span class=url>" & aLine(0) & "</span> "
 h04 = "<span class=info>(" & aLine(1) & ")</span><br><br>"
 document.write (h01 & h02 & h03 & h04)
 End If
Next
Sub CopyURL(URL)
 document.parentwindow.clipboardData.SetData "text", URL
 MsgBox URL,,"On Clipboard:"
End Sub
Sub GotoURL(URL)
 oWSH.Run "chrome.exe -new-window -start-maximized -url " & URL
End Sub
</script>
<style>
 body {background-color:#B8D8E9; font-family:Segoe UI; font-size:11pt}
 input[type="button"] {font-family:Segoe UI Emoji; font-size:11pt}
 .url { font-family:Comic Sans MS; color:blue }
 .info { color:gray }
</style>
</head>
<body>
</body>
</html>
<!DOCTYPE html>
<html>
<head>
<title>Reference Websites</title>
<meta charset="UTF-8" http-equiv="X-UA-Compatible" content="IE=9">
<HTA:APPLICATION
 Icon=Magnify.exe
>
<script language="VBScript">
w = 1024
h = 600
window.resizeTo w, h
window.moveTo (screen.availWidth - w)/2, (screen.availHeight - h)/2
Set oWSH = CreateObject("Wscript.Shell")
Set oFSO = CreateObject("Scripting.FileSystemObject")
dataFile = ".\SiteList.txt"
Data = oFSO.OpenTextFile(dataFile).ReadAll
aData = Split(Data,VBCRLF)
Sub CopyURL(URL)
 document.parentwindow.clipboardData.SetData "text", URL
 MsgBox URL,,"On Clipboard:"
End Sub
Sub GotoURL(URL)
 oWSH.Run "chrome.exe -new-window -start-maximized -url " & URL
End Sub
</script>
<style>
 body {background-color:#B8D8E9; font-family:Segoe UI; font-size:11pt}
 input[type="button"] {font-family:Segoe UI Emoji; font-size:11pt}
 .url { font-family:Comic Sans MS; color:blue }
 .info { color:gray }
</style>
</head>
<body>
<script language="VBScript">
For i = 0 To UBound(aData)
 If InStr(aData(i),"|")>0 Then
 aLine = Split(aData(i),"|")
 h01 = "<input type=button value=πŸ“‹ onclick=CopyURL(""" & aLine(0) & """)> "
 h02 = "<input type=button value=🌐 onclick=GotoURL(""" & aLine(0) & """)> "
 h03 = "<span class=url>" & aLine(0) & "</span> "
 h04 = "<span class=info>(" & aLine(1) & ")</span><br><br>"
 document.write (h01 & h02 & h03 & h04)
 End If
Next
</script>
</body>
</html>
added 426 characters in body
Source Link

I recommend that you put the data in a separate text file and then build the page dynamically. Like

A separate file for the data allows the 300+ entries to be in a simple list format (i.e. no html) that's easy to maintain, even by a non-programmer. It eliminates the need to touch the HTA code every time there's an update to the data.

Below is an example of how this: can be done. Note that this example code generates a button for the user to open each URL, but the code could easily be modified to make the URL a clickable link.

Sitelist.txt

https://www.yahoo.com|This site is not used much anymore except for webmail
https://www.AOL.com|This site is old
https://www.duckduckgo.com|This site is newer and spies less than Google

Sitelist.hta

<!DOCTYPE html>
<html>
<head>
<title>Reference Websites</title>
<meta charset="UTF-8" http-equiv="X-UA-Compatible" content="IE=9">
<HTA:APPLICATION
 Icon=Magnify.exe
>
<script language="VBScript">
w = 1024
h = 600
window.resizeTo w, h
window.moveTo (screen.availWidth - w)/2, (screen.availHeight - h)/2
Set oWSH = CreateObject("Wscript.Shell")
Set oFSO = CreateObject("Scripting.FileSystemObject")
dataFile = ".\SiteList.txt"
Data = oFSO.OpenTextFile(dataFile).ReadAll
aData = Split(Data,VBCRLF)
For i = 0 To UBound(aData)
 If InStr(aData(i),"|")>0 Then
 aLine = Split(aData(i),"|")
 h01 = "<input type=button value=πŸ“‹ onclick=CopyURL(""" & aLine(0) & """)> "
 h02 = "<input type=button value=🌐 onclick=GotoURL(""" & aLine(0) & """)> "
 h03 = "<span class=url>" & aLine(0) & "</span> "
 h04 = "<span class=info>(" & aLine(1) & ")</span><br><br>"
 document.write (h01 & h02 & h03 & h04)
 End If
Next
Sub CopyURL(URL)
 document.parentwindow.clipboardData.SetData "text", URL
 MsgBox URL,,"On Clipboard:"
End Sub
Sub GotoURL(URL)
 oWSH.Run "chrome.exe -new-window -start-maximized -url " & URL
End Sub
</script>
<style>
 body {background-color:#B8D8E9; font-family:Segoe UI; font-size:11pt}
 input[type="button"] {font-family:Segoe UI Emoji; font-size:11pt}
 .url { font-family:Comic Sans MS; color:blue }
 .info { color:gray }
</style>
</head>
<body>
</body>
</html>

I recommend that you put the data in a separate text file and then build the page dynamically. Like this:

Sitelist.txt

https://www.yahoo.com|This site is not used much anymore except for webmail
https://www.AOL.com|This site is old
https://www.duckduckgo.com|This site is newer and spies less than Google

Sitelist.hta

<!DOCTYPE html>
<html>
<head>
<title>Reference Websites</title>
<meta charset="UTF-8" http-equiv="X-UA-Compatible" content="IE=9">
<HTA:APPLICATION
 Icon=Magnify.exe
>
<script language="VBScript">
w = 1024
h = 600
window.resizeTo w, h
window.moveTo (screen.availWidth - w)/2, (screen.availHeight - h)/2
Set oWSH = CreateObject("Wscript.Shell")
Set oFSO = CreateObject("Scripting.FileSystemObject")
dataFile = ".\SiteList.txt"
Data = oFSO.OpenTextFile(dataFile).ReadAll
aData = Split(Data,VBCRLF)
For i = 0 To UBound(aData)
 If InStr(aData(i),"|")>0 Then
 aLine = Split(aData(i),"|")
 h01 = "<input type=button value=πŸ“‹ onclick=CopyURL(""" & aLine(0) & """)> "
 h02 = "<input type=button value=🌐 onclick=GotoURL(""" & aLine(0) & """)> "
 h03 = "<span class=url>" & aLine(0) & "</span> "
 h04 = "<span class=info>(" & aLine(1) & ")</span><br><br>"
 document.write (h01 & h02 & h03 & h04)
 End If
Next
Sub CopyURL(URL)
 document.parentwindow.clipboardData.SetData "text", URL
 MsgBox URL,,"On Clipboard:"
End Sub
Sub GotoURL(URL)
 oWSH.Run "chrome.exe -new-window -start-maximized -url " & URL
End Sub
</script>
<style>
 body {background-color:#B8D8E9; font-family:Segoe UI; font-size:11pt}
 input[type="button"] {font-family:Segoe UI Emoji; font-size:11pt}
 .url { font-family:Comic Sans MS; color:blue }
 .info { color:gray }
</style>
</head>
<body>
</body>
</html>

I recommend that you put the data in a separate text file and then build the page dynamically.

A separate file for the data allows the 300+ entries to be in a simple list format (i.e. no html) that's easy to maintain, even by a non-programmer. It eliminates the need to touch the HTA code every time there's an update to the data.

Below is an example of how this can be done. Note that this example code generates a button for the user to open each URL, but the code could easily be modified to make the URL a clickable link.

Sitelist.txt

https://www.yahoo.com|This site is not used much anymore except for webmail
https://www.AOL.com|This site is old
https://www.duckduckgo.com|This site is newer and spies less than Google

Sitelist.hta

<!DOCTYPE html>
<html>
<head>
<title>Reference Websites</title>
<meta charset="UTF-8" http-equiv="X-UA-Compatible" content="IE=9">
<HTA:APPLICATION
 Icon=Magnify.exe
>
<script language="VBScript">
w = 1024
h = 600
window.resizeTo w, h
window.moveTo (screen.availWidth - w)/2, (screen.availHeight - h)/2
Set oWSH = CreateObject("Wscript.Shell")
Set oFSO = CreateObject("Scripting.FileSystemObject")
dataFile = ".\SiteList.txt"
Data = oFSO.OpenTextFile(dataFile).ReadAll
aData = Split(Data,VBCRLF)
For i = 0 To UBound(aData)
 If InStr(aData(i),"|")>0 Then
 aLine = Split(aData(i),"|")
 h01 = "<input type=button value=πŸ“‹ onclick=CopyURL(""" & aLine(0) & """)> "
 h02 = "<input type=button value=🌐 onclick=GotoURL(""" & aLine(0) & """)> "
 h03 = "<span class=url>" & aLine(0) & "</span> "
 h04 = "<span class=info>(" & aLine(1) & ")</span><br><br>"
 document.write (h01 & h02 & h03 & h04)
 End If
Next
Sub CopyURL(URL)
 document.parentwindow.clipboardData.SetData "text", URL
 MsgBox URL,,"On Clipboard:"
End Sub
Sub GotoURL(URL)
 oWSH.Run "chrome.exe -new-window -start-maximized -url " & URL
End Sub
</script>
<style>
 body {background-color:#B8D8E9; font-family:Segoe UI; font-size:11pt}
 input[type="button"] {font-family:Segoe UI Emoji; font-size:11pt}
 .url { font-family:Comic Sans MS; color:blue }
 .info { color:gray }
</style>
</head>
<body>
</body>
</html>
Source Link
Loading
lang-vb

AltStyle γ«γ‚ˆγ£γ¦ε€‰ζ›γ•γ‚ŒγŸγƒšγƒΌγ‚Έ (->γ‚ͺγƒͺγ‚ΈγƒŠγƒ«) /