HI,
I'm new to my Mac. I love it, but, it's definitely different than the
PCs I used for 20 years.
I've got some simple Ruby scripts that worked fine on my PC, but, they
don't seem to work on my Mac.
Here's one below. All it does it to use "curl" to pull some graphics
files from a distant database. My shell command would be something like:
orcagets.rb im197941.pdf im197963.pdf
Below is "orcagets.rb"
#!/usr/bin/ruby
$orcafile1 = ARGV[0]
$orcafile2 = ARGV[1]
$url = "http://ps2000-graphics-prod.bna.com/view/"
if $orcafile1 =~ /^p/ then
puts "This first file is a p file."
$prefix =
$orcafile1[/^([A-z,0-9]{1,15}p)([0-9]{1,5})\.([A-z]{3,4})/]
$prefix = $1
$numeral1 = $2
$flavor = $3
$numeral2 = $orcafile2[/^[A-z,0-9]{1,15}p([0-9]{1,5})\.[A-z]{3,4}/]
puts $numeral2
if $flavor == "tif" then
$flavor = "tiff"
$extension = "tif"
end
for i in $numeral1..$numeral2
`curl -o #{$prefix}0#{i}.#{$flavor}
#{$url}#{$flavor}/#{$prefix}0#{i}` if i.to_i < 10
`curl -o #{$prefix}#{i}.#{$flavor}
#{$url}/#{$flavor}/#{$prefix}#{i}` if i.to_i > 9
end
else
$prefix = $orcafile1[/^([A-z]{1,5})([0-9]{1,6})\.([A-z]{3,4})/]
$prefix = $1
$numeral1 = $2
$flavor = $3
$extension = $3
$numeral2 = $orcafile2[/^[A-z]{1,5}([0-9]{1,6})\.[A-z]{3,4}/]
$numeral2 = $1
puts $numeral2
if $flavor == "tif" then
$flavor = "tiff"
$extension = "tif"
end
for i in $numeral1..$numeral2
`curl -o #{$prefix}#{i}.#{$extension}
#{$url}/#{$flavor}/#{$prefix}#{i}`
end
end
I get, when I run the above script:
(LoadError)y: No such file or directory --
I have no problem on my PC. The files come over.
Thanks,
Peter
···
--
Posted via http://www.ruby-forum.com/.