Listener Window C++

Listener Window C++

istan
Advisor Advisor
510 Views
18 Replies
Message 1 of 19

Listener Window C++

istan
Advisor
Advisor

How to open the mxs listener window from C++?

I tried 'actionMan.executeAction 1 "40472"' but it does not open..

0 Likes
Accepted solutions (4)
511 Views
18 Replies
Replies (18)
Message 2 of 19

MartinBeh
Advisor
Advisor

No idea how to open the main MXS listener, but there is also the log mechanism - maybe that is useful?

Martin B   EESignature
→ please 'Like' posts that are helpful; if a post answers your question please click the "Accept Solution" button.
0 Likes
Message 3 of 19

istan
Advisor
Advisor

Ok. But I still cannot open a window to the user.

If I had to do this myself, I would rather implement my own message handling.

My hope was to simply open the Listener.

0 Likes
Message 4 of 19

miauuuu
Collaborator
Collaborator

So, something like this is not working:

ExecuteMAXScriptScript("actionMan.executeAction 1 40472", MAXScript::ScriptSource::NonEmbedded, TRUE, &res);

 

https://miauu-maxscript.com/
0 Likes
Message 5 of 19

istan
Advisor
Advisor

Interestingly 'actionMan.executeAction 0' closes but 'executeAction 1' does not open the window?! Weird..

0 Likes
Message 6 of 19

miauuuu
Collaborator
Collaborator

In 3ds max, when I use F11 this is printed in the Listener each time. Once it open the Listener, then it closes it.

actionMan.executeAction 0 "40472" -- MAX Script: Scripting Listener

https://miauu-maxscript.com/
0 Likes
Message 7 of 19

MartinBeh
Advisor
Advisor

There also is the WindowStream class - maybe that works for your needs?

Martin B   EESignature
→ please 'Like' posts that are helpful; if a post answers your question please click the "Accept Solution" button.
0 Likes
Message 8 of 19

miauuuu
Collaborator
Collaborator

 

 

Here is the code:

Value*
turnOnScriptingListener_cf(Value** arg_list, int count)
{
	
	BOOL quietErrors = TRUE;

	FPValue result = NULL;
	ExecuteMAXScriptScript(_T("actionMan.executeAction 0 \"40472\""), MAXScript::ScriptSource::NonEmbedded, quietErrors);

	return &undefined;
}

 

https://miauu-maxscript.com/
0 Likes
Message 9 of 19

MartinBeh
Advisor
Advisor

Yes, running

actionMan.executeAction 0 "40472"

in a new MAXScript also toggles the MXS Listener on and off, same what F11 does...

Martin B   EESignature
→ please 'Like' posts that are helpful; if a post answers your question please click the "Accept Solution" button.
0 Likes
Message 10 of 19

miauuuu
Collaborator
Collaborator
Accepted solution

Yep. The:

actionMan.executeAction 1 "40472"

does nothing for me. It only prints FALSE in the Listener.

 

I think that this: actionMan.executeAction 0 "40472" is enough. There are ways to check if the Listener window is actually open, so if it is not the 

 

ExecuteMAXScriptScript(_T("actionMan.executeAction 0 \"40472\"")

 

can be run to open it.

https://miauu-maxscript.com/
0 Likes
Message 11 of 19

istan
Advisor
Advisor

Wahhh this drives me crazy - it toggles the visibility. Thanks Miauu and Martin!

Now I need a function to find out if's already open..

0 Likes
Message 12 of 19

istan
Advisor
Advisor

solved.

if listener == undefined then ..

0 Likes
Message 13 of 19

MartinBeh
Advisor
Advisor

@istan wrote:

solved.

if listener == undefined then ..


Does that actually work? I never get anything but a WindowStream value from this global variable... 

Martin B   EESignature
→ please 'Like' posts that are helpful; if a post answers your question please click the "Accept Solution" button.
0 Likes
Message 14 of 19

MartinBeh
Advisor
Advisor

Just FYI, this seems to work well:

w = newScript()			-- create new text window
print "Hello world" to:w	-- simple way to output to new window

-- replace text of new window
h = w.hwnd
txt = "Some new text, replacing the entire window text"
-- get IntPtr to txt
marshal = dotnetclass "System.Runtime.InteropServices.Marshal"
ptr = marshal.StringToHGlobalUni txt
-- set text of new window
res = windows.sendMessage h 0xc 0 ptr
Martin B   EESignature
→ please 'Like' posts that are helpful; if a post answers your question please click the "Accept Solution" button.
0 Likes
Message 15 of 19

denisT.MaxDoctor
Advisor
Advisor

deleted

0 Likes
Message 16 of 19

denisT.MaxDoctor
Advisor
Advisor
Accepted solution

As I understand, you can talk about SDK, so,

maxscript.h -> 

 

show_listener();

 

 

Message 17 of 19

denisT.MaxDoctor
Advisor
Advisor

@istan wrote:

 

Now I need a function to find out if's already open..


IsWindow(the_listener_window) && (GetWindowLong(the_listener_window, GWL_STYLE) & WS_VISIBLE)

 

Message 18 of 19

istan
Advisor
Advisor
Accepted solution

Hey Denis,

show_listener();

did the job. Thanks a lot !!

0 Likes
Message 19 of 19

denisT.MaxDoctor
Advisor
Advisor
Accepted solution

@istan wrote:

Hey Denis,

show_listener();

did the job. Thanks a lot !!




Hey! That was my solution! 🤣

0 Likes