Results 1 to 12 of 12

Thread: Read-Line comand not working

  1. #1
    mblangy Guest

    Read-Line comand not working

    I have identical lisp routines on two different machines - one works and the other does not. The READ-LINE command is returning nil where there is text...I am stumped.

  2. #2
    T.Willey Guest
    Is it finding the file on both machines?
    Maybe posting the code will help, and the locations of both text files per each computer.

    Tim

  3. #3
    mblangy Guest
    The source files are on the desktop in both cases. Excerpt from code:
    (setq sf (open "sec.mpr" "r"))
    (repeat 5 (read-line sf))
    (setq minx (substr (read-line sf) 26))
    It crashes when it gets to the substr command.

  4. #4
    T.Willey Guest
    From the computer that doesn't work do a
    (findfile "sec.mpr")
    and see what it returns.

    Tim

  5. #5
    mblangy Guest
    The file that it should be reading is on the desktop. I have many more of these files in other directories as I have been using this code without problem for some time now which is what really drives me crazy.

  6. #6
    T.Willey Guest
    Try hard coding the path to the desktop then, and see it that works. Only thing I can think of is that it's not finding the right file so there is nothing to read.

    Tim

  7. #7
    mblangy Guest
    This is like a bad dream. Here is the new code:
    (setq sf (open "C:\Documents and Settings\Administrator\Desktop\sec.mpr" "r"))
    (repeat 5 (read-line sf))
    (setq minx (substr (read-line sf) 26))

    Here are the contents of C:\Documents and Settings\Administrator\Desktop\sec.mpr:

    ---------------- REGIONS ----------------

    Area: 0.8421
    Perimeter: 11.9980
    Bounding box: X: 73.5967 -- 75.5087
    Y: 136.7406 -- 140.0526
    Centroid: X: 74.8405
    Y: 138.2646
    Moments of inertia: X: 16098.9422
    Y: 4716.7731
    Product of inertia: XY: 8713.8909
    Radii of gyration: X: 138.2678
    Y: 74.8419
    Principal moments and X-Y directions about centroid:
    I: 0.1220 along [0.2807 0.9598]
    J: 0.8014 along [-0.9598 0.2807]

    ??????????????????? Thanks anyhow.

  8. #8
    T.Willey Guest
    I cut/pasted what you had into a text file on my desktop, selected that file with getfiled. Your code seemed to work, but minx was set to "". Sorry can't duplicate your problem here.

    Tim

  9. #9
    mblangy Guest
    I modified the code to include all file extensions in file names and it seems to run fine now.

  10. #10
    mblangy Guest
    Thanks and happy holidays.

  11. #11
    T.Willey Guest
    I don't know what I did, but I'm glad you got it to work for you.

    Happy Holidays.
    Tim

  12. #12
    LUCAS Guest
    ;;You must waiting!!
    (defun WAIT (SECONDS / STOP)
    ;;
    ;; Posted by Tony Tanzillo
    ;; Creates a pause in your program flow
    ;; This function provides for much finer
    ;; increments in time then the command DELAY
    ;;
    (setq STOP (+ (getvar "DATE") (/ SECONDS 86400.0)))
    (while (> STOP (getvar "DATE"))
    (princ)
    )
    )
    (while (or (= (setq FILE (findfile "sec.mpr")) NIL)
    (progn (setq FIB (open FILE "r"))
    (setq NR (read-line FIB))
    (close FIB)
    (not NR)
    )
    )
    (WAIT 0.01)
    )

    "T.Willey" <nospam@address.withheld> ¦b¶l¥ó
    news:16313191.1103831260841.JavaMail.jive@jiveforu m1.autodesk.com ¤¤¼¶¼g...
    I don't know what I did, but I'm glad you got it to work for you.

    Happy Holidays.
    Tim

Similar Threads

  1. the need to read
    By in forum AutoCAD
    Replies: 11
    Last Post: 05-19-2005, 09:10 AM
  2. Read only???????
    By rodney.hoyt in forum Network
    Replies: 3
    Last Post: 11-24-2004, 06:13 PM
  3. Read only?????
    By rodney.hoyt in forum AutoCAD
    Replies: 2
    Last Post: 11-17-2004, 12:10 AM
  4. Replies: 2
    Last Post: 04-21-2004, 05:14 PM
  5. Replies: 2
    Last Post: 04-20-2004, 10:49 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other forums: Access Forum - Microsoft Office Forum - Exchange Server Forum