Example of using Ruby as a shell script
def exec(s)
print(s)
print(`#{s}`)
end
webDir = "c:\\Documents and Settings\\Jon\\My Documents\\My Pictures\\Web"
Dir.chdir(webDir)
exec("del /Q \"#{webDir}\\*.*\"")
1.upto(25) {|i|
exec("ls --sort=time --format=single-column \"c:/Documents and Settings/All Users/Documents/My Pictures/Managed Photos\" | grep --ignore-case jpg | head --lines=#{i} | tail --lines=1 | xargs --replace=- cp \"c:/Documents and Settings/All Users/Documents/My Pictures/Managed Photos/-\" \"./Photo#{i}a.jpg\"")
exec("c:\\Program Files\\ImageMagick-6.0.1-Q16\\convert.exe -sample 800x600 Photo#{i}a.jpg Photo#{i}.jpg")
exec("c:\\Program Files\\ImageMagick-6.0.1-Q16\\convert.exe -sample 150x112 Photo#{i}a.jpg Thumbnail#{i}a.jpg")
exec("montage -geometry +0+0 -background skyblue -label \"%[EXIF:datetime]\" Thumbnail#{i}a.jpg Thumbnail#{i}.jpg")
}
exec("ftp -i -n -s:\"c:\\Documents and Settings\\Jon\\My Documents\\Programming And Computers\\UploadPhotos.ftp\"")
print(s)
print(`#{s}`)
end
webDir = "c:\\Documents and Settings\\Jon\\My Documents\\My Pictures\\Web"
Dir.chdir(webDir)
exec("del /Q \"#{webDir}\\*.*\"")
1.upto(25) {|i|
exec("ls --sort=time --format=single-column \"c:/Documents and Settings/All Users/Documents/My Pictures/Managed Photos\" | grep --ignore-case jpg | head --lines=#{i} | tail --lines=1 | xargs --replace=- cp \"c:/Documents and Settings/All Users/Documents/My Pictures/Managed Photos/-\" \"./Photo#{i}a.jpg\"")
exec("c:\\Program Files\\ImageMagick-6.0.1-Q16\\convert.exe -sample 800x600 Photo#{i}a.jpg Photo#{i}.jpg")
exec("c:\\Program Files\\ImageMagick-6.0.1-Q16\\convert.exe -sample 150x112 Photo#{i}a.jpg Thumbnail#{i}a.jpg")
exec("montage -geometry +0+0 -background skyblue -label \"%[EXIF:datetime]\" Thumbnail#{i}a.jpg Thumbnail#{i}.jpg")
}
exec("ftp -i -n -s:\"c:\\Documents and Settings\\Jon\\My Documents\\Programming And Computers\\UploadPhotos.ftp\"")
0 Comments:
Post a Comment
<< Home