Visual LISP, AutoLISP and General Customization
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

how do i get to it?

1 REPLY 1
Reply
Message 1 of 2
Hidden_Brain
351 Views, 1 Reply

how do i get to it?

i have a simple lisp, which i plan to add to startup, so that based on 64bit or 32 bit OS, when users hit OPEN, it will default to a folder called PROJECTS in the user's desktop, which houses the shortcuts to all project folders in the network. here's what i have so far:

;;;BEGIN

(defun c:open()
(setq myname (getvar "loginname"))
(if (= (getenv "PROCESSOR_ARCHITECTURE") "x86")
(progn
(startapp "explorer" (strcat "C:\\users\\" myname "\\Desktop\\PROJECTS"))
)
(progn
(startapp "explorer" (strcat "C:\\Documents and Settings\\" myname "\\Desktop\\PROJECTS"))
(princ)
)
)
)

;;;;END

the problem is "explorer" opens an external window, and i cannot figure out how to make the open dialogue box default to the PROJECTS folder. if someone can point me in the right direction, i would really appreciate.

1 REPLY 1
Message 2 of 2
Kent1Cooper
in reply to: Hidden_Brain


@youngEIT wrote:

i have a simple lisp ... so that based on 64bit or 32 bit OS, when users hit OPEN, it will default to a folder called PROJECTS in the user's desktop

....

(defun c:open()
(setq myname (getvar "loginname"))
(if (= (getenv "PROCESSOR_ARCHITECTURE") "x86")
...(startapp "explorer" (strcat "C:\\users\\" myname \\Desktop\\PROJECTS))...
...(startapp "explorer" (strcat "C:\\Documents and Settings\\" myname \\Desktop\\PROJECTS))...
....

the problem is "explorer" opens an external window, and i cannot figure out how to make the open dialogue box default to the PROJECTS folder. ....


This is a job for the (getfiled) function, which spares you the need to get into another program outside AutoCAD.  Something like [untested]:

 

(defun c:open()
  (command "_.open"
    (getfiled
      "Select drawing:"
      (strcat
        "C:\\"
        (if (= (getenv "PROCESSOR_ARCHITECTURE") "x86")
          "users\\" ; then
          "Documents and Settings\\" ; else
        ); end if
        (getvar "loginname")
        "\\Desktop\\PROJECTS"
      ); end strcat
      "dwg"
      0
    ); end getfiled
  ); end command
); end defun
Kent Cooper, AIA

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk Design & Make Report

”Boost