clear the file contens

Discussion in 'AutoCAD' started by nalsur8, Feb 25, 2004.

  1. nalsur8

    nalsur8 Guest

    i make 1 dialog box to display all text contens from 1 file *.txt and i just
    create 1 button for clear the text in that file to become emty file,
    i no ideal how to make the code can yours tell me how to do
     
    nalsur8, Feb 25, 2004
    #1
  2. nalsur8

    Mark Propst Guest

    ;written by Mark Propst 2-24-04
    ;for nalsur8
    ;use with caution!!!
    (defun cleartextfile(filename / wfh)
    (if(setq filename(findfile filename))
    (progn
    (setq wfh(open filename "w"));open for write overwrites contents
    (if wfh (close wfh));don't write anything, just close- that saves
    file and is now blank
    (setq wfh nil)
    )
    )
    )
     
    Mark Propst, Feb 25, 2004
    #2
  3. nalsur8

    nalsur8 Guest

    file is empty but the list_box still have text
    when i click the button Clear
    when i run again for 2nd time the list_box is empty
     
    nalsur8, Feb 26, 2004
    #3
  4. nalsur8

    BillZ Guest

    nalsur8 ,
    To clear a list in a dialog box using a button.
    You need to put an action_tile in the lisp:
    (action_tile "button_key" "(mysubr)")

    Then, in the file before the lisp, define the function:
    (defun mysubr () ;clears dialog box.
    (start_list "list_1")
    (end_list)
    )
    Start_list will by default create a new list which will be blank if you don't add anything to it.

    HTH

    Bill


    Message was edited by: BillZ
     
    BillZ, Feb 26, 2004
    #4
  5. nalsur8

    nalsur8 Guest

    ok i get it thank you
     
    nalsur8, Feb 27, 2004
    #5
  6. nalsur8

    BillZ Guest

    You're welcome.

    Glad I could help.


    Bill
     
    BillZ, Feb 27, 2004
    #6
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.