TheSwamp
Code Red => AutoLISP (Vanilla / Visual) => Topic started by: vinnyg on November 19, 2003, 10:09:24 AM
-
Is it possible to delete a file from any directory using lisp?
If so, how can this be accomplished?
I'm new at lisp, so any info regarding a procedure like this would
be helpful!
Thanks :roll:
-
Yep, you sure can
(vl-file-delete filename)
There will be many more post coming soon and I would really love to start something for you but I am in the middle of a project of my own so just hang in there.
-
How about this
(vl-load-com)
(if (setq fn (getfiled "Select File To Delete" "" "" 8))
(if (vl-file-delete fn)
(alert (strcat fn " Deleted..."))
)
(princ)
)
-
Vinny,
What version of Autocad are you running? The routine Mark posted will only run in 2000+.
-
Mark, if this runs on its own merit when pasting it on the command line, why in some situations you have to have (vl-load-com) at the start of the program to make it work :?:
-
If you have loaded a program that has (vl-load-com) in it, that will work for the whole ACAD session.
Looks like I'm in violation of the Daron Act.
let me go edit that post real quick before Daron see's it
-
So what you're telling me is I could possibly have Autocad load the (vl-load-com) automatically at the start of a new session
-
sure, do you a custom menu, put (vl-load-com) in your .mnl file. Or any other lisp that runs when ACAD opens.
-
So, have you figured out a way to make mutliple selections in a DCL file list box like such
: list_box {
key = "box_list";
fixed_width = true;
allow_accept=true;
alignment = centered;
width = 40;
I know how to get single selections but not multiple. Any ideas?
-
Or, is there a vl- comparible to getfiled that will let you select multiple files?
-
multiple_select = true-false;
Specifies whether multiple items in the list_box can be selected (highlighted) at the same time. Possible values are true or false (default: false). If true, multiple items can be selected at a time.
that should work in your DCL.
-
Damn, where the hell did you run across that. I have been looking and found nothing. You got a book or something? :o
Thats exactly what I was after. You are my hero!
-
<acad install>\Help\acad_dev.chm I have a shortcut to it in my Taxkbar.
see Programmable Dialog Box Reference
-
What do you mean, The Daron act?
-
>What do you mean, The Daron act?
heyheyhey....... you forgot!
see my wise a$$ response about 1/2 way down.
http://www.cadalog.com/phpbb2/viewtopic.php?t=15768&highlight=daron+act
-
Yup! I totally forgot. That's funny. You want to post that in Lagniappe under the heading of "By-laws of The Swamp"?
-
Yup! I totally forgot. That's funny. You want to post that in Lagniappe under the heading of "By-laws of The Swamp"?
Oh hell yea! maybe I'll remember next time. :shock:
-
About the multiple select:
One thing to be aware of is what the action_tile $value returns. On multiple_select=false; conditions the list_box will return a value of the quoted index (i.e. "0" or "3"). But when multiple_select=true; the returned value will be a single string that indicates which index's are selected delimited by a single space (i.e. "1 2 4 7").
-
I know this is the VLISP hackers forum, and everything goes better with lisp, but....
You can accomplish nearly the same thing with the OPEN dialog box. Just hightlight the files you want to trash and hit DEL.
-
Maybe it should be accomplished automatically? :)
As a last resort you can always shell out through AutoCAD and do it:
(command "SHELL" "Del C:\\hello.lsp")
or
(command "DEL" "C:\\hello.lsp") <-- also check out the pgp file for DOS commands