string within string

Discussion in 'AutoCAD' started by Kiwi Russ, Dec 20, 2004.

  1. Kiwi Russ

    Kiwi Russ Guest

    Hi
    I'm trying to write a few lines of code to make a fas file. The problem
    is the names lisp must have quotation marks around it. How would I insert
    these so that it can then inserted onto the command line?
    Thanks Russ


    (defun C:makefas( / lispname)
    (setq lispname (getstring "\nName of lisp : "))
    (setq lispname (strcat lispname ".lsp"))
    (princ (strcat "(vlisp-compile 'st " lispname ")"))
    (princ)
    );defun
     
    Kiwi Russ, Dec 20, 2004
    #1
    1. Advertisements

  2. Kiwi Russ

    Rob Taylor Guest

    use \"

    (princ (strcat "(vlisp-compile 'st \"" lispname "\")"))
     
    Rob Taylor, Dec 20, 2004
    #2
    1. Advertisements

  3. Kiwi Russ

    Kiwi Russ Guest

    Thanks Rob that did that trick.
    However I have another problem my lisp prints the correct notation in the
    command line but does not want to make a fas file, and I'm not sure why? Any
    ideas anyone?
    thanks Russ
    This is what I have so far.......

    (defun C:makefas( / lispname)
    (setq lispname (getstring "\nName of lisp : "))
    (setq lispname (strcat lispname ".lsp"))
    (princ (strcat "Command:(vlisp-compile 'st \"" lispname "\")"))
    (princ)
    );defun
     
    Kiwi Russ, Dec 21, 2004
    #3
  4. Kiwi Russ

    Jeff Mishler Guest

    Check what you are having it do.....as it is, you are only printing to the
    command line a string that looks like the result you want....but this works,
    providing the lisp is in the support path.

    (defun C:makefas( / lispname)
    (setq lispname (getstring "\nName of lisp : "))
    (setq lispname (strcat lispname ".lsp"))
    (vlisp-compile 'st lispname )
    (princ)
    );defun
     
    Jeff Mishler, Dec 21, 2004
    #4
  5. Kiwi Russ

    Kiwi Russ Guest

    Jeff
    perfect that works!!!
    many thanks
    Russ



     
    Kiwi Russ, Dec 21, 2004
    #5
  6. Kiwi Russ

    Kiwi Russ Guest

    One last question anyone :

    If the lisp does not lie in the support path then I get an error message.
    How would I add some code to turn the below message into an alert box
    message?

    ; *** ERROR Cannot find file test.lsp

    thanks
     
    Kiwi Russ, Dec 21, 2004
    #6
  7. Kiwi Russ

    Rob Taylor Guest

    use the findfile function like this

    (defun C:makefas( / ); lispname)
    (setq lispname (getstring "\nName of lisp : "))
    (if (findfile (strcat lispname ".lsp"))
    (vlisp-compile 'st lispname )
    (alert (strcat lispname " Not Found.."))
    )
    (princ)
    );defun
     
    Rob Taylor, Dec 21, 2004
    #7
  8. I use this, there are some problems switching the
    Vlide and AutoCAD window, maybe somebody can
    help me and you.


    Cheers.


    ; Marc'Antonio Alessi - http://xoomer.virgilio.it/alessi
    ; Function: C:ALE_LispComp
    ;
    ; Note: require DOSLIB
    ;
    ; Description: compile a list of selected files
    ;
    ; Arguments: none
    ;
    ; modify these to your own use:
    ;
    ; (getcfg "AppData/Custom/LispSorg")
    ; (setcfg "AppData/Custom/LispSorg")
    ;
    (defun C:ALE_LispComp ( / CfgPat FilLst FilPat)
    (if
    (or
    (= "" (setq CfgPat (getcfg "AppData/Custom/LispSorg")))
    (null CfgPat)
    (null (vl-file-directory-p CfgPat))
    )
    (setcfg "AppData/Asso/LispSorg" (setq CfgPat (dos_pwdir)))
    )
    (if
    (setq FilLst
    (dos_getfilem
    "Files to compile" CfgPat
    "Lisp files (*.lsp;*.fas)|*.lsp;*.fas|All Files (*.*)|*.*"
    ); I use this filter to see the last compiled FAS
    )
    (progn
    (C:VLISP)
    (setq FilPat (car FilLst) FilLst (cdr FilLst))
    (or
    (= CfgPat FilPat)
    (setcfg "AppData/Custom/LispSorg" FilPat)
    )
    (foreach file FilLst
    (vlisp-compile 'st (strcat FilPat file))
    )
    )
    )
    (princ)
    )
     
    Marc'Antonio Alessi, Dec 21, 2004
    #8
  9. Kiwi Russ

    Kiwi Russ Guest

    Thanks once again Rob! :)
    Russ
     
    Kiwi Russ, Dec 22, 2004
    #9
  10. Kiwi Russ

    Kiwi Russ Guest

    Thanks Marc
    thats an interesting mutiple compiler. getcfg and setcfg I am not familar
    with - I must read up about it.
    cheers Russ
     
    Kiwi Russ, Dec 22, 2004
    #10
  11. Kiwi Russ

    Rob Taylor Guest

    Your welcome Russ.

    I find these forums very useful
    and now I have a makefas routine
    aswell :)

    Merry Xmas All!

    Aussie Rob ;)
     
    Rob Taylor, Dec 22, 2004
    #11
    1. Advertisements

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.