string within string
CADForums.net Forum Index CADForums.net
Discussion of AutoCAD and other CAD software.
 
 FAQFAQ   MemberlistMemberlist     RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 
 
Google
 
Web cadforums.net
string within string

 
Post new topic   Reply to topic    CADForums.net Forum Index -> Customization
Author Message
Kiwi Russ
Guest





Posted: Mon Dec 20, 2004 11:18 am    Post subject: string within string Reply with quote

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

Back to top
Rob Taylor
Guest





Posted: Mon Dec 20, 2004 4:02 pm    Post subject: Re: string within string Reply with quote

use \"

(princ (strcat "(vlisp-compile 'st \"" lispname "\")"))
Back to top
Kiwi Russ
Guest





Posted: Tue Dec 21, 2004 12:34 pm    Post subject: Re: string within string Reply with quote

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





"Rob Taylor" <nospam@address.withheld> wrote in message
news:30228426.1103540602907.JavaMail.jive@jiveforum2.autodesk.com...
Quote:
use \"

(princ (strcat "(vlisp-compile 'st \"" lispname "\")"))


Back to top
Jeff Mishler
Guest





Posted: Tue Dec 21, 2004 12:51 pm    Post subject: Re: string within string Reply with quote

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
check out www.cadvault.com
"Kiwi Russ" <russell@pl.net> wrote in message news:41c7d21b_1@newsprd01...
Quote:
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





"Rob Taylor" <nospam@address.withheld> wrote in message
news:30228426.1103540602907.JavaMail.jive@jiveforum2.autodesk.com...
use \"

(princ (strcat "(vlisp-compile 'st \"" lispname "\")"))

Back to top
Kiwi Russ
Guest





Posted: Tue Dec 21, 2004 2:20 pm    Post subject: Re: string within string Reply with quote

Jeff
perfect that works!!!
many thanks
Russ



"Jeff Mishler" <jeff_m@cadvault.com> wrote in message
news:41c7d5ff$1_3@newsprd01...
Quote:
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
check out www.cadvault.com
"Kiwi Russ" <russell@pl.net> wrote in message news:41c7d21b_1@newsprd01...
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





"Rob Taylor" <nospam@address.withheld> wrote in message
news:30228426.1103540602907.JavaMail.jive@jiveforum2.autodesk.com...
use \"

(princ (strcat "(vlisp-compile 'st \"" lispname "\")"))



Back to top
Kiwi Russ
Guest





Posted: Tue Dec 21, 2004 2:38 pm    Post subject: Re: string within string Reply with quote

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
Back to top
Rob Taylor
Guest





Posted: Tue Dec 21, 2004 3:24 pm    Post subject: Re: string within string Reply with quote

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
Back to top
Marc'Antonio Alessi
Guest





Posted: Tue Dec 21, 2004 9:39 pm    Post subject: Re: string within string Reply with quote

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)
)
Back to top
Kiwi Russ
Guest





Posted: Wed Dec 22, 2004 1:52 pm    Post subject: Re: string within string Reply with quote

Thanks once again Rob! :-)
Russ

"Rob Taylor" <nospam@address.withheld> wrote in message
news:32132866.1103624694911.JavaMail.jive@jiveforum1.autodesk.com...
Quote:
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
Back to top
Kiwi Russ
Guest





Posted: Wed Dec 22, 2004 1:55 pm    Post subject: Re: string within string Reply with quote

Thanks Marc
thats an interesting mutiple compiler. getcfg and setcfg I am not familar
with - I must read up about it.
cheers Russ

"Marc'Antonio Alessi" <nospam maalessi at tin dot it> wrote in message
news:41c8532f_1@newsprd01...
Quote:
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)
)


Back to top
Rob Taylor
Guest





Posted: Wed Dec 22, 2004 5:19 pm    Post subject: Re: string within string Reply with quote

Your welcome Russ.

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

Merry Xmas All!

Aussie Rob ;)
Back to top
 
Post new topic   Reply to topic    CADForums.net Forum Index -> Customization All times are GMT
Page 1 of 1

 
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum




Windows Server DSP VoIP Electronics New Topics
Powered by phpBB