mIRC Home    About    Download    Register    News    Help

Topic Options
#255245 - 02/10/15 11:24 PM /play -as echo
Wims Offline
Planetary brain

Registered: 31/07/06
Posts: 3438
Loc: France
Maybe I'm missing something but this looks like a bug:
Code:
//write -c test.txt test | play -as echo test.txt
echoes "Status Window test" in the status window, shouldn't it be just "test"?
_________________________
Looking for a good help channel about mIRC? Check #mircscripting @ irc.swiftirc.net

Top
#255394 - 19/10/15 01:38 PM Re: /play -as echo [Re: Wims]
Khaled Offline


Planetary brain

Registered: 04/12/02
Posts: 4297
Loc: London, UK
Thanks for your bug report. In this case, /play is passing the name of the window and the text to the /echo alias you have specified. However, as /echo has never supported window names with spaces, it treats "status window test" as plain text.

Other commands that support window names with spaces require them to be enclosed in quotes, eg. "Status Window". So, in order to resolve the issue you are seeing, /play would need to be changed to enclose window names in quotes, and /echo would need to be changed to parse window names in quotes. Unfortunately, both of these changes have the potential to break existing scripts.

Top
#255395 - 19/10/15 02:14 PM Re: /play -as echo [Re: Khaled]
Wims Offline
Planetary brain

Registered: 31/07/06
Posts: 3438
Loc: France
Right.

I certainly forgot that -s was meant to execute command from the file (not what I was trying to accomplish, I wanted to play the file locally from a status window, a pain!).

If "//play -a echo test.txt" reports an error, "//play -as echo test.txt" doesn't but it looks like the two switches cannot be used together, -s executes commands from the file, -a allow us to use any alias to be called with the line passed as parameter.
What I'm trying to say is: it's unclear what -as should do, if -s is validated, shouldn't it ignore -a and just execute line as command in the status window?
If -a is going to be used, shouldn't it ignore -s and just call the alias? If -as is supposed to work together, well this behavior for -s (where it won't end up executing line as command) is not described in the help file:
Quote:
In this case, /play is passing the name of the window and the text to the /echo alias you have specified
Why is /play passing the window name to /echo? This behavior is not described in the help file and I don't think it's correct behavior.


I also think that -a (and -e, actually) should allow us to bypass the 'status windows' issue, "/play -a echo test.txt" should work in status window, we currently get 'cannot play to this window', same with -e, since with an alias, we can handle the connected/not connected state ourselves, and with -e, it's locally displayed anyway.
_________________________
Looking for a good help channel about mIRC? Check #mircscripting @ irc.swiftirc.net

Top
#255428 - 22/10/15 12:20 PM Re: /play -as echo [Re: Wims]
Khaled Offline


Planetary brain

Registered: 04/12/02
Posts: 4297
Loc: London, UK
Quote:
but it looks like the two switches cannot be used together

I have just tested them together and they seem to work fine. The -s switch allows you to play to a status window while offline, and the -a switch allows you to use an alias.

Quote:
Why is /play passing the window name to /echo?

The most likely reason is that someone asked for /play to pass the window name to the alias so that they could use it in the alias, so I added support for that.

Remember, /play was specifically designed to play files while online. The -s switch can be specified to make it work offline.

Top
#261621 - 25/10/17 12:47 AM Re: /play -as echo [Re: Khaled]
Wims Offline
Planetary brain

Registered: 31/07/06
Posts: 3438
Loc: France
Quote:
I have just tested them together and they seem to work fine. The -s switch allows you to play to a status window while offline, and the -a switch allows you to use an alias.
The -s switch allow you to execute command to the status window while offline according to the help file and it's doing that fine when used alone.
/play -as is not executing command to the status window so I would like clarification as to how these two switches used together "seems to work fine" for you, the behavior resulting from the -as combination does not make any sense (either you want to execute command from the file to the status window while offline, or you want to pass the line to an alias, both just does not make any sense) and isn't described in the help file.
Offline, "/play -a echo test" where 'echo' is the alias being executed and 'test' is a filename with content in it, results in an error, but with the -s switch, it's acting like a vip pass and allows you to basically execute "/play -a echo test" while offline, I think this was not intended and is a bug. /play -as is not a meaningful combination imo and should report an error, I doubt many users would see this as a nice trick, it does not achieve much.

