Friday, July 20, 2018

#1 2005-12-11 03:04:51 pm

Registered: 2005-12-11
Posts: 1

How to integrate a perl script?

A friend wrote a quick perl script to add an image's dimensions to the file name. How can I incorporate this into Automator?

My attemps have ended in Workflow Execution Failed... I know I'm not even really that close anyway. I just popped it into a Run Shell Script step and put an image in a Get Specificed Finder Items step.


use warnings;
use strict;

use Image::Size;
use File::Basename;

my ($base, $dir, $ext, $new_name);

for (grep {-f} <*.gif || *.jpg>) {
   my ($x, $y) = imgsize($_);
   ($base, $dir, $ext) = fileparse($_, '\..*');
   $new_name = "$base" . "_" . "$x-$y" . "$ext";
   rename($_, $new_name);



Board footer

Powered by FluxBB

RSS (new topics) RSS (active topics)