Callback when SME is open and closed
I've got the callback for when SME is open from MSX help and I've tried to reverse engineer it to work when it's closed.
I've never used dialogmonitorops or UIAccessor before so any help would be appreciated.
Code I've got so far:
clearlistener() DialogMonitorOPS.unRegisterNotification id:#mxs_test_open DialogMonitorOPS.unRegisterNotification id:#mxs_test_closed fn SlateCallbackOpen = ( clearlistener() h = dialogmonitorops.getwindowhandle() -- get current popup window if UIAccessor.GetWindowText h == "Slate Material Editor" then ( print "Slate Material Editor is opened" print (UIAccessor.GetWindowClassName h) print (UIAccessor.GetWindowText h) ) true ) fn SlateCallbackClosed = ( clearlistener() h = dialogmonitorops.getwindowhandle() -- get current popup window if UIAccessor.GetWindowText h != "Slate Material Editor" then ( print "Slate Material Editor is closed" print (UIAccessor.GetWindowClassName h) print (UIAccessor.GetWindowText h) ) true ) -- register dialog monitor callback notificition dialogmonitorops.registernotification SlateCallbackOpen id:#mxs_test_open dialogmonitorops.registernotification SlateCallbackClosed id:#mxs_test_closed -- enable dialog monitor dialogmonitorops.enabled = true
Comments
Got this example now from the
Got this example now from the help file also..
But still no moving with SME yet..
`
hey,
I think it's not so simple and you will need to use .net + user32
take a look on "SetWinEventHook"
http://stackoverflow.com/questions/9454979/how-to-monitor-a-windows-posi...
http://www.codeproject.com/Articles/80255/Add-Your-Control-On-Top-Anothe...
or maybe WinEvents
http://stackoverflow.com/questions/9665579/setting-up-hook-on-windows-me...
I think I've got a headache
I think I've got a headache looking at this stuff.. I might ask over on some of the other MXS forums :)
`
I'm looking now into WindowShopper by Rotem Shiffman
it read messages of windows in real time and it uses "WndProc"
I'll try to get some function to read windows move only
`
oki,
here is it a small script to create callback for external window
it only prints out SME position but you will see general idea how it works
it's based on Window Shopper by Rotem Shiffman:
http://www.monotoneminimal.com/free-tools
take a look in attachment
remember to declare callback as global and release handle when you close your script
when callback is a global variable you can stop it also when script crash -> msgSnooper.releaseHandle()
ha, and also... with this callback messages you can read when SME is opened or closed :)