[Closed] System.Windows.Forms.Timer Unhandled Exception and escapeEnable = true
I have escapeEnable FALSE on startup on my machines and all max versions (2016, 2020, 2021)
Miracles. And all mine is true by default. I feel kinda discriminated
I double checked 2016 and found Macro_UIScheme.mcr
But it is the only place that I found where it can be enabled. Maybe when user ui scheme loads this macro gets executed.
-- C:\Program Files\Autodesk\3ds Max 2016\MacroScripts\Macro_UIScheme.mcr
MacroScript LoadScheme
category:~LOADSCHEME_CATEGORY~
internalCategory:"Customize User Interface"
tooltip:~LOADSCHEME_TOOLTIP~
ButtonText:~LOADSCHEME_BUTTONTEXT~
SilentErrors:(Debug != True)
(
on execute do
(
-- Default Directory and Filename "DefaultUI"
local DirectorySeed = pathconfig.AppendPath (getdir #UI) "DefaultUI.ui" --LOC_Notes: do not localize this
-- Disable Esacpe Key
EscapeEnable=false
--loads the UI scheme (function defined in the [maxinstall]/stdplugs/scripts/customUIschemes_functions.ms)
UIScheme_Filename = getOpenFilename filename:DirectorySeed caption:~LOADSCHEME_CAPTION~ \
types:~SCHEME_FILE_TYPE_CAPTION~ --LOC_Notes: localize this
loadCUIScheme UIScheme_Filename
-- Enable ESC Key
EscapeEnabled = true
messagebox ~MSGBOX_UI_SCHEME_RESTART_3DSMAX~ title:~MSGBOX_UI_SCHEME_RESTART_3DSMAX_TITLE~ -- LOC_Notes: localize this
)-- end execute
)--end MacroScript LoadScheme
Find in files found nothing else… so be it
at least won’t popup dialogs:
(
theTimer = dotnetobject "System.Timers.Timer"
fn OnTick sender arg =
(
print localtime
)
dotnet.addEventHandler theTimer "Elapsed" OnTick
theTimer.interval = 1000
theTimer.start()
escapeEnable = true
)
Yes, much better, but still unusable cause it stops printing timestamps after I press Esc a few times.
In Max 2014
Run the script
Keep the Esc key pressed for 2 seconds
Minimize Max
I get an error dialog and this:
-- Error occurred in isChecked(); filename: ......\Macro_Layer.mcr; position: 10061; line: 323
-- Frame:
-- called in anonymous codeblock
-- Frame:
>> MAXScript MacroScript Error Exception:
-- ** interrupted **
<<
Going back to Max I have the Macro_Layer.mcr as if the error really came from there.
Haven’t tried other versions.
After closing the error dialog the timer keeps running normally. But the issue repeats if you press Esc again.