Script Question

Discussion in 'AutoCAD' started by KJK@Ogden, Jun 17, 2004.

  1. KJK@Ogden

    KJK@Ogden Guest

    I have a script file that is opening a long list of drawings and performing a couple of lisp routines on them. The problem I am having is that some of the files have spaces in the filename which causes the script to hang (e.g. "open c:\mydocuments\my file name.dwg").
    How can I solve this?
    Thanks
     
    KJK@Ogden, Jun 17, 2004
    #1
  2. KJK@Ogden

    ECCAD Guest

    The 'filename' to open (or save for that matter), has to have double-quotes around the path/filename.
    e.g. script:
    OPEN
    "C:\\mydocuments\\my file name"
    .......
    note the \\ (or can be just) /
    also, ditch the .dwg

    Bob
     
    ECCAD, Jun 17, 2004
    #2
  3. KJK@Ogden

    KJK@Ogden Guest

    Thanks Bob but it still hangs. It is having problems with the space between "my" and "file". So it returns "C:\\mydocuments\\my" is not found.
     
    KJK@Ogden, Jun 17, 2004
    #3
  4. KJK@Ogden

    Jason Wilder Guest

    If you're building your script via a LISP routine, then use something
    similar to the following for generating your file:

    (setq FNAME (strcat (chr 34) dwg (chr 34)))

    Otherwise, what Bob said is correct, you need to open the script file and
    make sure there are " " marks around the file path entirely.

    I had the same problem you had, I generate my SCR file with a LISP routine
    and the above method solved the issue for me.

    HTH

    Jason

    performing a couple of lisp routines on them. The problem I am having is
    that some of the files have spaces in the filename which causes the script
    to hang (e.g. "open c:\mydocuments\my file name.dwg").
     
    Jason Wilder, Jun 17, 2004
    #4
  5. KJK@Ogden

    ECCAD Guest

    If you are creating the script, do:
    (command "_open" "C:\\mydocuments\\my file name")
    You cannot do:
    "open c:\mydocuments\my file name.dwg"
    without the (command............).

    Bob
     
    ECCAD, Jun 17, 2004
    #5
  6. KJK@Ogden

    J. Logan Guest

    Bobs suggestion is correct.

    You might also be able to go to tools>options>files tab and set the
    directory for the drawings in the search path then just use quotes around
    the "filename" in the script. You wouldn't have to worry about
    "c:\mydocuments\my file". I have a specific folder that I use just for
    running scripts. I place the script file, any related lisp routines and the
    drawings into that folder which is set in the ACAD search path. That way I
    only have one folder to look for when things don't go right.

    On a secondary note, if you're creating this script files manually. Meaning
    your typing and copy pasting a whole bunch of drawing names,quotations,
    commands and user input for a whole bunch of drawings. You may want to think
    about getting a script generator (if you don't have one already). I've used
    script pro and Hurricane both of which fit the bill nicely.

    J. Logan

    performing a couple of lisp routines on them. The problem I am having is
    that some of the files have spaces in the filename which causes the script
    to hang (e.g. "open c:\mydocuments\my file name.dwg").
     
    J. Logan, Jun 17, 2004
    #6
  7. KJK@Ogden

    KJK@Ogden Guest

    Thanks Bob and Jason, it now works.

    What is strange, is that I manually put the quotes in my script to test it and it still would not work. I then used (chr 34) and recreated the script from lisp and then it did work. The files looked identical so I have no idea why one worked and the other did not.

    Again, thanks for the help!
     
    KJK@Ogden, Jun 17, 2004
    #7
  8. KJK@Ogden

    ECCAD Guest

    Pretty curious.
    all (chr 34) is doing is placing a " in the text..same as " on the keyboard. Hmm.

    Bob
     
    ECCAD, Jun 17, 2004
    #8
  9. KJK@Ogden

    ECCAD Guest

    Glad to be of help.

    Bob :)
     
    ECCAD, Jun 17, 2004
    #9
  10. good point, forget about paths and use the CADFX batch scripter or any scripter that does not shut down acad between
    files like Script Pro does. Should be named Script Slow because it wastes so much time!

    "J. Logan" <>
    |>Bobs suggestion is correct.
    |>
    |>You might also be able to go to tools>options>files tab and set the
    |>directory for the drawings in the search path then just use quotes around
    |>the "filename" in the script. You wouldn't have to worry about
    |>"c:\mydocuments\my file". I have a specific folder that I use just for
    |>running scripts. I place the script file, any related lisp routines and the
    |>drawings into that folder which is set in the ACAD search path. That way I
    |>only have one folder to look for when things don't go right.
    |>
    |>On a secondary note, if you're creating this script files manually. Meaning
    |>your typing and copy pasting a whole bunch of drawing names,quotations,
    |>commands and user input for a whole bunch of drawings. You may want to think
    |>about getting a script generator (if you don't have one already). I've used
    |>script pro and Hurricane both of which fit the bill nicely.
    |>
    |>J. Logan
    |>
    |>|>> I have a script file that is opening a long list of drawings and
    |>performing a couple of lisp routines on them. The problem I am having is
    |>that some of the files have spaces in the filename which causes the script
    |>to hang (e.g. "open c:\mydocuments\my file name.dwg").
    |>> How can I solve this?
    |>> Thanks
    |>

    James Maeding
    Civil Engineer/Programmer
     
    James Maeding, Jun 18, 2004
    #10
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.