Allow user defined global variables

Features wanted...
highend
Posts: 13274
Joined: 06 Feb 2011 00:33

Allow user defined global variables

Post by highend »

I'd really like to be able to define global variables that can be used anywhere in XY

Very much like 1.) aliases or 2.) a definition like perm $P_<some var name>; but without the need to use a perm (and therefore a script) in the place where this would be used

It should have a specific format like: <glob_{name of your global variable}>, e.g.:
<glob_uk_nuc_01>

And the same rules as they are valid for scripting variables could be used (without a leading $ ofc)

and in the definition for it its defined as: uk_nuc_01=192.168.0.5
So XY would put them together into its specific global variable name...

And now I could use it in the catalog (or anywhere else, CFA, scripting, etc.) e.g. for a location like:
\\<glob_uk_nuc_01>\dlna\movies
One of my scripts helped you out? Please donate via Paypal

WirlyWirly
Posts: 195
Joined: 21 Oct 2020 23:33
Location: Through the Looking-Glass

Re: Allow user defined global variables

Post by WirlyWirly »

+1

I posted pretty much the same thing just last month: viewtopic.php?f=5&t=24532

klownboy
Posts: 4109
Joined: 28 Feb 2012 19:27

Re: Allow user defined global variables

Post by klownboy »

+1 also

Where are we defining these new global variables, if not in scripts (or at least as you say, it doesn't have to be a script)? In a new menu item or list "Global variables" like the "Permanent variables" on the Scripting menu?

uk_nuc ? Is that from last week's news? :shock:
Windows 11, 22H2 Build 22621.1555 at 100% 2560x1440

highend
Posts: 13274
Joined: 06 Feb 2011 00:33

Re: Allow user defined global variables

Post by highend »

In: Menu - Tools - List Management - Global Variables
Is that from last week's news?
No, it's the netbios name of my local linux server :titter:
One of my scripts helped you out? Please donate via Paypal

WirlyWirly
Posts: 195
Joined: 21 Oct 2020 23:33
Location: Through the Looking-Glass

Re: Allow user defined global variables

Post by WirlyWirly »

I'd like to add that being able to set variables from the output of scripts would be very useful.

Lets say I want a variable for my current IP address, a global variable definition might look something like this...

Code: Select all

uk_nuc=::load "<xyscripts>\get_external_ip.xys"
Or the quick-scripting equivalent of whatever that file might contain

highend
Posts: 13274
Joined: 06 Feb 2011 00:33

Re: Allow user defined global variables

Post by highend »

I guess this would be a different approach (being able to define them via scripting).

But a valid one as well...

In that case they would be manageable via: Scripting - (Super?) Global Variables

and they could be created e.g. via
setglobal {some prefix to identify them as global}{var_name}; / unsetglobal <{global var}>;

And then we'd only need one additional custom event action: On startup

The initial script could be used with that and you are free to change / create / delete them whenever / wherever you like (via scripting)
One of my scripts helped you out? Please donate via Paypal

eil
Posts: 1617
Joined: 13 Jan 2011 19:44

Re: Allow user defined global variables

Post by eil »

I like the idea of using @alias as global variable, but reading the full description, i don't see any difference from permanent variables(only the syntax). Maybe it's better to improve PV, than create kinda twin..?(like say give PV own file, making .ini clearer)
Win 7 SP1 x64 100% 1366x768

highend
Posts: 13274
Joined: 06 Feb 2011 00:33

Re: Allow user defined global variables

Post by highend »

Both won't work. @ and $ can be part of paths and it's impossible to know if an alias / perm is part of it or stands for something completely different.

The var needs to be enclosed into something that avoids any ambiguity...

A simple example:
Alias: 1 = VSCode

Code: Select all

$menu = "@1|_first_entry_|D:\icons\@1.ico";
My icon is really D:\icons\@1.ico...
The caption would be fine, my icon not^^
One of my scripts helped you out? Please donate via Paypal

admin
Site Admin
Posts: 60357
Joined: 22 May 2004 16:48
Location: Win8.1 @100%, Win10 @100%
Contact:

Re: Allow user defined global variables

Post by admin »

What about giving access to permanent variables via a new variable type <perm [permanent_variable_name]>?

highend
Posts: 13274
Joined: 06 Feb 2011 00:33

Re: Allow user defined global variables

Post by highend »

If you add the CEA for "Other events" -> "Start" I'll buy it^^
One of my scripts helped you out? Please donate via Paypal

admin
Site Admin
Posts: 60357
Joined: 22 May 2004 16:48
Location: Win8.1 @100%, Win10 @100%
Contact:

Re: Allow user defined global variables

Post by admin »

LOL -- ask me again after 23.10 is published. I'm up to my ears in the release process.

highend
Posts: 13274
Joined: 06 Feb 2011 00:33

Re: Allow user defined global variables

Post by highend »

Ok, you've asked for it :masked:

*BUMP*

I really need this, my VPN provider software doesn't let me use hostnames while connected (inside the local lan)...
One of my scripts helped you out? Please donate via Paypal

admin
Site Admin
Posts: 60357
Joined: 22 May 2004 16:48
Location: Win8.1 @100%, Win10 @100%
Contact:

Re: Allow user defined global variables

Post by admin »

Wow. :biggrin: Next week...

eil
Posts: 1617
Joined: 13 Jan 2011 19:44

Re: Allow user defined global variables

Post by eil »

Hope "new" global vars would allow to migrate in separate file, making main .ini clearer. :ninja:
Win 7 SP1 x64 100% 1366x768

highend
Posts: 13274
Joined: 06 Feb 2011 00:33

Re: Allow user defined global variables

Post by highend »

Great stuff, defined my share as: \\<perm uk_nuc_01>\dlna\movies
and it works fine :tup:

Can we get the "On start" CEA as well please? I don't want to start new instances with command args (for a setup script loading)... :titter:
One of my scripts helped you out? Please donate via Paypal

Post Reply