( source = "using System;\n" source += "using System.Runtime.InteropServices;\n" source += "using System.Text;\n" source += "class assembly\n" source += "{\n" source += " [DllImport(\"user32.dll\")]\n" source += " public static extern bool SetWindowPos(IntPtr hWnd, int hWndArg, int Left, int Top, int Width, int Height, int hWndFlags);\n" source += " [DllImport(\"user32.dll\")]\n" source += " static extern bool GetWindowRect(IntPtr hWnd, out RECT rect);\n" source += " public struct RECT\n" source += " {\n" source += " public int Left;\n" source += " public int Top;\n" source += " public int Right;\n" source += " public int Bottom;\n" source += " }\n" source += " public int[] getWindowRect(IntPtr hWnd)\n" source += " {\n" source += " RECT rect;\n" source += " if ( GetWindowRect(hWnd, out rect) )\n" source += " {\n" source += " return new int[] { rect.Left, rect.Top, rect.Right - rect.Left, rect.Bottom - rect.Top };\n" source += " }\n" source += " return null;\n" source += " }\n" source += "}\n" local csharpProvider = dotnetobject "Microsoft.CSharp.CSharpCodeProvider" local compilerParams = dotnetobject "System.CodeDom.Compiler.CompilerParameters" compilerParams.GenerateInMemory = on local compilerResults = csharpProvider.CompileAssemblyFromSource compilerParams #(source) global assembly = compilerResults.CompiledAssembly.createInstance "assembly" struct sceneinfo(_Width,_Height) fn ResizeViewport width height= ( ViewportHwnd = for w in (windows.getChildrenHWND #max) where w[4] == "ViewPanel" do exit with w[1] assembly.setwindowpos (dotNetObject "System.IntPtr" ViewportHwnd) 0 0 0 (width) (height) 0x0026 ForcecompleteRedraw() ) fn resizeimage tmpbitmap width height outpath= ( local tmptext = Bitmaptexture bitmap:tmpbitmap resizedbitmap = renderMap tmptext size:[width,height] filter:on resizedbitmap.filename = outpath save resizedbitmap resizedbitmap ) fn getUniqueFileName baseName ext = ( local index = 1 local fileName = baseName + "_01" + ext while doesFileExist fileName do ( index += 1 fileName = baseName + "_" + formattedPrint index format:"02d" + ext ) fileName ) fn CaptureScreenshot camera = ( local m_sceneinfo if makeDir (maxfilepath + "screenshots") then ( local baseName = (maxfilepath + "screenshots\\" + camera.name) local outputname = getUniqueFileName baseName ".jpg" local jpeg_io = jpegio jpeg_io.setQuality 100 local RendWith = renderWidth local RendHeight = renderHeight renderSceneDialog.close() renderWidth = 7680 renderHeight = 4320 renderSceneDialog.update() m_sceneinfo = sceneinfo _Width:(gw.getWinSizeX()) _Height:(gw.getWinSizeY()) ViewportButtonMgr.EnableButtons = off if viewport.numViews>1 do max tool maximize displaySafeFrames = true viewport.setGridVisibility #all false ResizeViewport 7680 4320 local TmpImage = gw.getViewportDib() TmpImage.filename = outputname save TmpImage local FinalImage = resizeimage TmpImage 7680 4320 outputname FinalImage.filename = outputname save FinalImage ResizeViewport m_sceneinfo._Width m_sceneinfo._Height ViewportButtonMgr.EnableButtons = on renderWidth = RendWith renderHeight = RendHeight renderSceneDialog.update() redrawViews() ) else (messageBox "Please save your file to create the destination folder" beep:off) ) fn Restore3dsMaxWindow = ( MainHwnd = windows.getmaxhwnd() windows.sendMessage MainHwnd 0x0112 0xF020 0 -- 0x0112 is WM_SYSCOMMAND, 0xF020 is SC_MINIMIZE windows.sendMessage MainHwnd 0x0112 0xF030 0 -- 0xF030 is SC_MAXIMIZE ) Restore3dsMaxWindow() local camera_array = cameras as array local camera_array_notarg = for i in camera_array where classof i != targetObject collect i for i = 1 to camera_array_notarg.count do ( viewport.setCamera camera_array_notarg[i] CaptureScreenshot camera_array_notarg[i] ) )