mIRC Homepage
Posted By: Mpdreamz Com Result and close - 16/12/07 05:26 PM
This is a rather silly shortcut suggestion.

With COM's one has to do

Code:
var %x = $com(com).result
.comclose com
return %x


I would love to be able to do something like:
Code:
return $com(com).return

Instead.

which returns the result and silently closes the com.

I can imagine this being rather simple to add but it would make me a happier scripter smile
Posted By: Trashlord_ Re: Com Result and close - 17/12/07 01:35 AM
what if you need to use the object for more than just one call?
with that method, you would have to reopen it.

in fact, you would never get there, because it'd always get closed before it gets the second call.
Posted By: Collective Re: Com Result and close - 17/12/07 02:59 AM
He knows that, which is why he's suggesting a new property called .return rather than changing the current .result.
Posted By: Champagne Re: Com Result and close - 17/12/07 04:14 AM
That's a very lovely suggestion in my opinion Mpdreamz. Although I understand your calling it silly, I think it's a perfectly valid idea as it is often the case (when returning one value) that we must place a COM's result in a variable, close the object, and then proceed to return the variables value. That's just plain annoying to you (assumption) and I and possibly others who like to explore COM objects. It would make me happy too <3
Posted By: The_JD Re: Com Result and close - 17/12/07 03:49 PM
I like this idea myself... Every time I use $com I wonder why its not there allready.
Posted By: Mpdreamz Re: Com Result and close - 17/12/07 10:46 PM
-I've cooked up a hack method to do this but i have to refrain from posting it due to a challenge :p

Nonetheless (and challenge or not) i'd still love this wink
Posted By: Champagne Re: Com Result and close - 18/12/07 01:50 AM
Oh ? I'd be very interested in learning what it is you did when such information becomes available :P
Posted By: argv0 Re: Com Result and close - 18/12/07 02:52 AM
Please don't tell me it's

Code:
alias comresult { var %x = $com($1).result | .comclose $1 | return %x }

echo -a $comresult(x)

Posted By: Mpdreamz Re: Com Result and close - 18/12/07 10:14 AM
I won't because it's not,

Please tell me if I'm wrong arv0, but your tone comes off very belittling. Though i can understand your reply, I would not suggest "hacks" to anyone which is why i suggested a valid shortcut.

If its just me not having had my coffee yet and your just joking then i guess i can laugh at it when i have had my coffee smile
© mIRC Discussion Forums