/* ObjRexx ListeFav */ -- List the Internet Explorer 6 Favorites in a HTML file (XHTML CSS) Parse Source system . programname Parse Version level Call RxFuncAdd 'SysLoadFuncs', 'RexxUtil', 'SysLoadFuncs' Call SysLoadFuncs -- load the RexxUtil functions -- Args. Called from a WinXP batch-file, surrounding each args by double-quotes is mandatory -- as in (the 2 following lines on 1 line in the .cmd batch-file): -- "C:\Program Files\ObjREXX\REXX.EXE" "D:\Data Files\CMD\ListeFav.rex" -- "C:\Documents and Settings\cymago\Favoris" "D:\Data Files\Bookmarks\BookmarkRx.html" If Arg()>0 Then Do prompt=0 Parse Arg '"' favpath '"' . '"' n_out '"' . End Else -- set defaults Do prompt=1 userpath = value('USERPROFILE',,'ENVIRONMENT') call SysFileTree userpath'\fav*', 'favs', 'DO' favpath = favs.1 -- uses the current user favorites path as default drop favs. n_out = 'D:\Data Files\Bookmarks\BookmarkRx.html' End Call main done: Call SysDropFuncs -- drop all RexxUtil functions Exit -- the only exit. main: -- initial If prompt Then Do lab.1 = "Input" lab.2 = "Output" fic.101 = favpath fic.102 = n_out dlg = .MultiInputBox~new("Enter Favorite path and output file",'Bookmarks', lab., fic.,200) If dlg~execute = 1 Then Do favpath = dlg~input n_out = dlg~output End Else Return End Else Nop o_out = .Stream~New(n_out) -- Create a stream object for output If o_out~query('exists') \= '' Then -- delete the existing output file Do o_out~Close Call SysFileDelete(n_out) o_out = .Stream~New(n_out) -- Create a stream object for output End Else Nop -- the headers or footers are interpreted head.0 = 13 head.1 = '' head.2 = '' head.4 = '' head.5 = '' head.6 = 'Bookmarks' head.7 = '' head.11 = '' head.12 = '' head.13 = '

Bookmarks
' favpath Date('E') Time()'

' foot.0 = 3 foot.1 = '''

'' urls.0 ''favoris.

''' foot.2 = '' foot.3 = '' -- output XHTML CSS headers Do j = 1 To head.0 line = head.j If Left(line,1) = '' Then Interpret 'line='Right(line,Length(line)-1) Else Nop o_out~Lineout(line) End j -- find all *.url files urls.0=0 old='' closediv = 0 filespec=favpath'\*.url' call SysFileTree filespec, 'urls', 'FSO' -- sub-directories handling, insert separators and indent Do i=1 To urls.0 urls.i=Strip(urls.i); If urls.i='' Then Iterate localpath = Changestr(favpath'\',urls.i,'') endpos=Lastpos('\',localpath)-1 Parse var localpath localpath +(endpos) . +1 urlname '.' ext If localpath \= old Then -- output a local path separator line Do old = localpath If Pos('\',localpath) = 0 Then Do If closediv Then o_out~lineout('') closediv = 0 o_out~lineout('

'localpath'

') End Else Do If closediv Then o_out~lineout('') o_out~lineout('
') closediv = 1 o_out~lineout('

'localpath'

') End End Else Nop -- output the url only info from each file call SysFileSearch 'URL=', urls.i, 'line.' -- output the url of that file Do j=1 To line.0 If Left(line.j,4) = 'URL=' Then Do url=Right(line.j,Length(line.j)-4) o_out~lineout(''urlname'
') -- o_out~lineout(''urlname' 'localpath'
') End Else Nop End j End i -- output XHTML CSS footers Do j = 1 To foot.0 line = foot.j If Left(line,1) = '' Then Interpret 'line='Right(line,Length(line)-1) Else Nop o_out~Lineout(line) End j -- exit main o_out~Close Call RxWinExec "C:\Program Files\Internet Explorer\IEXPLORE.EXE" n_out,'SHOWNORMAL' If result>31 Then Nop; Else Say 'RxWinExec error, return code:' result Call SysDropFuncs -- drop all RexxUtil functions Return --main -- requires ::requires "OODPLAIN.cls"