Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 09/23/2026 in Posts

  1. You can give this a try: (defun filePicker (directory filename extension / appHandle des pickedFile pickedFiles shell tmp tmpopen tmpoutput line) ;; Multi-file FilePicker using PowerShell OpenFileDialog ;; Returns a list of selected full file paths. ;; Returns nil if Cancel is pressed. (cond ;; Create temporary .BAT file ((and (setq tmp (vl-filename-mktemp nil nil ".bat")) (setq des (open tmp "w")) (write-line (strcat "<# : chooser.bat\n" ":: launches a File... Open sort of file chooser\n" "@echo off\n" "setlocal\n" "for /f \"delims=\" %%I in ('powershell -noprofile \"iex (${%~f0} | out-string)\"') do (\n" " echo %%~I\n" ")\n" "goto :EOF\n" ": end Batch portion / begin PowerShell hybrid chimera #>\n" "Add-Type -AssemblyName System.Windows.Forms\n" "$f = New-Object System.Windows.Forms.OpenFileDialog\n" "$f.InitialDirectory = \"" directory "\"\n" "$f.FileName = \"" filename "\"\n" "$f.Filter = \"" (cond ((= "dwg" (strcase extension t)) "AutoCAD Drawing (*.dwg)|*.dwg") ((= "dxf" (strcase extension t)) "AutoCAD DXF (*.dxf)|*.dxf") (t "All Files (*.*)|*.*") ) "\"\n" "$f.FilterIndex = 1\n" "$f.DefaultExt = \"" extension "\"\n" "$f.Multiselect = $true\n" "$f.ShowHelp = $true\n" "if ($f.ShowDialog() -eq [System.Windows.Forms.DialogResult]::OK) {\n" " $f.FileNames | ForEach-Object { $_ }\n" "}" ) des ) ) (not (close des)) (setq tmpoutput (vl-filename-mktemp nil nil ".txt")) (setq shell (vla-getinterfaceobject (vlax-get-acad-object) "WScript.shell")) (setq appHandle (vl-catch-all-apply 'vlax-invoke (list shell 'Run (strcat "cmd /c " tmp " > " tmpoutput) 0 :vlax-false))) (vlax-release-object shell) (not (vl-catch-all-error-p appHandle)) (setq tmpopen (open tmpoutput "r")) (while (setq line (read-line tmpopen)) (if (/= line "") (setq pickedFiles (append pickedFiles (list line)) ) ) ) (close tmpopen) (setq pickedFile pickedFiles) ) ((setq pickedFile (getfiled "" (strcat directory filename) extension 0)) (setq pickedFile (list pickedFile)) ) ) (if (and tmp (setq tmp (findfile tmp))) (vl-file-delete tmp) ) (if (and tmpoutput (setq tmpoutput (findfile tmpoutput))) (vl-file-delete tmpoutput) ) pickedFile )
    2 points
  2. No worries. I simply fed your description into Claude. With a few more prompts or a couple of revisions it would have done all that you asked. Its crazy powerful especially in the hands off someone like yourself with advanced lisp coding knowledge and experience. Claude and similar are such a high level above the likes of Co-Pilot.
    1 point
×
×
  • Create New...