Author Topic: Create project folders?  (Read 3700 times)

0 Members and 1 Guest are viewing this topic.

KewlToyZ

  • Guest
Create project folders?
« 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?

GDF

  • Water Moccasin
  • Posts: 2081
Re: Create project folders?
« Reply #1 on: July 27, 2009, 04:43:55 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?

Yes DosLib can do it.

Code: [Select]
(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))
Why is there never enough time to do it right, but always enough time to do it over?
BricsCAD 2020x64 Windows 10x64

T.Willey

  • Needs a day job
  • Posts: 5251
Re: Create project folders?
« Reply #2 on: July 27, 2009, 04:47:57 PM »
I don't really understand what you mean, but lisp can make directories.  vl-mkdir
Tim

I don't want to ' end-up ', I want to ' become '. - Me

Please think about donating if this post helped you.

gile

  • Gator
  • Posts: 2507
  • Marseille, France
Re: Create project folders?
« Reply #3 on: July 27, 2009, 05:00:29 PM »
Hi,

You can have a look to the `FilesystemObject' ActiveX.

Example to create a folder
Code: [Select]
(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:
Quote
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)
Speaking English as a French Frog

JohnK

  • Administrator
  • Seagull
  • Posts: 10646
Re: Create project folders?
« Reply #4 on: July 28, 2009, 08:45:41 AM »
without ARX (assuming you mean the VL functions).

Simplest way is the use the OS to create it.
Code: [Select]
(startapp
   (strcat
      "mkdir "
      <<YOUR FOLDER NAME>>
      ))

(startapp "mkdir c:\\TESTDIR")
TheSwamp.org (serving the CAD community since 2003)
Member location map - Add yourself

Donate to TheSwamp.org

KewlToyZ

  • Guest
Re: Create project folders?
« Reply #5 on: July 28, 2009, 09:05:09 AM »
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.
« Last Edit: July 28, 2009, 09:09:18 AM by KewlToyZ »

GDF

  • Water Moccasin
  • Posts: 2081
Re: Create project folders?
« Reply #6 on: July 28, 2009, 10:41:04 AM »
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
Why is there never enough time to do it right, but always enough time to do it over?
BricsCAD 2020x64 Windows 10x64

GDF

  • Water Moccasin
  • Posts: 2081
Re: Create project folders?
« Reply #7 on: July 28, 2009, 10:47:40 AM »
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
Why is there never enough time to do it right, but always enough time to do it over?
BricsCAD 2020x64 Windows 10x64

taner

  • Guest

KewlToyZ

  • Guest
Re: Create project folders?
« Reply #9 on: July 30, 2009, 08:59:58 AM »
Thanks again Gentlemen ;-)