How to use Alias w params in Catalog?

Please check the FAQ (https://www.xyplorer.com/faq.php) before posting a question...
Post Reply
MBaas
Posts: 572
Joined: 15 Feb 2016 21:08

How to use Alias w params in Catalog?

Post by MBaas »

I defined this alias:

Code: Select all

currapl=C:\Batch\dya_170u64.btm <@0>
And would like to use it to replace the previously hardcoded location of the APL-Interpreter I'm calling in this catalog-item (specified as "location"):

Code: Select all

::run "C:\Batch\dya_170u64.btm c:\git\miserver `c:\git\miserver\miserver.dws miserver=c:/Git/TamStat-Site/`"
I tried the obvious

Code: Select all

::run "@currapl c:\git\miserver `c:\git\miserver\miserver.dws miserver=c:/Git/TamStat-Site/`"
but that gives an error-msg:

Code: Select all

Das System kann die angegebene Datei nicht finden.

File: @currapl

Parameters: c:\git\miserver `c:\git\miserver\miserver.dws miserver=c:/Git/TamStat-Site/`
run
@currapl c:\git\miserver `c:\git\miserver\miserver.dws miserver=c:/Git/TamStat-Site/`
(Doc says they'd be resolved very early - yet too late in this case...)

I also tried the following in the commandline w/o success:

Code: Select all

@currapl "c:\git\miserver c:\git\miserver\miserver.dws miserver=c:/Git/TamStat-Site/"
run "@currapl `c:\git\miserver c:\git\miserver\miserver.dws miserver=c:/Git/TamStat-Site/`"
Can anyone see if I am doing something wrong (and what it is)? ;-)
Last edited by bdeshi on 08 Mar 2019 15:51, edited 1 time in total.
Reason: codeboxes
______________________________________________
Happy user ;-)

bdeshi
Posts: 4249
Joined: 12 Mar 2014 17:27
Location: Asteroid B-612 / Dhaka
Contact:

Re: How to use Alias w params in Catalog?

Post by bdeshi »

This is not an issue specific to catalogs.
The bare @alias format is only valid when you're directly using it in the addressbar or as a location target elsewhere.

But in a script, alias values are retrieved in this format: <@aliasname>. So there you have to use <@currapl>
Execute this jump-to-help script to find the relevant help section:::rtfm "idh_variables.htm#idh_varget";

However, alias arguments, ie, <@0>, are not processed in this method. So you have to adjust the alias to make it work in the script.
Or simply, use the alias as a goto location target (mind the quotes):

Code: Select all

goto '@currapl "`c:\git\miserver c:\git\miserver\miserver.dws miserver=c:/Git/TamStat-Site/`"';
This is virtually the same as entering it in the addressbar, so no further processing is needed.
Icon Names | Onyx | Undocumented Commands | xypcre
[ this user is asleep ]

MBaas
Posts: 572
Joined: 15 Feb 2016 21:08

Re: How to use Alias w params in Catalog?

Post by MBaas »

Thanks - sounds plausible ;-) Unfortunately I get an error when executing this via address-bar or in the catalog-entry:
09-03-_2019_09-49-41.png
09-03-_2019_09-49-41.png (30.29 KiB) Viewed 1526 times
______________________________________________
Happy user ;-)

bdeshi
Posts: 4249
Joined: 12 Mar 2014 17:27
Location: Asteroid B-612 / Dhaka
Contact:

Re: How to use Alias w params in Catalog?

Post by bdeshi »

try inserting the alias with args directly in the catalog item's location, without any scripting preambles:

Code: Select all

@currapl c:\git\miserver `c:\git\miserver\miserver.dws miserver=c:/Git/TamStat-Site/`
If the original alias worked, this should work too.
If not, how exactly had you run this command before making the alias?
Icon Names | Onyx | Undocumented Commands | xypcre
[ this user is asleep ]

MBaas
Posts: 572
Joined: 15 Feb 2016 21:08

Re: How to use Alias w params in Catalog?

Post by MBaas »

That leads to an error "Spaces and slashes are not allowed in alias names".

