Welcome,
Guest
. Please
login
or
register
.
1 Hour
1 Day
1 Week
1 Month
Forever
Login with username, password and session length
News:
Home
Help
Login
Register
TheSwamp
»
Code Red
»
AutoLISP (Vanilla / Visual)
»
Topic:
Problem with spaces in script file
« previous
next »
Print
Pages:
1
[
2
]
3
All
|
Go Down
Author
Topic: Problem with spaces in script file (Read 9009 times)
0 Members and 1 Guest are viewing this topic.
Kerry
Mesozoic relic
Seagull
Posts: 11654
class keyThumper<T>:ILazy<T>
Re: Problem with spaces in script file
«
Reply #15 on:
December 06, 2015, 01:35:35 AM »
What is the name of your drawing ?
and what are these values ?
Code - Auto/Visual Lisp:
[Select]
(
getvar
"DWGPREFIX"
)
(
getvar
"DWGNAME"
)
(
getvar
"CDATE"
)
«
Last Edit: December 06, 2015, 01:39:06 AM by Kerry
»
Logged
kdub, kdub_nz in other timelines.
Perfection is not optional.
Everything will work just as you expect it to, unless your expectations are incorrect.
Discipline: None at all.
danglar
Newt
Posts: 161
Read My Li(s)(p)
Re: Problem with spaces in script file
«
Reply #16 on:
December 06, 2015, 01:38:56 AM »
Drawing name is a variable. Only for example it can be "pump station.dwg" but can be something else
Logged
http://lispbox.wordpress.com
Kerry
Mesozoic relic
Seagull
Posts: 11654
class keyThumper<T>:ILazy<T>
Re: Problem with spaces in script file
«
Reply #17 on:
December 06, 2015, 01:42:31 AM »
Well what is the value of the variable ...
and these
Code - Auto/Visual Lisp:
[Select]
(
getvar
"DWGPREFIX"
)
(
getvar
"DWGNAME"
)
(
getvar
"CDATE"
)
AND
if the name is a variable, what is the actual code you are trying to evaluate ;
and the value of the variables you are using.
Logged
kdub, kdub_nz in other timelines.
Perfection is not optional.
Everything will work just as you expect it to, unless your expectations are incorrect.
Discipline: None at all.
Kerry
Mesozoic relic
Seagull
Posts: 11654
class keyThumper<T>:ILazy<T>
Re: Problem with spaces in script file
«
Reply #18 on:
December 06, 2015, 01:56:35 AM »
Which part isn't working ??
Just a idle query ; should the variable www have ".Dwg" appended ??
«
Last Edit: December 06, 2015, 02:01:17 AM by Kerry
»
Logged
kdub, kdub_nz in other timelines.
Perfection is not optional.
Everything will work just as you expect it to, unless your expectations are incorrect.
Discipline: None at all.
danglar
Newt
Posts: 161
Read My Li(s)(p)
Re: Problem with spaces in script file
«
Reply #19 on:
December 06, 2015, 02:44:49 AM »
Sorry for my misunderstanding, but I checked the program and my opinion is:
Two strings not working properly:
Code - Auto/Visual Lisp:
[Select]
(
write-line
"open "
www fil1
)
(
write-line
(
strcat
"(vl-file-delete "
(
vl-string-right-trim
"
\"
"
(
vl-prin1-to-string
str1
)
)
str3
".dwg
\"
)"
)
fil1
)
see attached lisp
Logged
http://lispbox.wordpress.com
Kerry
Mesozoic relic
Seagull
Posts: 11654
class keyThumper<T>:ILazy<T>
Re: Problem with spaces in script file
«
Reply #20 on:
December 06, 2015, 03:10:11 AM »
Do us both a favor ..
reduce your code to the minimum possible that can demonstrate the issue you have.
Logged
kdub, kdub_nz in other timelines.
Perfection is not optional.
Everything will work just as you expect it to, unless your expectations are incorrect.
Discipline: None at all.
danglar
Newt
Posts: 161
Read My Li(s)(p)
Re: Problem with spaces in script file
«
Reply #21 on:
December 06, 2015, 03:11:25 AM »
I'll try...
Logged
http://lispbox.wordpress.com
Kerry
Mesozoic relic
Seagull
Posts: 11654
class keyThumper<T>:ILazy<T>
Re: Problem with spaces in script file
«
Reply #22 on:
December 06, 2015, 03:29:58 AM »
Does this work for you ??
Logged
kdub, kdub_nz in other timelines.
Perfection is not optional.
Everything will work just as you expect it to, unless your expectations are incorrect.
Discipline: None at all.
Kerry
Mesozoic relic
Seagull
Posts: 11654
class keyThumper<T>:ILazy<T>
Re: Problem with spaces in script file
«
Reply #23 on:
December 06, 2015, 04:01:37 AM »
Going back through your code, the first thing your could do is add some error trapping.
Perhaps try something like this
Code - Auto/Visual Lisp:
[Select]
(
defun
myDefault
*
error
*
(
msg
)
(
while
(
<
0
(
getvar
'cmdactive
)
)
(
command
-
s
nil
)
)
(
setvar
'menuecho
1
)
(
cond
(
(
not
msg
)
)
(
(
member
(
strcase
msg t
)
'
(
"console break"
"function cancelled"
"quit / exit abort"
)
)
(
princ
"
\n
Function Cancelled."
)
)
(
(
princ
(
strcat
"
\n
Application Error: "
(
itoa
(
getvar
'errno
)
)
" :- "
msg
)
)
(
vl-bt
)
)
)
(
setvar
'errno
0
)
(
princ
)
)
Code - Auto/Visual Lisp:
[Select]
;;-----------
(
defun
*error*
(
msg
)
(
myDefault
*
error
*
msg
)
)
;;-----------
Logged
kdub, kdub_nz in other timelines.
Perfection is not optional.
Everything will work just as you expect it to, unless your expectations are incorrect.
Discipline: None at all.
danglar
Newt
Posts: 161
Read My Li(s)(p)
Re: Problem with spaces in script file
«
Reply #24 on:
December 06, 2015, 04:09:05 AM »
Error trapping - is a good idea!
I can add it to program.
About your previous replay..
It's took for me some time but I check it according to your notes and didn't find any errors if I use certain file name and path instead variables.
It seem to me very complicated and I don't now how to find a solution
Logged
http://lispbox.wordpress.com
Kerry
Mesozoic relic
Seagull
Posts: 11654
class keyThumper<T>:ILazy<T>
Re: Problem with spaces in script file
«
Reply #25 on:
December 06, 2015, 04:45:55 AM »
I'll ask the obvious question :
Why are you using a Script file to delete the previous file ?
Logged
kdub, kdub_nz in other timelines.
Perfection is not optional.
Everything will work just as you expect it to, unless your expectations are incorrect.
Discipline: None at all.
Kerry
Mesozoic relic
Seagull
Posts: 11654
class keyThumper<T>:ILazy<T>
Re: Problem with spaces in script file
«
Reply #26 on:
December 06, 2015, 04:54:08 AM »
Correct me is I'm incorrect.
You have a drawing open.
You save the drawing with a different name.
You open the new drawing.
You delete the original drawing.
Alternative:
Save current
SaveAs with a different name
Delete original.
Is this correct ?
Logged
kdub, kdub_nz in other timelines.
Perfection is not optional.
Everything will work just as you expect it to, unless your expectations are incorrect.
Discipline: None at all.
danglar
Newt
Posts: 161
Read My Li(s)(p)
Re: Problem with spaces in script file
«
Reply #27 on:
December 06, 2015, 05:12:06 AM »
Obviously you are correct, but with little additions in alternative way as you call it:
I don’t need to Save current drawing, because i use this program as a part of "cleaning" process
Save As with a different name
Open the new file
Delete original.
Logged
http://lispbox.wordpress.com
Kerry
Mesozoic relic
Seagull
Posts: 11654
class keyThumper<T>:ILazy<T>
Re: Problem with spaces in script file
«
Reply #28 on:
December 06, 2015, 05:30:55 AM »
Will this work for you.
It will leave the 'Original' in th Temp folder at the moment ... it can be deleted programmatically if you want.
Code - Auto/Visual Lisp:
[Select]
(
defun
c:doit
(
/
*error*
)
; TODO add local variables
;;-----------
(
defun
*error*
(
msg
)
(
myDefault
*
error
*
msg
)
)
;;-----------
(
vl-cmdf
"_qsave"
)
(
setq
dwgprefix
(
getvar
"dwgprefix"
)
dwgname
(
getvar
"dwgname"
)
filename
-
base
(
vl-filename-base
dwgname
)
tempprefix
(
getvar
"tempprefix"
)
thedate
(
rtos
(
getvar
"CDATE"
)
2
0
)
)
(
setq
OriginalFileName
(
strcat
dwgprefix dwgname
)
ArchiveFileName
(
strcat
tempprefix dwgname
)
newFileName
(
strcat
dwgprefix
"XREF-"
filename
-
base
"-TPZ-"
thedate
".Dwg"
)
)
(
if
(
findfile
newFileName
)
(
progn
(
alert
(
strcat
newFileName
" exists ... cancelling command"
)
)
(
exit
)
)
)
(
if
(
findfile
ArchiveFileName
)
(
progn
(
alert
(
strcat
ArchiveFileName
" exists ... cancelling command"
)
)
(
exit
)
)
)
;;--
(
vl-cmdf
"_Saveas"
"2013"
ArchiveFileName
)
(
vl-cmdf
"_Saveas"
"2013"
newFileName
)
(
vl-file-delete
OriginalFileName
)
;; (vl-file-delete ArchiveFileName) ;; if you really want to
(
princ
)
)
(
princ
)
(
defun
myDefault
*
error
*
(
msg
)
(
while
(
<
0
(
getvar
'cmdactive
)
)
(
command
-
s
nil
)
)
(
setvar
'menuecho
1
)
(
cond
(
(
not
msg
)
)
(
(
member
(
strcase
msg t
)
'
(
"console break"
"function cancelled"
"quit / exit abort"
)
)
(
princ
"
\n
Function Cancelled."
)
)
(
(
princ
(
strcat
"
\n
Application Error: "
(
itoa
(
getvar
'errno
)
)
" :- "
msg
)
)
(
vl-bt
)
)
)
(
setvar
'errno
0
)
(
princ
)
)
(
princ
)
modified:kdub
«
Last Edit: December 06, 2015, 05:53:19 AM by Kerry
»
Logged
kdub, kdub_nz in other timelines.
Perfection is not optional.
Everything will work just as you expect it to, unless your expectations are incorrect.
Discipline: None at all.
danglar
Newt
Posts: 161
Read My Li(s)(p)
Re: Problem with spaces in script file
«
Reply #29 on:
December 06, 2015, 05:34:16 AM »
looks nice , but what's about delete orriginal file and open new one?
Logged
http://lispbox.wordpress.com
Print
Pages:
1
[
2
]
3
All
|
Go Up
« previous
next »
TheSwamp
»
Code Red
»
AutoLISP (Vanilla / Visual)
»
Topic:
Problem with spaces in script file