- ;;------------------------=={ Open }==------------------------;;
- ;; ;;
- ;; Uses the 'Open' method of the Shell Object to open the ;;
- ;; specified file or folder. ;;
- ;;------------------------------------------------------------;;
- ;; Author: Lee Mac, Copyright © 2011 - www.lee-mac.com ;;
- ;;------------------------------------------------------------;;
- ;; Arguments: ;;
- ;; target - file, folder or ShellSpecialFolderConstants enum ;;
- ;;------------------------------------------------------------;;
- ;; Returns: T if successful, else nil ;;
- ;;------------------------------------------------------------;;
- (defun LM:Open ( target / shell result )
- (if
- (and
- (or
- (eq 'INT (type target))
- (setq target (findfile target))
- )
- (setq shell (vla-getInterfaceObject (vlax-get-acad-object) "Shell.Application"))
- )
- (progn
- (setq result (vl-catch-all-apply 'vlax-invoke (list shell 'open target)))
- (vlax-release-object shell)
- (not (vl-catch-all-error-p result))
- )
- )
- )
- (vl-load-com)
- ;(LM:Open (getfiled "Select File to Open" "" "" 16))
- ;(LM:Open "C:\\My Folder\\File.dwg")
- ;(LM:Open "C:\\My Folder\\My SubFolder")
- ;(LM:Open 20)
|