Automatically address a variable with a numeric prefix?

12 views
Skip to first unread message

paul.s...@telenet.be

unread,
Jul 29, 2024, 10:57:02 AM7/29/24
to filtermeister

Hello there,

Anyone still active on FilterMeister?
I have a question whether there is a possibility to automatically address the right variable provided with a numeric prefix?
It works with ctl's. For example, when ic0 = 5, ctl( ic0) is correctly controlled as ctl( 5).

I have tried different ways to do this with variables, but in vain.

What I want to achieve is this:
Example: variables "b"
int 00b, 01b, 02b, 03b, 04b, ...
Then be able to numerically store a value in the correct variable by linking a counter to this variable b.


Regards,
Paul



paul.s...@telenet.be

unread,
Jul 30, 2024, 3:34:24 AM7/30/24
to filtermeister
Hi Martin,

Of coarse, but I forgot to add that I want the storage remains, also after applying or leaving the filter ( e.g. to select another image). Arrays are in FM unavoidably erased after leaving the filter. The intention is to keep the values, as long the filter is in use. On the other hand, there is no necessarily need for a permanent storage.


Paul

Van: "Martin Vicanek" <martin....@web.de>
Aan: "paul simoens" <paul.s...@telenet.be>
Verzonden: Maandag 29 juli 2024 18:59:39
Onderwerp: Re: [FMML2] Automatically address a variable with a numeric prefix?

Hi Paul,

you can achieve that using arrays. Even simpler, for storing and accessing integers you can use memory cell functions:

put(t,i) stores the value t in cell with index i

get(i) reads the value from cell with index i

Hope that helps!

Martin

--
You received this message because you are subscribed to the Google Groups "FilterMeister Mailing List (FMML)" group.
To unsubscribe from this group and stop receiving emails from it, send an email to filtermeiste...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/filtermeister/991576111.53537394.1722265019239.JavaMail.zimbra%40telenet.be.

Roberto Muscia

unread,
Aug 2, 2024, 3:47:40 AM8/2/24
to FMML Filtermeister Mailing List
Hi Paul,

From my past experience with using plugins in a variety of image editors I know (or rather: was told) the hosts treat used memory of a filter differently: either at close down or at start up of a filter. Not all hosts clearing ALL previous data consistently has often caused the known "memory access violation" error.
Based on the fact described above I would say your only reliable alternative for storing data between filter sessions is using an external file to write to/read from.
Unless you find a lucky fluke in plugin handling with the image editor you use in particular, that is.

Roberto


Op Mon, 29 Jul 2024 19:20:23 +0200 schreef paul.simoens via FilterMeister Mailing List (FMML) <filter...@googlegroups.com>:
--
Gemaakt met Opera's e-mailprogramma: http://www.opera.com/mail/

paul.s...@telenet.be

unread,
Aug 2, 2024, 3:47:43 AM8/2/24
to filter...@googlegroups.com
Initially I had looked over the put() get() function.
But unfortunately here too, just like with arrays, everything is reset to 0 when leaving the filter,
even with cellpreserve( 1) set to on.

For now, addressing the variables via a switch() function seems to be the least bad method,
but clearly not an ideal solution.

Again: is there a trick to address an equivalent variable via a counter?


Paul

Van: "paul.simoens via FilterMeister Mailing List (FMML)" <filter...@googlegroups.com>
Aan: "filtermeister" <filter...@googlegroups.com>
Verzonden: Maandag 29 juli 2024 19:20:23

Roberto Muscia

unread,
Aug 2, 2024, 3:47:45 AM8/2/24
to filter...@googlegroups.com
Hi Paul,

From my past experience with using plugins in a variety of image editors I know (or rather: was told) the hosts treat used memory of a filter differently: either at close down or at start up of a filter. Not all hosts clearing ALL previous data consistently has often caused the known "memory access violation" error.
Based on the fact described above I would say your only reliable alternative for storing data between filter sessions is using an external file to write to/read from.
Unless you find a lucky fluke in plugin handling with the image editor you use in particular, that is.

Roberto


Op Mon, 29 Jul 2024 19:20:23 +0200 schreef paul.simoens via FilterMeister Mailing List (FMML) <filter...@googlegroups.com>:

