Switch for ExtractFileName

Ideas for new features & functions

Moderators: Dorian (MJT support), JRL

Post Reply
User avatar
Grovkillen
Automation Wizard
Posts: 1009
Joined: Fri Aug 10, 2012 2:38 pm
Location: Bräcke, Sweden
Contact:

Switch for ExtractFileName

Post by Grovkillen » Tue Sep 27, 2016 11:37 am

I know this is just me being lazy but I'd like to have a switch for the ExtractFileName command which let me include/remove the file extension.

We have ExtractFileExt which let us know the specific file's extension.
We have ExtractFilePath which let us know the specific file's path.
We have ExtractFileName which let us know the specific file's name+file extension.

Thus I need to trim etc. the file name in order to just convert a XLSX file to XLS. By my suggestion we would have a switch that will tell the script if file extension is wanted or not.

Let>FILENAME_EXT=0
This will trim the file extension.

Let>FILENAME_EXT=1
(DEFAULT) Will include the file extension.

Hope it make sense.

PS, I do this now with RegEx but it's not that logic for the untrained eye.

Code: Select all

ExtractFileName>%CURRENT_FILE%,strFileName
RegEx>\.[^.]*$,strFileName,0,Arr,Num,1,,strFileName
Let>ME=%Script%

Running: 15.0.24
version history

User avatar
Marcus Tettmar
Site Admin
Posts: 7378
Joined: Thu Sep 19, 2002 3:00 pm
Location: Dorset, UK
Contact:

Re: Switch for ExtractFileName

Post by Marcus Tettmar » Tue Oct 04, 2016 8:18 am

Haha, yeh I think you're being lazy ;-)

But I'll add this to the wish list. :-)
Marcus Tettmar
http://mjtnet.com/blog/ | http://twitter.com/marcustettmar

Did you know we are now offering affordable monthly subscriptions for Macro Scheduler Standard?

User avatar
Grovkillen
Automation Wizard
Posts: 1009
Joined: Fri Aug 10, 2012 2:38 pm
Location: Bräcke, Sweden
Contact:

Re: Switch for ExtractFileName

Post by Grovkillen » Tue Oct 04, 2016 8:37 am

Thanks Marcus! (for understanding my laziness) :roll:
Let>ME=%Script%

Running: 15.0.24
version history

Post Reply
cron
Sign up to our newsletter for free automation tips, tricks & discounts