Back To Start Of Archive
Taken From The Forum: Archived Topics for the old Version 3.0 JavaScript Menu
Forum Topic: Click to view post
Last Updated: Wednesday July 18 2012 - 06:07:35
A quick way to import favorites into this menu system...
Poster: Yellowg
Dated: Sunday June 9 2002 - 8:32:01 BST
wrote a quick vbs..
just copy and paster into a .vbs file
how to run:
- have an empty folder
- put .vbs file there
- put a copy of the favorites folder there
- run .vbs
- output is favs.txt which you guys should be familiar with..
--snip--
Dim file, folder, makefile, makefilename, startfolder
public fso
Set fso = CreateObject("Scripting.FileSystemObject")
startfolder = fso.getfile(WScript.ScriptFullName).parentfolder & "\"
makefilename = fso.getfile(WScript.ScriptFullName).parentfolder & "\" & "favs.txt"
fso.deletefile makefilename, true
set makeFile = fso.CreateTextFile(makefilename, True)
subfolderlist(fso.Getfolder(startfolder))
makefile.close
set makefile = Nothing
'-----
Sub subfolderlist(folder)
Dim subfolder
filelist(folder)
For Each subfolder in folder.SubFolders
makefile.Writeline "addmenu(menu=[""" & replace(mid(subfolder.path,len(startfolder)+1,len(subfolder.path)-len(startfolder)+1),"\","_") & "_MENU" & ""","
makefile.Writeline ",,,1,,style1,,""left"",effect,,,,,,,,,,,,"
listwrite(subfolder)
subfolderlist(subfolder)
Next
End Sub
'-----
'-----
Sub listwrite(folder)
Dim subfolder
For Each subfolder in folder.SubFolders
makefile.Writeline ",""" & replace(mid(subfolder.path,len(folder.path)+2,len(subfolder.path)-len(folder.path)+2),"\","_") & " "",""show-menu=" & replace(mid(subfolder.path,len(startfolder)+1,len(subfolder.path)-len(startfolder)+1),"\","_") & "_MENU" & """,,"""",0"
Next
End Sub
'-----
'-----
Sub filelist(folder)
Dim file
Dim urlfile
dim url
dim z
z=0
For Each file in folder.Files
if ucase(right(file.Name,4)) = ".URL" then
z=1
Set urlfile = fso.opentextfile(file.path,1)
urlfile.skipline
url = urlfile.ReadLine
if len(file.name) < 32 then
makefile.Writeline ",""" & mid(file.name,1,len(file.name)-4) & """,""" & mid(url, 9, len(url)-8) & """,,,0"
else
makefile.Writeline ",""" & left(mid(file.name,1,len(file.name)-4),32) & "..." & """,""" & mid(url, 9, len(url)-8) & """,,,0"
end if
end if
Next
if z <> 0 then
makefile.Writeline "])"
makefile.Writeline ""
end if
End Sub
'-----
--snip--
VBS Not Working.
Poster: Gear Head
Dated: Thursday July 11 2002 - 6:54:42 BST
I am getting an error on line 68, Char. 96
I'm not a vbs guy, please help.
This looks like it could be very useful for creating the menu structure for the Milonic menu and I can't wait to try it.
Disable Smiles
Poster: Gear Head
Dated: Thursday July 11 2002 - 7:04:16 BST
I realize that you forgot to disable smiles in your post, so when the code said 8) The forum thought it was a "cool smile". This, of course, did not paste into my vbs file.
NOW... When I replace those blank spaces with 8) it starts to run the code, but then gives me an error...
Line 8
Char. 1
File not found.