Function Syntax: ZEZW Version: 2 Date: 29.12.2025 AI+https://www.cadtutor.net/forum/topic/41748-zoom-extend-all-layouts/ AI+https://www.cadtutor.net/forum/topic/41748-zoom-extend-all-layouts/ Program name and intent ZEZW is an AutoLISP utility that opens a dialog to let the user select one or more PaperSpace layouts, then performs Zoom Extents or Zoom Window on the selected layouts after the dialog closes. How the user interacts with it • The user runs the command ZEZW (aliases: ZEZW and _ZEZW). • A dialog appears listing layouts (optionally including Model). • The user can filter the list using wildcard patterns * and ?, then multi-select layouts from the list. • The dialog provides action buttons to run ZE (Zoom Extents) or ZW (Zoom Window) on the selected layouts. • For ZW, the program prompts in the command line for two corners (first corner and opposite corner) to define the zoom window. Main functionalitiesLayout discovery: Collects layouts using layoutlist for reliability across environments.Filter and display: Applies user-entered wildcard filtering with wcmatch and refreshes the list dynamically.Multi-select list: Supports selecting multiple layouts at once (including Select All and Select None).Include or exclude Model: A toggle controls whether the MODEL tab is included in the selectable list.Copy to clipboard: Copies the selected layout names and their status (Layout or Model) to the clipboard, one per line, tab-separated.Zoom Extents on selected layouts: Switches CTAB through each selected layout (excluding Model by default) and runs Zoom Extents in PaperSpace.Zoom Window on selected layouts: Prompts for a window once, then applies the same window zoom to each selected layout in PaperSpace.Undo safety: Wraps multi-layout zoom operations inside StartUndoMark and EndUndoMark for cleaner undo behavior. Important behaviors and constraintsPaperSpace only: Before zooming, it sets MSpace to false so the zoom is executed in PaperSpace context (not inside a viewport).Dialog-driven workflow: Zoom operations are intentionally executed after the dialog closes to reduce instability and avoid UI command timing issues.Model handling: Even if Model is displayed, actual zoom loops use a helper to remove MODEL unless explicitly included and applicable, preventing unintended Model zoom operations.TILEMODE enforcement: If TILEMODE is 1, it is set to 0 to ensure layout tabs are active and PaperSpace layouts are accessible. Clipboard copy details • When the user clicks Copy to Clipboard, the program copies lines in the format: LayoutName [tab] Layout or Model, followed by a newline per entry. • Primary clipboard method uses an MSHTML object (htmlfile clipboardData). • Fallback method writes a temp file and uses PowerShell Set-Clipboard, then also attempts cmd with clip as an additional fallback. Zoom implementation specifics • Zoom Extents tries COM first: vla-ZoomExtents, then falls back to command call: _.ZOOM E if COM fails. • Zoom Window tries COM first: vla-ZoomWindow, then falls back to command call: .ZOOM _W with the two picked points if COM fails. • For Zoom Window, the corner selection is requested once and reused for all selected layouts, ensuring consistent framing across layouts. • If the user cancels point picking during Zoom Window, the routine prints a cancellation message and restores the previous tab. User-facing dialog controlsFilter edit box: wildcard filtering using * and ?.Apply: rebuilds the displayed list using the current filter and include-model setting.Include Model: toggles inclusion of MODEL in the list.Selected count: shows how many rows are currently selected.Select All and Select None: convenience multi-selection controls.Copy to Clipboard: copies selected rows to the clipboard and shows a small status message in the dialog.ZE (Zoom Extents) and ZW (Zoom Window): request the respective zoom action and close the dialog with a special return code so the zoom runs afterwards. Robustness and housekeepingTemporary DCL generation: Creates a temporary DCL file with vl-filename-mktemp and falls back to a TEMP or DWGPREFIX-based path if needed.Unique dialog name per run: Uses an incrementing unique id to avoid dialog name conflicts across repeated invocations.Cleanup: Unloads the dialog and deletes the temporary DCL file after the dialog closes, preventing residue files and locking issues.Error handling: Installs a custom error handler during execution to ensure cleanup runs even if an unexpected error occurs, while suppressing noise for normal cancel conditions.