As i'm a french, i got a french translated Automator, so excuse me if you didn't understand my english translation... So i said that the "Get selected Finder Items" makes the process go wrong whereas the "Get specified Finder Items" (if we don't select any files by default) gives what we want (the path and the file name). That's my process: "Get Specified Finder Items" -> Script Perl
the Script perl (corrected thanks to you) is: use File::Basename; print "@ARGV"; foreach (@ARGV){ print "$_ \n"; $file=basename $_; $dir=dirname $_; print "$dir --> $file \n"; chdir $dir or die "erreur, impossible de changer de répertoire: $!"; !system ("tar", "czf", "$file.tgz", $file) or die "erreur à l'éxecution de la commande tar -czf: $!\n"; }
So, as i told you before, i tried to understand what the difference is between the results from "Get Selected Finder Items" and those from "Get Specified Finder Items". And, after a View Result action of each result, i got this:
"Get Specified Finder Items" ==> {alias "Macintosh HD:Users:sylvainpascal:Desktop:inscription_université:"}
and :
"Get Selected Finder Items"==> {folder "inscription_université" of folder "Desktop" of folder "sylvainpascal" of folder "Users" of startup disk of application "Finder"}
Although i saw that before running the script action, Automator runs a specific process to obtain the right conversion:
the "get selected Finder Items": Data conversion from ("com.apple.finder.file-or-folder-object") to ("com.apple.cocoa.string") error followed in the perl script: "an error tar: Substituting `.' for empty member name
the "Get Specified Finder Items": Data conversion from ("com.apple.applescript.alias-object") to ("com.apple.cocoa.string") all works well in the Perl Script!
thank you, see you soon, Syl20 |