Help with workflow to scale image and rename file by folder name?

Hi all, I was hoping someone can help me to put together the last piece of this puzzle. I’ve put together an automator workflow that allows me to resize/scale cbr (comic book) files from their original size down to whatever percentage i choose. I ultimately have to unzip the file then highlight all the pictures and use the workflow to resize them…at which point the workflow rezips the file and changes the extension to cbr with the newly scaled images. The last thing I’m trying to do is rename that file (it always comes out as archive.cbr) into the name of the folder that it is located in. I haven’t been able to figure this out as of yet.

I’ve been messing with it again today and cannot nail this down. The closest that I got was added a replace text workflow but that prompts me to manually type the output files name out. I’m trying to have the final outputted cbr file automatically renamed to match the exact folder name (just the name not the entire path). I tried messing with different scripts and nothing seems to work.

Sorry all, I think this is really an apples cript issue and should go into that forum instead of this one. My apologies for the duplicate.

No, this actually can be accomplished in Automator. In order to do this the Service has to receive folders.

See below, workflow I did. I tested it and it actually puts the name of the folder.