Notifications
Clear all

[Closed] capture the listener

I would appreciate it if someone could help me with this.

i simply need to capture the last line printed in the listener window, and put that value into a string.

( i know how to do the string part – i just need to know how to actually retun the last line of the listener window )

any ideas ?

6 Replies

I don’t know of any way to directly access this value however there is an option to have the listener log all of it event to a file. Look up Turning on the Listener Log for info on this. With the log enabled the listener will save all entered and outputed text to a file. You could access this file and read in the last entry.

-bnvm

thanks for the reply bnvm… i had kind of hoped not to have to do it that way, but it seems it may be an easier solution in the long run… my main concern was basically the management of the log file ( with respect to generating a massive text file on disk as this function will perform part of a task used every day in max ) … but i suppose I could just clear the file at intervals within the script itself…

yeah thanks for the tip.
but does anyone else still know a way of just querying the listener ?

Hi,

Logging the listener is the only way I can think of at the moment. Don’t forget that you can clear the log at any time using

flushlog()

or you could even overwrite it whenever you have read what you want effectively meaning it’s only a couple of lines long. You can also have it only write output, and not input.
Maybe if you explain a little what it is that you’re trying to do we could offer some other suggestions.

Hey J_man,

basically im trying to replicate a function in Maya. Im new to max so im not sure if there is already a way to do this, but i thought i would try it to improve my maxscript skills anyway.

Maya had a great function whereby pressing “g” would repeat the last action ( with repect to initializing a tool or opening a dialogue or whatever ) and pressing “y” would initialize the most recently used tool. This was absurdly useful, and i would like a version of this in max. If i could capture the listener output, i have devised a way that i think i could implement this.
what do you think ?

1 Reply
(@bobo)
Joined: 11 months ago

Posts: 0

The MacroRecorder was added to MAXScript in Release 3, but the Listener access functions have been there since the initial MAXScript version in 2.0. They have never been updated to access the MacroRecorder output, so I assume it is not possible to implement a tool that would replicate the Maya function 100% (plus, if it was possible, someone would have done it in the last 7 years ;))
You can still repeat commands by selecting them in the Listener and pressing the Enter key, (or right-clicking the MiniListener in the bottom left corner and selecting a command from the right-click menu that will open). But I don’t think you can bind this feature to a shortcut.

Hmmm,

I think it is gonig to be tricky. Even if you do load the last entry in the listener, it wont tell you enough, what you’re looking for is the macrorecorder and I don’t know of any way to export the output from here.

Neat idea though!