Switch for ExtractFileName

Ideas for new features & functions

Moderators: JRL, Dorian (MJT support)

Post Reply
User avatar
Grovkillen
Automation Wizard
Posts: 406
Joined: Fri Aug 10, 2012 2:38 pm
Location: Hudiksvall, 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: MS14.5.4

User avatar
Marcus Tettmar
Site Admin
Posts: 7124
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: 406
Joined: Fri Aug 10, 2012 2:38 pm
Location: Hudiksvall, 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: MS14.5.4

Post Reply