paul.s...@telenet.be

unread,
Aug 2, 2024, 9:39:06 AM8/2/24
to filtermeister
Hi Martijn, thanks for responding!

It is about an image correction tool where you can set various parameters graphically by clicking on an Ownerdraw. Just like with ctls, I want the obtained values ​​to be retained during the duration of a filter session. This is the case with ctls. And ctls are also numerically addressable. So you can place a dynamic variable within a ctl, e.g. ctl( n).

Dynamic variable names by concatenating ?
My specific question was whether there is a possibility to create variables with a numerical prefix to provide them with the necessary values ​​via a loop, just like with a ctl.
Variables also retain their values ​​during the duration of a filter session. Once set, you can then also use filter-repeat (CTRL+F). The variables do not have to be stored permanently (which does not exclude my interest in an intelligent solution for permanent storage too).

Currently, a switch() function offers a workable solution, but is clearly not the ideal programming method.

If you should first create the necessary variables such as 0b, 1b, 2b, 3b, ... , is there a method to call the same variables via concatenation? In the style of n"+"b ?


Paul


Van: "Martijn van der Lee" <mar...@vanderlee.com>
Aan: "paul simoens" <paul.s...@telenet.be>
Verzonden: Vrijdag 2 augustus 2024 09:55:46

Onderwerp: Re: [FMML2] Automatically address a variable with a numeric prefix?

File storage seems most obvious for your case. I've used it plenty in the past and works just fine.
The registry might be another option.

One question is the lifecycle requirements of your storage. What should it bind to?
As I understand it, it should survive different images, but should/may it survive different image editors, different sessions of the same editor, etc? I don't think plug-ins have access to identifying information for any of these, at least not in any guaranteed way.

Perhaps it would help to have some information on the specific use case. Is this to act as precalculation/prefetch cache of some sort? Is it for keeping session settings like UI size/positioning?

regards,
Martijn

Op di 30 jul 2024 om 09:34 schreef paul.simoens via FilterMeister Mailing List (FMML) <filter...@googlegroups.com>:

paul.s...@telenet.be

unread,
Aug 2, 2024, 11:27:35 AM8/2/24
to filtermeister
Hi Duncan,

See former mails:
arrays are unavoidably wiped out when you leave the filter to e.g. change for another image ...
Same with put( n, m) and get( n).

Van: "Duncan Suss" <dunc...@gmail.com>
Aan: "paul simoens" <paul.s...@telenet.be>
Verzonden: Vrijdag 2 augustus 2024 17:17:46
Onderwerp: Re: [FMML2] Dynamic variable names by concatenating ?

Hi Paul,

Have you considered using arrays? The name plus index could maybe do what you are attempting with concatenation of a name plus integer.

Duncan


paul.s...@telenet.be

unread,
Aug 2, 2024, 11:51:07 AM8/2/24
to filtermeister

Unfortunately I have no experience with malloc and to dynamically link it as a variable.
I see examples with strings, but for numbers?


Van: "Duncan Suss" <dunc...@gmail.com>
Aan: "paul simoens" <paul.s...@telenet.be>
Verzonden: Vrijdag 2 augustus 2024 17:34:40

Onderwerp: Re: [FMML2] Dynamic variable names by concatenating ?

If you create your own using malloc() do they get wiped? I don't know and have no way to test it now. 

D.


paul.s...@telenet.be

unread,
Aug 2, 2024, 12:26:29 PM8/2/24
to filtermeister
Okay, but can you give a working demo of how to dynamically store - filter session persistent - values into an arbitrary variabele?
E.g. 0b, 1b, 2b, ... , 98b, 99b ?


Van: "Martijn van der Lee" <mar...@vanderlee.com>
Aan: "paul simoens" <paul.s...@telenet.be>
Verzonden: Vrijdag 2 augustus 2024 18:17:17

Onderwerp: Re: [FMML2] Dynamic variable names by concatenating ?

I think you have 10 255-character string variables at your disposal, named str0 to str9.

Op vr 2 aug 2024 17:51 schreef paul.simoens via FilterMeister Mailing List (FMML) <filter...@googlegroups.com>:
Reply all
Reply to author
Forward
0 new messages