home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 35 Internet / 35-Internet.zip / ini2url.cmd < prev    next >
OS/2 REXX Batch file  |  1995-06-06  |  1KB  |  68 lines

  1. /*** Explore INI file to URL object conversion ***/
  2.  
  3. parse arg inifile destination
  4.  
  5. if inifile = "" then
  6. do
  7.     say "ini2url inifile [destination=<WP_DESKTOP>]"
  8.     return 0
  9. end
  10.  
  11. call RxFuncAdd 'SysLoadFuncs', 'RexxUtil', 'SysLoadFuncs'
  12. call SysLoadFuncs
  13.  
  14. if destination = "" then
  15. do
  16.     destination = "<WP_DESKTOP>"
  17. end
  18.  
  19. classname = "WebExplorer_Url"
  20. setupheader = "LOCATOR="
  21. keyword = "quicklist="
  22.  
  23. /*** read file into memory ***/
  24.  
  25. rc = stream(inifile, 'c', 'open read')
  26. if rc \= "READY:" then
  27. do
  28.     say "ini2url: cannot open" inifile
  29.     return 0
  30. end
  31.  
  32. file.0 = 0
  33. i = 0
  34.  
  35. do while lines(inifile)
  36.     i = i + 1
  37.     file.i = linein(inifile)
  38. end
  39.  
  40. file.0 = i
  41.  
  42. rc = stream(inifile, 'c', 'close')
  43.  
  44. /*** look for "quicklist=" entry ***/
  45.  
  46. do i = 1 to file.0
  47.     if word(file.i, 1) = keyword then
  48.     do
  49.         title = strip(substr(file.i, length(keyword) + 1), 'leading')
  50.         i = i + 1
  51.         URL = strip(file.i, 'both')
  52.         say "title=[" || title || "]"
  53.         say "URL=[" || URL || "]"
  54.  
  55.         setup = setupheader || URL || ";";
  56.  
  57.         rc = SysCreateObject(classname, title, destination, setup, 'replace')
  58.  
  59.         if rc then
  60.         do
  61.             say "successful"
  62.         end
  63.     end
  64. end
  65.  
  66. return 0
  67.  
  68.