Author Topic: Newtorks and lisp?  (Read 2338 times)

0 Members and 1 Guest are viewing this topic.

SPDCad

  • Bull Frog
  • Posts: 453
Newtorks and lisp?
« on: March 17, 2006, 02:54:44 PM »
Is there a way thru lisp of knowing if your computer is part of a network or not?
I am writing a lisp where the data will be stored on a domain network, and the lisp will need to retrieve the data from it.
We have roaming profiles at work because we are not always at the same computer thru out the day. I want to be able to have my lisps find the data I need without hard path in the lisp.

Thanks in advance for the help
 :-D
AutoCAD 2010, w/ OpenDCL

visit: http://reachme.at/spd_designs

David Bethel

  • Swamp Rat
  • Posts: 656
Re: Newtorks and lisp?
« Reply #1 on: March 17, 2006, 03:02:41 PM »
You could probably do it using McNeel's DOS library.  It has some dos_dir calls that returns "" if nothing found and can do some elementary environmet checking.  -David
R12 Dos - A2K

ronjonp

  • Needs a day job
  • Posts: 7516
Re: Newtorks and lisp?
« Reply #2 on: March 17, 2006, 05:34:10 PM »
I think Jurg has a function for this....lemme see if I can find it.

this was the one I was thinking of:

Code: [Select]
;
; -- Function VxListNetworkDrives
; Returns a list of all mapped network drives with UNC path.
; Copyright:
;   2005 MENZI ENGINEERING GmbH, Switzerland
; Arguments [Type]:
;   --- =
; Return [Type]:
;   > List of mapped drives '(("X:" . "\\\\Server\\Xpath")...) [LIST]
; Notes:
;   - Requires ScrRun.dll (see also notes at top of page).
;
(defun VxListNetworkDrives ( / DrvCol ItmCnt RetVal WsnObj)
 (setq WsnObj (vlax-create-object "WScript.Network")
       DrvCol (vlax-invoke WsnObj 'EnumNetworkDrives)
       ItmCnt 0
 )
 (repeat (/ (vlax-invoke DrvCol 'Count) 2)
  (setq RetVal (cons
                (cons
                 (strcase (vla-Item DrvCol ItmCnt))
                 (vla-Item DrvCol (1+ ItmCnt))
                )
                RetVal
               )
        ItmCnt (+ ItmCnt 2)
  )
 )
 (vlax-release-object WsnObj)
 (reverse RetVal)
)
« Last Edit: March 17, 2006, 05:40:02 PM by ronjonp »

Windows 11 x64 - AutoCAD /C3D 2023

Custom Build PC