Save open links when reboot
I like to save my open links when I reboot (which is still necessary more then you would think). I created a .vbs script a while back that writes open links to an .html file, then when I reboot, I open the .html file which opens all of the links.
- Run the script below before reboot.
- Open SavedURLs.html which reopens the saved links.
'''''''''''''''''''''''''''''''''''''''''''''''
' Creates a file that contains open url's
'
' output file
const FILE_NAME = "c:\SavedURLs.html"
' get list of browsers
dim shell, list
set shell = createobject("Shell.Application")
set list = shell.windows
' create file
dim fso, stream
set fso = createobject("Scripting.FileSystemObject")
set stream = fso.CreateTextFile(FILE_NAME)
' write header
stream.WriteLine "<html>" & vbCrLf & _
"<!-- created " & now() & " -->" & vbCrLf & _
"<script language='javascript'>" & vbCrLf & _
"// list of url's" & vbCrLf & _
"var list=Array("
' loop through and write links to url's
on error resume next
dim url, browser, count
For Each browser In list
url = browser.LocationURL
If InStr(url, "http://") Then
stream.WriteLine "'" & url & "',"
count = count + 1
End If
Next
' write footer
stream.WriteLine "'');" & vbCrLf & _
"// go through and open url's, open first url in current window" & vbCrLf & _
"for (i=1; i<list.length-1; i++) { window.open(list[i], '_blank'); }" & vbCrLf & _
"window.location.href=list[0];" & vbCrLf & _
"</script>" & vbCrLf & _
"<body></body>" & vbCrLf & _
"</html>"
stream.Close
' display done message
msgbox "Saved " & count & " URL's to " & FILE_NAME, 64, "Save URL's"