Message 1 of 10
How to open the subfolder What i Mistake
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
here i attached lisp code i want open the subfolder
(defun c:aus ( / projCode baseFolderPath projectFolderPath jaiFolderPath)
;; Prompt user for project code (numbers only)
(setq projCode (getstring "\nEnter project code (numbers only): "))
;; Check if the entered project code is not empty
(if (not (zerop (strlen projCode)))
(progn
;; Define the base folder path
(setq baseFolderPath "D:\\MUTHU\\")
;; Check if the base folder path exists
(if (not (vl-file-directory-p baseFolderPath))
(progn
(princ (strcat "\nBase folder path does not exist: " baseFolderPath))
(princ)
)
(progn
;; Define the path pattern to search for the project folder
(setq projectFolderPath (strcat baseFolderPath "*" projCode "*"))
;; Get the list of folders in the base directory
(setq folderList (vl-directory-files baseFolderPath "*.*" 1))
;; Find the project folder
(setq projectFolderFound nil)
(foreach folder folderList
(if (and (vl-string-search projCode folder)
(vl-file-directory-p (strcat baseFolderPath folder)))
(progn
(setq projectFolderPath (strcat baseFolderPath folder "\\"))
(setq projectFolderFound t)
)
)
)
;; If project folder is found, search for "JAI" subfolder
(if projectFolderFound
(progn
;; Check if the "JAI" folder exists
(setq jaiFolderPath (strcat projectFolderPath "JAI\\"))
(if (vl-file-directory-p jaiFolderPath)
(progn
(princ (strcat "\nOpening: " jaiFolderPath))
(startapp "explorer" jaiFolderPath)
)
(princ "\n'JAI' folder not found.")
)
)
(princ "\nProject folder not found.")
)
)
)
)
(princ "\nNo project code entered.")
)
(princ)
)