Defining Global Variables on Start-up

Features wanted...
Post Reply
WirlyWirly
Posts: 312
Joined: 21 Oct 2020 23:33
Location: XY 64-Bit | Win 10 @ 100% (3440x1440)

Defining Global Variables on Start-up

Post by WirlyWirly »

I posted in another thread asking if there might be a way to create a custom <MyVariable>, with the same scope and functionality of <xypath>/<xyicons>/<xydata>/etc.

My particular use case was described in my post, but essentially I'd like to turn a repetitive string that I use throughout XY (CFA/Scripts/Toolbar/etc) into its own variable.

A simple .ini file in the XY folder could suffice, a more advanced option might be a .xys script that is run at XY start-up to allow the user to generate more complex variables. These variables could then be used across XY in the GUI and scripts, just like <xypath>/<xydata>/etc.

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

Re: Defining Global Variables on Start-up

Post by eil »

I'd propose you to investigate aliases, may help in your variable desire. Plus, there is a way to run script on start, you'll just need to run XY through .lnk with parameters.
Win 7 SP1 x64 100% 1366x768|1900x1080

highend
Posts: 14925
Joined: 06 Feb 2011 00:33
Location: Win Server 2022 @100%

Re: Defining Global Variables on Start-up

Post by highend »

Aliases work in CFAs?

Another way would be an environment variable for the current user. The only current problem: XY only reads some standard environment variables, not all defined. Maybe a feature wish to change that?
One of my scripts helped you out? Please donate via Paypal

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

Re: Defining Global Variables on Start-up

Post by eil »

highend wrote: 17 Apr 2022 21:17 Aliases work in CFAs?
Don't know, just remembered smth along the lines. If they don't, This could be good idea for new feature - alias support everywhere.(and that would be quite a "user defined variable")
Win 7 SP1 x64 100% 1366x768|1900x1080

highend
Posts: 14925
Joined: 06 Feb 2011 00:33
Location: Win Server 2022 @100%

Re: Defining Global Variables on Start-up

Post by highend »

The problem is: Alias definitions begin with @

How should XY definitely know if something inside a string is an alias or a simple folder name part?

Alias: @scripts=<xydata>

CFA:
txt>::load "R:\tmp\@scripts\notme.xys";
One of my scripts helped you out? Please donate via Paypal

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

Re: Defining Global Variables on Start-up

Post by eil »

highend wrote: 17 Apr 2022 23:29 The problem is: Alias definitions begin with @

How should XY definitely know if something inside a string is an alias or a simple folder name part?
IMO, i'd just make @name be treated like $name(how it kinda is now, but not everywhere), and @-at_start not interpreted any other way.
Win 7 SP1 x64 100% 1366x768|1900x1080

Post Reply