home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 35 Internet / 35-Internet.zip / wwwos2.zip / bookmark.cmd < prev    next >
OS/2 REXX Batch file  |  1998-07-31  |  3KB  |  82 lines

  1. /* Creates WebWilly for OS/2 bookmarks for "http://" URLs,
  2. in the current directory, from the command line */
  3.  
  4. parse arg args
  5. parse var args . '"' title '"' . '"' url '"' date time
  6. if date='' then date=insert("/",insert("/",date("S"),4),7)
  7. if time='' then do
  8.    time=time('C')
  9.    if length(time)=6 then time=0||time
  10. end
  11. if url='' | length(time)<>7 | length(date)<>10 | pos('/',date)<>5 | lastpos('/',date)<>8 | pos(':',time)<>3 | pos(":/",url)>0 then do
  12.    say ""
  13.    say "Arguments:"
  14.    say "----------"
  15.    say "1.  The page's title, in quotation marks"
  16.    say "2.  The URL, in quotation marks, without 'http://' at the front"
  17.    say "3.  The date, ten characters long, as in 1996/09/23"
  18.    say "4.  The time, seven characters long, as in 01:00am"
  19.    say "If date and time are omitted, computer's clock will be used."
  20.    exit
  21. end
  22.  
  23. call RxFuncAdd 'SysLoadFuncs', 'RexxUtil', 'SysLoadFuncs'
  24. signal on syntax name NoREXX
  25. call SysLoadFuncs
  26. signal on syntax name Syntax
  27. '@ECHO OFF'
  28.  
  29. url="http://"||url
  30. string='17'x||title||'09'x||url||'09'x||date||'09'x||time||'09'x||'20'x||'09'x||'09'x
  31. filename=GetPopName(directory(),'URL')
  32. if filename='error' then exit
  33. filename=filename'.URL'
  34. call lineout filename
  35.  
  36. if SysPutEA(filename,'URLFILEBUFFER',string)=0 then say "Created bookmark" filename
  37. else say "Unsuccessful!"
  38. if stream(filename)<>"UNKNOWN" then call lineout filename
  39.  
  40. exit
  41.  
  42. Syntax:
  43.   say 'Error' rc 'in line' sigl':' errortext(rc)
  44.   say sigl':' sourceline(sigl)
  45.   exit
  46. return
  47.  
  48. NoREXX:
  49.    say 'Unable to load the REXXUtil functions.  Either the REXXUTIL.DLL file'
  50.    say 'is not on the LIBPATH or REXX support is not installed on this system.'
  51.    exit
  52. return
  53.  
  54. /* Copyright (c)1996 Kari Jackson for InnoVal Systems Solutions, Inc. */
  55. /* Subroutine to produce a *.POP-style filename */
  56. /* Returns 8-character name or "error" */
  57. GetPopName:procedure
  58. parse arg directory,extension
  59. characters='0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ'
  60. parse value date("O") with . 2 year "/" month "/" day
  61. parse value time() with hour ":" minute ":" second
  62. month=substr(characters,month+1,1)
  63. day=substr(characters,day+1,1)
  64. hour=substr(characters,hour+1,1)
  65. fifth=minute%36
  66. sixth=substr(characters,minute//36+1,1)
  67. test=second//36
  68. string=year||month||day||hour||fifth||sixth
  69. do j=1 to 36
  70.    test2=(test+j)//36
  71.    if test2=0 then seventh=substr(characters,36,1)
  72.    else seventh=substr(characters,test2,1)
  73.    do i=1 to 36
  74.       tryit=string||seventh||substr(characters,i,1)
  75.       filename=directory||"\"||tryit||'.'||extension
  76.       if stream(filename,'c','query exists')='' then return tryit
  77.    end
  78. end
  79. say "There have already been 1296 files created in this directory during"
  80. say "this minute.  Please wait until the clock changes and try again."
  81. return 'error'
  82.