rodi01 / RenameIt

Keep your Sketch files organized, batch rename layers and artboards.
https://renameit.design/sketch/
MIT License
1.41k stars 110 forks source link

Small issue with number iterator #71

Closed clecompte closed 6 years ago

clecompte commented 6 years ago

First off, thank you for this plugin. I used to manually retitle my artboards, so this is saving me a ton of time.

I kept running into an issue where my first nine artboards would be titled 1, 2, 3... so on. Then 10, 11, 12, etc would hit. Given that I sync this with Invision, I need the first nine artboards to be padded with 0. So, obviously: 01, 02, 03, 04, 05, 06, 07, 08, 09, 10. You get the point.

I was messing around with the plugin files and got it working on my end by modifying the replaceNumber function. More specifically, I changed the if statement to this:

if ((num > 99 && num < 999)) nnSize = 3; else if ((num > 9 && num < 99)) nnSize = 2; else if ((num > 0 && num < 10)) nnSize = 2;

So it looks like the functionality is there to handle the padding, but something is broken. Anyway, I'm sure there's a better fix for this as I'm not 100% sure what's happening in that function. Also, I have no idea if it works above 99.

Again, thanks!

rodi01 commented 6 years ago

@clecompte Have you tried using %NN for the padding? The amount of "N" will determine the padding.

I just tested it and it's working fine. My apologies if I'm not understanding the post correctly.

clecompte commented 6 years ago

Haha, well that's an easy solution. Yep, that's the answer to my problem. Thanks!

rodi01 commented 6 years ago

@clecompte I'm glad it helped. Cheers!