PDA

View Full Version : How do you cancel an export?


Hobbs
03-18-2008, 05:01 PM
Is it possible to have a callback script run preExport, and then if the script should fail, or if a certain event results allow the script to cancel the Export?

so to clarify...using callbacks.addScript "Export_Script()" #preExport

if Export_Script() returns "cancel" can i then Cancel the Export?

Or as soon as you click the Export in max, there's no way to stop it from Exporting?

ZeBoxx2
03-18-2008, 06:38 PM
One method (maybe the only method) is to use dialogMonitorOps to check when the dialog opens, and uiAccessor to close it if your script determines that it should be aborted

ZeBoxx2
03-18-2008, 06:53 PM
quick test script...


-- change this variable to set whether the file export dialog should be closed
doExport = false

callbacks.removescripts id:#exportTest
fn closeExportDialog = (
local _hwnd = dialogMonitorOps.getWindowHandle()
local _title = UIAccessor.getWindowText _hwnd
if (_title == "Select File to Export") then (
UIAccessor.closeDialog _hwnd
dialogMonitorOps.unregisterNotification id:#closeExportDialog
dialogMonitorOps.enabled = false
false
)
else ( true )
)

fn exportTest = (
if (not doExport) then (
dialogMonitorOps.enabled = true
dialogMonitorOps.registerNotification closeExportDialog id:#closeExportDialog
)
)

callbacks.addScript #preExport "exportTest()" id:#exportTest

Hobbs
03-18-2008, 06:55 PM
Awesome man....thanks for you help :)

ZeBoxx2
03-18-2008, 06:59 PM
alternatively you could use fileExport and export the file manually, but I'm presuming you're using the callback for a reason :) Good luck!

CGTalk Moderation
03-18-2008, 06:59 PM
This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.