[Closed] Makepreview probs
As most of you know the maxscript “makepreview” command can not be canceled when started unlike the UI counter part where you can just press esc to make it stop. I need to batch dozends of previews and I want it automated. So while it currently works there is no way of stopping it except in between previews.
So I thought let maxscript open the UI for the makepreview dialog and press the ‘go’ button via some windows messaging kunfu…
The problem is that the dialog is blocking so once it opens maxscript halts until it’s closed again… I think I can get around it with either a backgroundworker thread or simply abusing a dotnet timer to fire messages at it from the background but I was hoping for a nicer solution…
anyone?
You mean catching the preview dialog via DialogMonitorOPS and send an ok message to it does not work for you ?
Strange… i do exactly the same in powerpreview when the Max internal make preview gets used
Here’s the related code part, which registers a open notification, opens the dialog and sends an “ok” -> result : the makepreview window closes and preview gets created like when the user pressed the “Create” button…
Just remove the irrelevant parts …
function OnInternalMakePreviewDialogOpened=
(
for hDlg in UIAccessor.GetPopupDialogs() do
(
if((UIAccessor.GetWindowText hDlg )== MaxLocale.UIStrings.MakePreview[MaxLocale.LanguageIndex] ) then
(
UIAccessor.SendMessageID hDlg #IDOK
)
)
DialogMonitorOPS.Enabled = false
DialogMonitorOPS.unRegisterNotification id:#MakePreviewCatcher
),
function RunInternalMakePreview showDialog:true=
(
if( showDialog ) then
max preview
else
(
-- automatially close the preview settings dialog
DialogMonitorOPS.unRegisterNotification id:#MakePreviewCatcher
try
(
DialogMonitorOPS.RegisterNotification OnInternalMakePreviewDialogOpened id:#MakePreviewCatcher
DialogMonitorOPS.Interactive=false
DialogMonitorOPS.Enabled = true
max preview
)
catch
(
DialogMonitorOPS.Enabled = false
DialogMonitorOPS.unRegisterNotification id:#MakePreviewCatcher
)
DialogMonitorOPS.Enabled = false
DialogMonitorOPS.unRegisterNotification id:#MakePreviewCatcher
)
)
MaxLocale is a struct holding al language related differences
here are the MakePreview dialog titles used above for various Max languages: ENG, DEU, FRA, the last three are chinese and korean etc… and total nonsens )
MakePreview = #(“Make Preview”, “Vorschau erstellen”, “Créer aperçu”, “???”, “???-???”, “?? ?? ???” ),
Ahh that is how it’s done I planned on ploughing through
mc = windows.getChildrenHWND (windows.getMaxHWND())
and search for something with the right title and etc… I think I prefer your method now