home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 35 Internet / 35-Internet.zip / getwp02b.zip / GetWPics.CMD < prev    next >
OS/2 REXX Batch file  |  1996-08-22  |  3KB  |  104 lines

  1. /*
  2.         GetWEBPics 0.2b
  3.         (C) 1996 By Marco Pontello
  4.  
  5.         Download all *.JPG & *.GIF files from a WWW page
  6.         (Need GetURL (C) Derek J Decker)
  7.  
  8. */
  9.  
  10. Call ShowHeader
  11.  
  12. Parse Arg URLName
  13.  
  14. If URLName = '' then
  15. do
  16.         Call ShowUsage
  17.         exit
  18. end
  19.  
  20. GetURLPath = 'f:\tools\geturl\'
  21.  
  22. Say 'Getting Index file...'
  23. '@'GeturlPath'geturl http://'URLName ' -timeout 200 -o Index.TMP'
  24.  
  25. if Translate(Right(URLName,4)) = ".HTM" | Translate(Right(URLName,5)) = ".HTML" then
  26. do
  27.         c = ''
  28.         do i = length(URLName) to 1 by -1
  29.                 c = substr(URLName, i, 1)
  30.                 if c = '/' then leave
  31.         end
  32.         URLName = Left(URLName, i)
  33. end
  34.  
  35. if Right(URLName,1) <> "/" then URLName = URLName || "/"
  36.  
  37. TotLines = 0
  38. TotImg = 0
  39. ImgList= ' '
  40.  
  41. Say 'Scanning...'
  42.  
  43. SrcFile = 'Index.TMP'
  44.  
  45. DO WHILE Lines(SrcFile)
  46.         Temp = Strip(LineIn(SrcFile))
  47.         If Temp <> "" then
  48.         Do
  49.                 TotLines = TotLines +1
  50.                 SrcLines.TotLines = Temp
  51.                 l = TotLines
  52.                 P = Pos('<A HREF="', Translate(SrcLines.l))
  53.                 If P <> 0 then
  54.                 do
  55.                         PP = Pos('">', SrcLines.l,P)
  56.                         Temp= SubStr(SrcLines.l, P, (PP-P+2))
  57.                         P = Pos('"', Temp)
  58.                         PP = Pos('"', Temp, P+1)
  59.                         Link = SubStr(Temp, P+1, (PP-P-1))
  60.  
  61.                         if Translate(Right(Link,4)) = ".JPG" | Translate(Right(Link,4)) = ".GIF" then
  62.                         do
  63.                                 if WordPos(Link, ImgList) = 0 then
  64.                                 do
  65.                                         TotImg = TotImg +1
  66.                                         Img.TotImg = Link
  67.                                         ImgList = ImgList || Link || ' '
  68.                                 end
  69.                         end
  70.                 end
  71.         end
  72. end
  73.  
  74. SrcLines.0 = TotLines
  75. Img.0 = TotImg
  76. Say 'Found 'TotImg' link to pics.'
  77. Say ' '
  78.  
  79. If TotImg > 0 then
  80. do
  81.         i = 1
  82.         DO while i <= TotImg
  83.                 Say 'Pic 'i'/'TotImg' - 'Img.i
  84.                 '@'GeturlPath'geturl http://'URLName''Img.i ' -o -timeout 200'
  85.                 i = i + 1
  86.         END
  87. end
  88.  
  89. Say ' '
  90. Say 'Finished!'
  91. exit
  92.  
  93.  
  94.  
  95. ShowHeader:
  96.         Say ''
  97.         Say 'GetWEBPics 0.2b - (C) 1996 By Marco Pontello'
  98.         Say '--------------------------------------------'
  99. return
  100.  
  101. ShowUsage:
  102.         Say 'Usage: GetWPics <URL>'
  103. return
  104.