Welcome to %s forums

BrainModular Users Forum

Login Register

Extract file name / extract file ext

I need help on a Patch
Post Reply
AndrewChi
Member
Posts: 62
Location: Belgium
Contact:

Unread post by AndrewChi » 12 Feb 2015, 16:24

Hello,
I need some help...
I am trying to save a random sample name and a text file with the same name.
This works, but I also need to extract the file name WITHOUT extension (.WAV and .TXT) later on to work with it in the patch.
the module 'extract file ext' extracts the extension,
but the module 'extract file name' gives you in fact the 'short filename' but it still has its extension.
Any ideas on how to really extract the file name, without its extension?

Any help appreciated, thanks!!!

User avatar
senso
Site Admin
Posts: 4424
Location: France
Contact:

Unread post by senso » 13 Feb 2015, 00:00

You can use this small script

Code: Select all

/////////////////////////////////////////////
// sub File Ext   
////////////////////////////////////////////

// parameters declaration
var input     : Tparameter;
var output    : Tparameter;



 // initialisation : create parameters
procedure init;
begin  
 SetModuleColor($808080+302060);
 Input := CreateParam('full file name',ptTextField);
 SetIsOutPut(Input,false);
 output := CreateParam('out',ptTextField);                                 
 SetIsInPut(Output,false);      
end;
                         

procedure Callback(n:integer);
begin               
 SetStringValue(Output,copy(GetStringValue(Input),1,length(GetStringValue(Input))-4));    
end;
Will be integrated in the next major release

AndrewChi
Member
Posts: 62
Location: Belgium
Contact:

Unread post by AndrewChi » 13 Feb 2015, 03:23

Great! Thank you very much for your fast reply Senso. Works perfect!!

Post Reply

Who is online

Users browsing this forum: No registered users and 69 guests