Author Topic: A variable to return the number in front of a the underscore in a file name.  (Read 5466 times)

Offline runner

  • Newcomer
  • *
  • Posts: 49
    • View Profile
Is possible to get a variable to reliably return the number in front of a the underscore in a file name? I need it to work, with a mixture of 1,2 & 3 digit numbers, examples, file name 1_1234 I'd need the 1 returning, file name 123_1234 I'd need the 123 returning.



Photo Mechanic
I highly recommend Photo Mechanic's, it's revolutionised my workflow also it's simplified & speeded the delivery of images to clients

Offline Kirk Baker

  • Senior Software Engineer
  • Camera Bits Staff
  • Superhero Member
  • *****
  • Posts: 24985
    • View Profile
    • Camera Bits, Inc.
Is possible to get a variable to reliably return the number in front of a the underscore in a file name? I need it to work, with a mixture of 1,2 & 3 digit numbers, examples, file name 1_1234 I'd need the 1 returning, file name 123_1234 I'd need the 123 returning.

The closest thing we have for doing that is variables substring extraction, but your filenames would need to be consistently named like so:

001_1234
123_1234

in order for it to work properly.  If your filenames were consistent then you would use {filenamebase:0,3} and you would get 001 and 123 out of it.

I don't have any solution for you to work with the names you described.

-Kirk


Offline runner

  • Newcomer
  • *
  • Posts: 49
    • View Profile
Thanks Kirk
That almost works for me.




Photo Mechanic
I highly recommend Photo Mechanic's, it's revolutionised my workflow also it's simplified & speeded the delivery of images to clients

Offline runner

  • Newcomer
  • *
  • Posts: 49
    • View Profile

Would it be possible to use the prefix variable with or without variables substring extraction? either way the 3 digit file number prefix looks workable.
Also  can you help me get PM back on my laptop? I've reloaded windows & have lost the registration details.






Photo Mechanic
I highly recommend Photo Mechanic's, it's revolutionised my workflow also it's simplified & speeded the delivery of images to clients

Offline Kirk Baker

  • Senior Software Engineer
  • Camera Bits Staff
  • Superhero Member
  • *****
  • Posts: 24985
    • View Profile
    • Camera Bits, Inc.

Would it be possible to use the prefix variable with or without variables substring extraction? either way the 3 digit file number prefix looks workable.

Offhand I don't know.  Give it a try.

Quote from: runner
Also can you help me get PM back on my laptop? I've reloaded windows & have lost the registration details.

Contact support@camerabits.com and let them know who you are.  They can look you up and then email you your registration.

-Kirk



Offline runner

  • Newcomer
  • *
  • Posts: 49
    • View Profile
Thanks Kirk
It seems the prefix variable does return the first 3 digits of the file name or number.