[Closed] FilePreOpen FilePreMerge Filename
Dear scripters, please help me!
I need to detect somehow the (maxFilePath + maxFileName) of the file before opening or merging.
I need to check if the file is on a network before loading.
fn PreOpenfn=
(
print (maxFilePath + maxFileName)
)
fn PreMergefn=
(
print (maxFilePath + maxFileName)
)
callbacks.removeScripts #filePreOpen id:#PreFileOpen
callbacks.removeScripts #filePreMerge id:#PreFileMerge
callbacks.addscript #filePreOpen "PreOpenfn()" id:#PreFileOpen
callbacks.addScript #filePreMerge "PreMergefn()" id:#PreFileMerge
This code doesn’t help!
if file doesn’t exist it will not be loaded or merged.
you can use #filePreOpenProcess which tells the filename to be loaded, but there is no solution anyway to interrupt the loading or merging process.
if you want to check anything about a file before loading(merging) make your own loading interface.
I understand, I have made my own loading interface already, but is it possible to replace the default one by script? I need to replace both, from the menu and from drag and drop.
I am not sure if this time I understand what you need to do and so if this code will be helpful, but I am hopping I got it right.
(
global PreOpenProcess, PreMerge
fn PreOpenProcess = format "OPEN: %
" ((callbacks.notificationParam())[2])
fn PreMerge = format "MERGE: %
" sysInfo.currentdir
callbacks.removeScripts id:#ID_0X5DD9E10A0X2925901
callbacks.addscript #filePreOpenProcess "PreOpenProcess()" id:#ID_0X5DD9E10A0X2925901
callbacks.addScript #filePreMerge "PreMerge()" id:#ID_0X5DD9E10A0X2925901
)
Merge doesn’t work with Drag&Drop.
Thank you, Jorge and Denis.
So here is what I need to do:
I want to replace the way max opens files.
this is just a piece of code, in fact there is a lot more:
(
f = getOpenFileName caption: "Open File" filename: project_path types:"Max(*.max)"
if f!=undefined then
(
local _verify = false
_verify = loadMaxFile f useFileUnits:true quiet:true \
missingExtFilesAction:#logmsg missingExtFilesList:&missingExtFiles \
missingDLLsAction:#logmsg missingDLLsList:&missingDLLs \
missingXRefsAction:#logmsg missingXRefsList:&missingXRefs
if _verify==false then
(
(dotNetClass "System.IO.File").WriteAllLines (CMF) #(f, (1998 + (maxVersion())[1]/1000) as string)
)
else
(
redrawviews()
try(destroydialog ARConverting) catch()
if missingDLLs.count>0 do
(
clearplugins()
)
)
)
)
I would like to open max files in silent mode, verifying many things – network location, missing plugins etc.
I made this script and it’s working now smooth.
I just need now to replace the default opening/merging with mine.
I will try to play with your code, but I see I can’t use it to open in silent mode