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: 243
Joined: 15 Feb 2016 21:08

How to use Alias w params in Catalog?

Post by MBaas » 08 Mar 2019 11:46

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 SammaySarkar on 08 Mar 2019 15:51, edited 1 time in total.
Reason: codeboxes
_____________________________________________
Happy user ;-)

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

Re: How to use Alias w params in Catalog?

Post by SammaySarkar » 09 Mar 2019 07:39

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.

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

Re: How to use Alias w params in Catalog?

Post by MBaas » 09 Mar 2019 09:51

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 456 times
_____________________________________________
Happy user ;-)

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

Re: How to use Alias w params in Catalog?

Post by SammaySarkar » 09 Mar 2019 10:58

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?

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

Re: How to use Alias w params in Catalog?

Post by MBaas » 09 Mar 2019 13:55

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: 243
Joined: 15 Feb 2016 21:08

Re: How to use Alias w params in Catalog?

Post by MBaas » 11 Mar 2019 12:01

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

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

Re: How to use Alias w params in Catalog?

Post by SammaySarkar » 11 Mar 2019 13:21

Probably not. Can you show a screenshot of the catalog item's Properties dialog, and the @currapl alias definition in List Management > Aliases?

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

Re: How to use Alias w params in Catalog?

Post by MBaas » 11 Mar 2019 14:32

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 397 times
I then defined the alias:
11-03-_2019_14-19-51.png
11-03-_2019_14-19-51.png (4.4 KiB) Viewed 397 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 397 times
...which led to this:
11-03-_2019_14-31-39.png
11-03-_2019_14-31-39.png (4.43 KiB) Viewed 397 times
_____________________________________________
Happy user ;-)

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

Re: How to use Alias w params in Catalog?

Post by MBaas » 20 Mar 2019 12:28

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

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

Re: How to use Alias w params in Catalog?

Post by MBaas » 24 Mar 2019 12:12

@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: 47703
Joined: 22 May 2004 16:48
Location: Cologne, Win 8.1, Win 10
Contact:

Re: How to use Alias w params in Catalog?

Post by admin » 27 Mar 2019 09:53

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: 243
Joined: 15 Feb 2016 21:08

Re: How to use Alias w params in Catalog?

Post by MBaas » 27 Mar 2019 10:39

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: 1241
Joined: 20 Oct 2017 21:14
Location: 1909 x64

Re: How to use Alias w params in Catalog?

Post by jupe » 27 Mar 2019 11:42

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: 243
Joined: 15 Feb 2016 21:08

Re: How to use Alias w params in Catalog?

Post by MBaas » 27 Mar 2019 16:12

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

Post Reply