PRINTING DOTS(.) TO A FILE

Discussion in 'AutoCAD' started by stephanie witkowski, Feb 28, 2004.

  1. I WANT TO PRINT STRINGS CONTAINING DOTS TO A FILE WITHOUT THE QUOTATION
    MARKS, BUT USING "READ" TO STRIP THE MARKS TRUNCATES THE STRING AT THE DOT
    ITSELF. I HAVE TRIED USING "WRITE-CHAR" AND "WRITE-LINE" BUT I ALWAYS GET
    UNWANTED BLANK LINES IN THE FILE EITHER BEFORE OR AFTER THE STRING. AN
    EXAMPLE OF THE STRING IS "W37.5". HOW CAN I COMBINE ALPHA AND NUMERIC DATA
    IN A STRING AND PRINT TO A FILE WITHOUT THE QUOTATION MARKS?
     
    stephanie witkowski, Feb 28, 2004
    #1
  2. stephanie witkowski

    bestafor Guest

    HiHo;
    This is from Cadalyst June 1997 tip 1336
    Rename to wro.lsp
    ......................................................................
    ;TIP1336.LSP: WRO.LSP Write Text to File (c)1997, David H. Wilde

    (defun c:wro ( ) ;; stands for "write out"
    (setvar "filedia" 1)
    (setq lspdir "c:\\ALISPPRGM\\") ;; set to directory of default txt file
    (setq txtfile (strcat lspdir "notes")) ;;default txt file
    (setq filenm (open (getfiled "Write out text file." txtfile "txt" 11) "a"))
    ;;dialogue box to pick file to create or append
    (setq txt (ssget)) ;;be sure to pick lines as you want them to appear in the
    txt file
    (setq n (sslength txt))
    (setq index 0)
    (repeat n
    (setq ln1 (ssname txt index))
    (setq index (+ index 1))
    (setq lname (entget ln1))
    (setq line (assoc 1 lname))
    (setq line1 (cdr line))
    (write-line line1 filenm)
    )
    (close filenm)
    );end wro.lsp
    .............................................................................
    ...................................................
    Change lspdir to a directory of your choice and txtfile to a file of your
    choice.
    I hope I understood your request correctly. I also interperted it as a
    request to
    locate the dot in a text string, if that is the case let me know as I have a
    program
    that will do that.
     
    bestafor, Feb 28, 2004
    #2
  3. stephanie witkowski

    bestafor Guest

    HiHo;
    This is from Cadalyst June 1997 tip 1336
    Rename to wro.lsp
    ......................................................................
    ;TIP1336.LSP: WRO.LSP Write Text to File (c)1997, David H. Wilde

    (defun c:wro ( ) ;; stands for "write out"
    (setvar "filedia" 1)
    (setq lspdir "c:\\ALISPPRGM\\") ;; set to directory of default txt file
    (setq txtfile (strcat lspdir "notes")) ;;default txt file
    (setq filenm (open (getfiled "Write out text file." txtfile "txt" 11) "a"))
    ;;dialogue box to pick file to create or append
    (setq txt (ssget)) ;;be sure to pick lines as you want them to appear in the
    txt file
    (setq n (sslength txt))
    (setq index 0)
    (repeat n
    (setq ln1 (ssname txt index))
    (setq index (+ index 1))
    (setq lname (entget ln1))
    (setq line (assoc 1 lname))
    (setq line1 (cdr line))
    (write-line line1 filenm)
    )
    (close filenm)
    );end wro.lsp
    .............................................................................
    ...................................................
    Change lspdir to a directory of your choice and txtfile to a file of your
    choice.
    I hope I understood your request correctly. I also interperted it as a
    request to
    locate the dot in a text string, if that is the case let me know as I have a
    program
    that will do that.
     
    bestafor, Feb 28, 2004
    #3
Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.