Home Technical Talk

Maxscript filename into save field

polycounter lvl 6
Offline / Send Message
pointcache polycounter lvl 6
Hey guys i wrote some scripts that help to speed up exporting and i want one more addition.
--Fast save overwrite 2 step script
	--STEP 1 - export file with this script, it will store location of the file 
	--Filename should be equal to the name of the object

	
		if selection.count != 0 do
		(
			actionMan.executeAction 0 "40373"
			::path1 = sysInfo.currentdir + "//" + $.name
		)

you select object and press shift+ctrl+1 and you get straight to this window
a63c6879dc.png





now i want the name field of the export dialog to be already filled with object name. Im digging into it myself, but maybe someone already knows that. thank you guys.

Replies

  • haiddasalami
    Options
    Offline / Send Message
    haiddasalami polycounter lvl 14
    Use exportFile command.

    exportFile "Path" #noPrompt selectedOnly:true using:FBXEXP

    You can set the settings by loading class like
    pluginManager.loadClass FBXExporter
    FBXExporterSetParam "SmoothingGroups" true
    ....
    

    if you are deadset on using the UI, look into UIAccessor but seems redundant
  • pointcache
    Options
    Offline / Send Message
    pointcache polycounter lvl 6
    thanks i was considering that, but came up with simple solution,
    if selection.count != 0 do
    		(
    			local Clipboard = dotNetClass "Clipboard"
    			Clipboard.Clear()
    			Clipboard.SetText selection[1].name
    			
    			actionMan.executeAction 0 "40373"
    			::path1 = sysInfo.currentdir + "//" + $.name
    			
    		)
    

    i just have to press ctrl+v after window appears to paste object name
    i will probably make a macro with MacroGamer for that.
  • Swordslayer
    Options
    Offline / Send Message
    Swordslayer interpolator
    UIAccessor way isn't hard either:
    fn pasteSelName =
    (
        local hwnd = dialogMonitorOps.getWindowHandle()
    
        if UIAccessor.GetWindowText hwnd == "Select File to Export" then
        (
            for ctrl in (windows.getChildrenHWND hwnd)
                where ctrl[4] == "ComboBoxEx32" do UIAccessor.SetWindowText ctrl[1] selection[1].name
            true
        )
        else false
    )
    
    if selection.count != 0 do
    (
        dialogMonitorOps.enabled = true
        dialogMonitorOps.interactive = false
        dialogMonitorOps.registerNotification pasteSelName id:#export_name
        actionMan.executeAction 0 "40373"
        dialogMonitorOps.unRegisterNotification id:#export_name
        dialogMonitorOps.enabled = false
    
        ::path1 = sysInfo.currentdir + "//" + selection[1].name
    )
    
  • monster
    Options
    Offline / Send Message
    monster polycounter
    Maybe I' m not understanding something, but you just use the filename parameter of the save dialog.
    --Make the path
    fName = (sysInfo.currentdir + "/filename.fbx")
    
    --Update the path with a save dialog
    fName = getSaveFileName filename:fName
    
    --Export the file, if the user didn't press cancel
    if fName != undefined do exportFile fName #noPrompt selectedOnly:true
    
Sign In or Register to comment.