Author Topic: stop dos shell flash?  (Read 2190 times)

0 Members and 1 Guest are viewing this topic.

andrew_nao

  • Guest
stop dos shell flash?
« on: January 28, 2008, 11:00:30 AM »
i have a lisp that makes a list of files in a directory using the shell command but the dos screen flashes and i would like to know if there is a way to stop it from flashing.


ronjonp

  • Needs a day job
  • Posts: 7529
Re: stop dos shell flash?
« Reply #1 on: January 28, 2008, 11:02:55 AM »
Don't use DOS....have a look at (vl-directory-files "c:/" "*.dwg") :-)

Windows 11 x64 - AutoCAD /C3D 2023

Custom Build PC

andrew_nao

  • Guest
Re: stop dos shell flash?
« Reply #2 on: January 28, 2008, 11:11:00 AM »
how can i use this to write the results to a txt file
in replace of using

(COMMAND "SHELL" "DIR H:\\*.DWG /b > h:\\blocks.TXT")

andrew_nao

  • Guest
Re: stop dos shell flash?
« Reply #3 on: January 28, 2008, 11:18:04 AM »
i figured it out

thanks for the help

ronjonp

  • Needs a day job
  • Posts: 7529
Re: stop dos shell flash?
« Reply #4 on: January 28, 2008, 11:19:39 AM »
Here is how I would do it:

Code: [Select]
(defun c:listfiles (/ files f)
  (if (setq files (vl-directory-files "c:\\" "*.dwg"))
    (progn
      (setq f (open "c:\\test.txt" "a"))
      (mapcar '(lambda (file)
(write-line file f)
       )
      files
      )
      (close f)
    )
  )
)

Windows 11 x64 - AutoCAD /C3D 2023

Custom Build PC

Dommy2Hotty

  • Swamp Rat
  • Posts: 1127
Re: stop dos shell flash?
« Reply #5 on: January 28, 2008, 03:27:07 PM »
i figured it out

thanks for the help

Can you post your solution for others to view?

GDF

  • Water Moccasin
  • Posts: 2081
Re: stop dos shell flash?
« Reply #6 on: January 28, 2008, 03:50:20 PM »
This is what I use

Code: [Select]
;;; quickie to write drawing file names from
;;; a folder to a user specified file.
;;; very little (read basically none) error checking.
;;; could be modified to work on sub folders also.
;;; modify as required to suite your needs.

(defun c:Dwgs2File  (/ folder dwgs target file)
  (setq folder (BrowseForFolder)) ; thanks for that, Tony T
  (if (and folder
           (setq dwgs (vl-directory-files folder "*.dwg" 1))
           ;;(setq target (getfiled " Select the Target file location" "dwgFiles" "txt" 1))           
           (setq target "C:\\Temp\\DwgFiles.txt")
           (setq file (open target "w")))
    (progn (write-line folder file)
           (foreach item dwgs (write-line (vl-filename-base item) file))
           (close file)))
  (startapp "notepad.exe" target)
  (princ))

    ; Tony Tanzillo
(defun BrowseForFolder  (/ sh folder folderobject result)
  (vl-load-com)
  (setq sh (vla-getInterfaceObject (vlax-get-acad-object) "Shell.Application"))
  (setq folder
         (vlax-invoke-method
           sh
           'BrowseForFolder
           0
           (strcat
             "Dwgs2File"
             " : Make a Drawing List\n\t\t   Please select a directory for getting a\n\t\t   list of all drawings in the directory.")
           0))
  (vlax-release-object sh)
  (if folder
    (progn (setq folderobject (vlax-get-property folder 'Self))
           (setq result (vlax-get-property FolderObject 'Path))
           (vlax-release-object folder)
           (vlax-release-object FolderObject)
           result)))
(princ)

Gary
« Last Edit: January 28, 2008, 03:53:43 PM by Gary Fowler »
Why is there never enough time to do it right, but always enough time to do it over?
BricsCAD 2020x64 Windows 10x64

andrew_nao

  • Guest
Re: stop dos shell flash?
« Reply #7 on: January 29, 2008, 02:47:51 PM »
i figured it out

thanks for the help

Can you post your solution for others to view?
sure this is what i did...
Code: [Select]
(IF (setq blkdir (vl-directory-files "h:/" "*.dwg"))

(if blkdir
(progn
  (setq dirname (open "h:\\blocks.txt" "w"))
  (foreach i blkdir
    (write-line i dirname)
  ) ;end foreach
  (close dirname)
)
) ;end progn
)