Page 1 of 1

How to use Alias w params in Catalog?

Posted: 08 Mar 2019 11:46
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)? ;-)

Re: How to use Alias w params in Catalog?

Posted: 09 Mar 2019 07:39
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.

Re: How to use Alias w params in Catalog?

Posted: 09 Mar 2019 09:51
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 1527 times

Re: How to use Alias w params in Catalog?

Posted: 09 Mar 2019 10:58
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?

Re: How to use Alias w params in Catalog?

Posted: 09 Mar 2019 13:55
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>

Re: How to use Alias w params in Catalog?

Posted: 11 Mar 2019 12:01
by MBaas
I don‘t feel sufficiently qualified to classify this as a „bug“, but it surely feels like one. May need Don ;)

Re: How to use Alias w params in Catalog?

Posted: 11 Mar 2019 13:21
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?

Re: How to use Alias w params in Catalog?

Posted: 11 Mar 2019 14:32
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 1468 times
I then defined the alias:
11-03-_2019_14-19-51.png
11-03-_2019_14-19-51.png (4.4 KiB) Viewed 1468 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 1468 times
...which led to this:
11-03-_2019_14-31-39.png
11-03-_2019_14-31-39.png (4.43 KiB) Viewed 1468 times

Re: How to use Alias w params in Catalog?

Posted: 20 Mar 2019 12:28
by MBaas
*ping* (Still unresolved...)

Re: How to use Alias w params in Catalog?

Posted: 24 Mar 2019 12:12
by MBaas
@Don: it seems nobody can find a fault with the way I'm doing it. Could it be a bug?

Re: How to use Alias w params in Catalog?

Posted: 27 Mar 2019 09:53
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?

Re: How to use Alias w params in Catalog?

Posted: 27 Mar 2019 10:39
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)

Re: How to use Alias w params in Catalog?

Posted: 27 Mar 2019 11:42
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

Re: How to use Alias w params in Catalog?

Posted: 27 Mar 2019 16:12
by MBaas
That's a neat idea, too - thanks! :-)