> If not, how exactly had you run this command before making the alias?

The Catalog-Item's location originally was set as:

Code: Select all

::run "C:\Batch\dya_170u64.btm c:\git\miserver `c:\git\miserver\miserver.dws miserver=c:/Git/TamStat-Site/`"
and the alias is defined as

Code: Select all

currapl=C:\Batch\dya_170u64.btm <@0>
______________________________________________
Happy user ;-)

MBaas
Posts: 572
Joined: 15 Feb 2016 21:08

Re: How to use Alias w params in Catalog?

Post by MBaas »

I don‘t feel sufficiently qualified to classify this as a „bug“, but it surely feels like one. May need Don ;)
______________________________________________
Happy user ;-)

bdeshi
Posts: 4249
Joined: 12 Mar 2014 17:27
Location: Asteroid B-612 / Dhaka
Contact:

Re: How to use Alias w params in Catalog?

Post by bdeshi »

Probably not. Can you show a screenshot of the catalog item's Properties dialog, and the @currapl alias definition in List Management > Aliases?
Icon Names | Onyx | Undocumented Commands | xypcre
[ this user is asleep ]

MBaas
Posts: 572
Joined: 15 Feb 2016 21:08

Re: How to use Alias w params in Catalog?

Post by MBaas »

Ok, let me start with the working version:
11-03-_2019_14-15-15.png
11-03-_2019_14-15-15.png (19.79 KiB) Viewed 1467 times
I then defined the alias:
11-03-_2019_14-19-51.png
11-03-_2019_14-19-51.png (4.4 KiB) Viewed 1467 times
...and used it in the Catalog:
11-03-_2019_14-22-25.png
11-03-_2019_14-22-25.png (22.29 KiB) Viewed 1467 times
...which led to this:
11-03-_2019_14-31-39.png
11-03-_2019_14-31-39.png (4.43 KiB) Viewed 1467 times
______________________________________________
Happy user ;-)

MBaas
Posts: 572
Joined: 15 Feb 2016 21:08

Re: How to use Alias w params in Catalog?

Post by MBaas »

*ping* (Still unresolved...)
______________________________________________
Happy user ;-)

MBaas
Posts: 572
Joined: 15 Feb 2016 21:08

Re: How to use Alias w params in Catalog?

Post by MBaas »

@Don: it seems nobody can find a fault with the way I'm doing it. Could it be a bug?
______________________________________________
Happy user ;-)

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

Re: How to use Alias w params in Catalog?

Post by admin »

Came here from a signature. :mrgreen:

Verdict: Well, this is too much for the parser. Can't be done at the moment.

I could add a "flags" argument to SC run that will make it resolve a command that begins with an alias. But isn't that overdone? Why are you doing this?

MBaas
Posts: 572
Joined: 15 Feb 2016 21:08

Re: How to use Alias w params in Catalog?

Post by MBaas »

Thanks for visiting! ;-)

I have various items in the catalog that all launch the same .exe with different params. Thought I could make my life easier when I want to use an upgraded .exe by defining an Alias for it.

But yesterday it dawned on me that I could cover the call with a .bat and then just edit the bat when upgrading, so if Aliases are not suited for that, I can get by. Will update the signature 8)
______________________________________________
Happy user ;-)

jupe
Posts: 2757
Joined: 20 Oct 2017 21:14
Location: Win10 22H2 120dpi

Re: How to use Alias w params in Catalog?

Post by jupe »

Or you could just use a perm variable, something like perm $P_currapl = "C:\Batch\dya_170u64.btm"; and then an entry similar to ::run "$P_currapl c:\git\miserver `c:\git\miserver\miserver.dws miserver=c:/Git/TamStat-Site/`"

of course this assumes you still have this setting enabled (the default):

Configuration | General | Refresh, Icons, History | Scripting | Remember permanent variables

MBaas
Posts: 572
Joined: 15 Feb 2016 21:08

Re: How to use Alias w params in Catalog?

Post by MBaas »

That's a neat idea, too - thanks! :-)
______________________________________________
Happy user ;-)

Post Reply