Welcome to %s forums

BrainModular Users Forum

Login Register

substring methods?

I need help on a Patch
Post Reply
woodslanding
Member
Posts: 1327
Contact:

Unread post by woodslanding » 19 Dec 2014, 02:37

I'd like to strip the extension from filenames for display, within a script. Should be easy, but not finding any substring methods in the docs....

thanks!
Custom Ryzen 5900x MATX build, Win10, Fireface UFX, touchscreen
Custom 2 manual midi keyboard
Usine, Kontakt, Reaktor, Synthmaster, Byome, Arturia, Soundtoys, Unify

shawnb
Member
Posts: 190
Location: San Francisco
Contact:

Unread post by shawnb » 19 Dec 2014, 05:33

Haven't used them yet, but...

I believe you can use Array modules on text strings. And there are modules for finding characters & extracting subarrays.

There are plenty of string functions in the scripting language.
Address the process rather than the outcome. Then, the outcome becomes more likely. - Fripp

sephult
Member
Posts: 1144
Contact:

Unread post by sephult » 19 Dec 2014, 05:38

http://www.sensomusic.org/wiki2/doku.ph ... tutorial05

I had the same issue kept looking at Declaration and References, where in the tutorial it had more information that helped.

-S
"Every act of creation is first an act of destruction." -Picasso

23fx23
Member
Posts: 2545
Contact:

Unread post by 23fx23 » 19 Dec 2014, 09:09

i rember did it by the past. there ares commands for that. try to find in delphi reference maybe could help..

http://www.delphibasics.co.uk/Article.asp?Name=Text

woodslanding
Member
Posts: 1327
Contact:

Unread post by woodslanding » 19 Dec 2014, 17:51

Well, I tried using 'Split', but it wasn't recognized.

The link is to the declarations, not the tutorial. And I looked inside the modules for extracting file names and paths, but they all use dedicated methods. And a dedicated method to strip the file extension is missing.

And stripping the extension display on a list object does not affect the CT out.
Custom Ryzen 5900x MATX build, Win10, Fireface UFX, touchscreen
Custom 2 manual midi keyboard
Usine, Kontakt, Reaktor, Synthmaster, Byome, Arturia, Soundtoys, Unify

sephult
Member
Posts: 1144
Contact:

Unread post by sephult » 19 Dec 2014, 21:03

"The link is to the declarations, not the tutorial"

Are you talking about the http://www.sensomusic.org/wiki2/doku.ph … tutorial05 I posted in reply?
Should point to section 5. Strings of the tutorial, as it does on my end.

The page does look like a declarations, but is actually within the tutorial...that was why I originally had problems finding substring functions.

-S
"Every act of creation is first an act of destruction." -Picasso

sephult
Member
Posts: 1144
Contact:

Unread post by sephult » 19 Dec 2014, 21:33

woodslanding -

http://www.sensomusic.org/forums/upload ... xample.pat

Here is an example of how to extract filenames using substring methods as in the link I had sent.

This brings in the filename as a string, and finds the count of characters in the filename.

Using this count and the delete you can find the starting point of the extension and just delete it.

Some of the substring commands I find problems with as well but a lot of times it's mostly my usage.
Like setting the length of a String was the first choice I picked, however this would not work as it was expecting a Tparameter instead of the string.

I hope this helps out :)

-S
"Every act of creation is first an act of destruction." -Picasso

Blaakk
Member
Posts: 96
Location: Tyne and Wear, UK
Contact:

Unread post by Blaakk » 21 Dec 2014, 21:01

Awesome! I've been trying and failing many string manipulations. This will be a huge help with everything. Your patch helps understanding..... I modified it to allow extracting from paths with longer extensions, ie... '.rack'.

http://www.sensomusic.com/forums/upload ... ample2.pat

Why did you use 'process' as opposed to 'callback' or 'process idle' in the 1st script?

sephult
Member
Posts: 1144
Contact:

Unread post by sephult » 22 Dec 2014, 01:18

So in my test I was just using a static text panel to update.
In this case I wanted to make sure I saw updates and trace updates in my debugging.

In the case of a callback I would have to be dynamically changing the input to get the trigger to happen.
If I used the same filename and text box, I never had a change.

I am not 100% sure if using a callback would be the best for a text input unless possibly you did like a has-changed and based off of that trigger. In past patches I tried to make sure everything was cut and clear as I had some conflicts.

Not totally related, but things like specifying a range of 0-100 on a Tparameter; you would think that the callback would only trigger on a value between 0-100, this is not the case as a -1 will also trigger etc... So without blabbing more, it has just been more of a conditioning of how I approach based on my past scripting more or less, and just a cut a clear script to achieve your end result.

-S
"Every act of creation is first an act of destruction." -Picasso

woodslanding
Member
Posts: 1327
Contact:

Unread post by woodslanding » 22 Dec 2014, 07:14

Wow, thank you so much, this is working great!!
Custom Ryzen 5900x MATX build, Win10, Fireface UFX, touchscreen
Custom 2 manual midi keyboard
Usine, Kontakt, Reaktor, Synthmaster, Byome, Arturia, Soundtoys, Unify

sephult
Member
Posts: 1144
Contact:

Unread post by sephult » 22 Dec 2014, 08:58

I am glad to hear woodslanding....I love to help and if you ever need any I am here!
Even if you have an idea and want to shoot back-and-forth, I love trying to solve things like that.

I am not a super-coder nor sometimes the best in efficiency, but I am an excellent integrator and can usually find solutions.

-S
"Every act of creation is first an act of destruction." -Picasso

Blaakk
Member
Posts: 96
Location: Tyne and Wear, UK
Contact:

Unread post by Blaakk » 23 Dec 2014, 16:58

Ah ok. Thank you Sephult the Integrator. I guess this is a title I'm working towards becoming worthy of. :) Cheers, the Tparameter range thing I shall certainly bear in mind.

Post Reply

Who is online

Users browsing this forum: No registered users and 22 guests