TheSwamp
Code Red => AutoLISP (Vanilla / Visual) => Topic started by: KewlToyZ on July 27, 2009, 03:15:22 PM
-
I am looking to create a project folder structure automatically.
I was wondering if this was possible from lisp without arx?
Would I need DosLib to do it?
-
I am looking to create a project folder structure automatically.
I was wondering if this was possible from lisp without arx?
Would I need DosLib to do it?
Yes DosLib can do it.
(defun ARCH:CustomSupportFolder (/ F_LST)
(setvar "cmdecho" 0)
(command "filedia" "0")
(setq F_LST (findfile "C:\\Arch_Custom\\Arch_Custom.ico"))
(cond
((= F_LST nil)
(progn
(ARCH:MsgBox2 " Arch Program : Info" 48 "
Arch Program Custom Support Folder
--------------------------------------------------------------------------------------------
Creating C:\\Arch_Custom Personal Folder..." 4)
(dos_copy
(strcat ARCH#CUSF "Workstation\\Arch_Custom")
"C:\\Arch_Custom")
(dos_copy
(strcat ARCH#CUSF "Workstation\\Arch_Custom\\*")
"C:\\Arch_Custom")
(dos_copy
(strcat ARCH#CUSF "Workstation\\Arch_Custom\\SaveFile")
"C:\\Arch_Custom")
(dos_copy
(strcat ARCH#CUSF "Workstation\\Arch_Custom\\Support")
"C:\\Arch_Custom")
(dos_copy
(strcat ARCH#CUSF "Workstation\\Arch_Custom\\Support\\*")
"C:\\Arch_Custom\\Support"))))
(command "filedia" "1")
(setvar "cmdecho" 1))
-
I don't really understand what you mean, but lisp can make directories. vl-mkdir
-
Hi,
You can have a look to the `FilesystemObject' ActiveX.
Example to create a folder
(defun CreateFolder (path / fso)
(setq fso (vlax-create-object "Scripting.FilesystemObject"))
(if (= (vlax-invoke-method fso 'FolderExists path) :vlax-false)
(vlax-invoke-method fso 'CreateFolder path)
(princ (strcat "\nThe folder \"" path "\" already exists."))
)
(vlax-release-object fso)
(gc)
)
A dump on an fso object:
IFileSystem3: FileSystemObject
; Valeurs de propriétés:
; Drives (RO) = #<VLA-OBJECT IDriveCollection 06da4f88>
; Méthodes prises en charge:
; BuildPath (2)
; CopyFile (3)
; CopyFolder (3)
; CreateFolder (1)
; CreateTextFile (3)
; DeleteFile (2)
; DeleteFolder (2)
; DriveExists (1)
; FileExists (1)
; FolderExists (1)
; GetAbsolutePathName (1)
; GetBaseName (1)
; GetDrive (1)
; GetDriveName (1)
; GetExtensionName (1)
; GetFile (1)
; GetFileName (1)
; GetFileVersion (1)
; GetFolder (1)
; GetParentFolderName (1)
; GetSpecialFolder (1)
; GetStandardStream (2)
; GetTempName ()
; MoveFile (2)
; MoveFolder (2)
; OpenTextFile (4)
-
without ARX (assuming you mean the VL functions).
Simplest way is the use the OS to create it.
(startapp
(strcat
"mkdir "
<<YOUR FOLDER NAME>>
))
(startapp "mkdir c:\\TESTDIR")
-
Most excellent help as always Gents!
I was looking at it and drawing a blank, thanks for pointing me in the right direction.
What had me stumbling is I could make bat files create directories and do xcopy, etc..
But how do I throw a directory structure into a current folder?
I think I would have to use the browse for folder and parse that selection result to a string then concatenate the string to my directory structure....
Hmmm ok I think it is getting clearer.
Let me see where I end up going with this.
I was looking to make project setups a little more robust.
-
Gile
(CreateFolder "C://TEST") <- works fine
(CreateFolder "C://TEST//one//") <--Automation Error. Description was not provided.
The "TEST" folder has to exist first.
(CreateFolder "C://TEST")(CreateFolder "C://TEST//one//") <---this works
-
Also using DosLib, you can create the folder structure and all files within it. Like from a server to your local drive.
C:\\
Arch_Custom folder
Support folder, plus routine files copied from the server
SaveFile folder
-
http://www.theswamp.org/index.php?topic=9441.msg121487#msg121487
-
Thanks again Gentlemen ;-)