Some others /play's related issues:

Code:
//play -etoptions mirc.ini $active
use 0ms as the delay instead of the default 1000ms

Code:
/play -eb "status window"
Offline, results in
Quote:
/msg "status <clipboard content>
If this is meant to be supported then the help file is wrong saying that we must be connected for /play to work without the -m switch. Also, shouldn't it display the full "status window" parameter instead of just "status ? Also, uses 0ms instead of 1000ms.

Code:
/play -seb "status window"
also uses 0ms instead of 1000ms.
Note that this combination of switches is also buggy imo. Here -s is still not executing command, it's acting like a vip pass again, except this time it's somewhat useful to display some content locally to the status window, as it is (-as is adding the name of the output window), using /play. Practically speaking this shouldn't be used often and may report an error just like -as, but at least it makes sense.

Code:
/play -seb
if executed in a status window, shouldn't/couldn't it guess that the output is the status window, instead of returning an error?
_________________________
Looking for a good help channel about mIRC? Check #mircscripting @ irc.swiftirc.net

Top
#261625 - 27/10/17 11:52 AM Re: /play -as echo [Re: Wims]
Khaled Offline


Planetary brain

Registered: 04/12/02
Posts: 4297
Loc: London, UK
Quote:
/play -as is not executing command to the status window

I just tested this by running the command "//write -c test.txt test | play -as echo test.txt" in a query window and it displayed the text in the status window. Can you provide a step by step method that reproduces your issue?

The behaviours you are seeing, like the -t switch using 0ms, were requested by scripters at the time. The issue you describe with using "status window" enclosed in quotes was explained in my previous post.

That said, it is such an old, established command that, regardless of its quirks, it is unlikely that changes can be made to it without breaking backward compatibility.

Top
#261631 - 28/10/17 03:14 PM Re: /play -as echo [Re: Khaled]
Wims Offline
Planetary brain

Registered: 31/07/06
Posts: 3438
Loc: France
Thanks for the reply, I am not that much interested in changes, I was documenting https://en.wikichip.org/mirc/identifiers/$play and was testing some things.
I then remembered this thread and still considered it an issue.

Quote:
I just tested this by running the command "//write -c test.txt test | play -as echo test.txt" in a query window and it displayed the text in the status window.

Yes, I get the same behavior. This behavior is not described in the help file, this behavior is not expected to me.
The help file says that -s execute command to the status window, -s alone does it correctly, -sb does it correctly, only -sa and -se are not doing it.
/play -sa is executing the alias passed because of the -a switch, it is not executing command in the file to the status window.

Right now when I read the help file, there is nothing saying that using -as together is something special. Which means that the only way to understand it (which is consistent accross all the switches) is "do what -a does and then do what -s does" but that's not the case.

That's my issue, the help file is misleading, it should state that -s when used with -a or -e will never execute a command from the source.
Now what I'm trying to understand is what -s was meant to do when using with -a or -e, I can figure it out by trying and observing but I'd rather get a word from you about it.
You don't seem to be that puzzled about this, which tells me the behavior is probably normal.


Quote:
The issue you describe with using "status window" enclosed in quotes was explained in my previous post.
Well the previous post explains that -a results in the alias being called with the window name as the first parameter, in this case mIRC cannot do anything but my previous post is not using -a, it's using -e, there is no alias being called from our input in this case, it's mIRC choosing what to display so I was thinking it could display the proper window's name in the line, even if technically that would not work, not sure how -e is handled but it's a bit different from -a.
_________________________
Looking for a good help channel about mIRC? Check #mircscripting @ irc.swiftirc.net

Top