Author Topic: Suppot file search path(s) disappeared without reasons  (Read 5613 times)

0 Members and 1 Guest are viewing this topic.

MeasureUp

  • Bull Frog
  • Posts: 462
Suppot file search path(s) disappeared without reasons
« on: June 27, 2013, 08:16:40 PM »
I noticed that the support file search path(s) to my USB disappeared automatically on daily basis.
I don't want to call the IT guys if I don't have to, as they all think they are the only ones in charge in the company.
Anything that I can do on my side?
Thanks for your help.

BlackBox

  • King Gator
  • Posts: 3770
Re: Suppot file search path(s) disappeared without reasons
« Reply #1 on: June 27, 2013, 08:31:31 PM »
Am I understanding you correctly, that you have files/folders on your USB drive that are being deleted on a daily basis when you connect it to your work computer/network?
"How we think determines what we do, and what we do determines what we get."

MeasureUp

  • Bull Frog
  • Posts: 462
Re: Suppot file search path(s) disappeared without reasons
« Reply #2 on: June 27, 2013, 08:41:09 PM »
Am I understanding you correctly, that you have files/folders on your USB drive that are being deleted on a daily basis when you connect it to your work computer/network?
No. The files/folders on my USB drive haven't lost and the only the paths to the USB disappeared in the "Options".
As the result, all routines resided on my USB are not functioning.

BlackBox

  • King Gator
  • Posts: 3770
Re: Suppot file search path(s) disappeared without reasons
« Reply #3 on: June 27, 2013, 09:13:04 PM »
Am I understanding you correctly, that you have files/folders on your USB drive that are being deleted on a daily basis when you connect it to your work computer/network?
No. The files/folders on my USB drive haven't lost and the only the paths to the USB disappeared in the "Options".
As the result, all routines resided on my USB are not functioning.

Sounds like your company restores the SFSP to your 'default', perhaps via Acad.lsp... So each time you start a session, the SFSP is restored to original. This could also be done via user login per Windows, via Registry.

In either case, you'd need to modify the path(s) at the appropriate time, with your own 'additions'.

HTH
"How we think determines what we do, and what we do determines what we get."

MeasureUp

  • Bull Frog
  • Posts: 462
Re: Suppot file search path(s) disappeared without reasons
« Reply #4 on: June 27, 2013, 09:50:24 PM »
Thank you.
I've checked all acad.lsp and acaddoc.lsp in my pc and found nothing related to the SFSP.
Perhaps those IT guys did something the registry, as you said.
This is just very frustrated.
Is there anyway to autoload the preset SFSP or the only portion of the paths to my USB by lisp?

andrew_nao

  • Guest
Re: Suppot file search path(s) disappeared without reasons
« Reply #5 on: July 01, 2013, 09:05:27 AM »
Is there anyway to autoload the preset SFSP or the only portion of the paths to my USB by lisp?


Code: [Select]
;;lee macs code
(defun _SFSP+ ( lst / str )
    (setenv "ACAD"
        (strcat (setq str (vl-string-right-trim ";" (getenv "ACAD"))) ";"
            (apply 'strcat
                (mapcar (function (lambda ( x ) (strcat x ";")))
                    (vl-remove-if
                        (function
                            (lambda ( x )
                                (or (vl-string-search (strcase x) (strcase str))
                                    (not (findfile x))
                                )
                            )
                        )
                        (mapcar
                            (function
                                (lambda ( x )
                                    (vl-string-right-trim "\\" (vl-string-translate "/" "\\" x))
                                )
                            )
                            lst
                        )
                    )
                )
            )
        )
    )
)

useage:
(_sfsp+ '("F:\\ACAD"
  "F:\\ACAD\\acad2014"
  "F:\\ACAD\\acad2014\\lisp"
  "F:\\ACAD\\acad2014\\menu"
  "F:\\ACAD\\acad2014\\menu\\bmp"
  "F:\\ACAD\\acad2014\\dcl"
  "F:\\ACAD\\acad2014\\scripts"
  "F:\\ACAD\\acad2014\\templates"
  "F:\\ACAD\\acad2014\\hatch pats"
  "F:\\ACAD\\BLOCKS"
  "F:\\ACAD ARCHIVE"
)
)

BlackBox

  • King Gator
  • Posts: 3770
Re: Suppot file search path(s) disappeared without reasons
« Reply #6 on: July 01, 2013, 12:24:32 PM »
FWIW... This allows for a user to navigate graphically to the desired directory before adding to SFSP (linky):

Quote from: BlackBox, at CADTutor
This seemed relevant:

Code: [Select]
(defun c:SFSP+  (/ *error*)
  (vl-load-com)

  (defun *error*  (msg)
    (if oShell
      (setq oShell (vlax-release-object oShell)))
    (cond ((not msg))                                                   ; Normal exit
          ((member msg '("Function cancelled" "quit / exit abort")))    ; <esc> or (quit)
          ((princ (strcat "\n** Error: " msg " ** "))))                 ; Fatal error, display it
    (princ))

  ((lambda (acApp / oShell oFolder acDoc acFiles path oldPath)
     (if
       (and
         (setq oShell
                (vlax-get-or-create-object "Shell.Application"))
         (setq oFolder
                (vlax-invoke
                  oShell 'BrowseForFolder (vla-get-hwnd acApp)
                  "Select a folder to add to SFSP:" 0)))
        (if
            (not
              (vl-string-search
                (strcase
                  (setq path
                         (strcat
                           (vlax-get-property
                             (vlax-get-property oFolder 'Self)
                             'Path)
                           ";")))
                (strcase
                  (setq oldPath
                         (strcat
                           (vl-string-right-trim
                             ";"
                             (vla-get-supportpath
                               (setq acFiles
                                      (vla-get-files
                                        (vla-get-preferences
                                          acApp)))))
                           ";")))))
         
             (progn
               (vla-put-supportpath acFiles (strcat oldPath ";" path))
               (*error* nil))
             (*error* "Path already exists in SFSP"))
        (cond
          (oShell (*error* nil))
          ((*error* "Unable to create Shell.Application Object")))))
    (vlax-get-acad-object)))



Also worthy of note, are Irne's comments here, regarding length of ACAD Environment Variable string, Registry, etc.
"How we think determines what we do, and what we do determines what we get."

Jeff H

  • Needs a day job
  • Posts: 6150
Re: Suppot file search path(s) disappeared without reasons
« Reply #7 on: July 01, 2013, 12:59:46 PM »
I have external hard drive that I change the drive letter to match server at work I plug into my laptop that matches folder structure at work.
 
If you ever start AutoCAD and the USB is not plugged in and it cannot find the paths it will remove them, at least that has been my experience.

BlackBox

  • King Gator
  • Posts: 3770
Re: Suppot file search path(s) disappeared without reasons
« Reply #8 on: July 02, 2013, 11:13:57 AM »
I have external hard drive that I change the drive letter to match server at work I plug into my laptop that matches folder structure at work.
 
If you ever start AutoCAD and the USB is not plugged in and it cannot find the paths it will remove them, at least that has been my experience.

I've seen this too, when I used to emply DOS SUBST for local folder in place of network folders, which is one of the things I do not miss now that I use Offline Files.
"How we think determines what we do, and what we do determines what we get."

NOT SURE

  • Guest
Re: Suppot file search path(s) disappeared without reasons
« Reply #9 on: July 02, 2013, 12:17:43 PM »
I use this when I forget to plug my Ext HD in before I open AutoCad (it's just quick and dirty but it works):

Code: [Select]
(defun c:Y_Paths2 ()
(vl-load-com)
(vl-vbaload "Y:\\Support\\Apps\\VBA\\Y_DirPaths2.dvb")
(vl-vbarun "Y_SupportPath2")
(vl-vbarun "Y_AutosavePath2")
(vl-vbarun "Y_TemplatePath2")
(command "menuload" "y:\\Support\\Menu\\Cad_STD.mnc")
)
Code: [Select]
Sub Y_SupportPath2()
   
    Dim preferences As AcadPreferences
    Dim currSupportPath As String
    Dim newSupportPath As String
   
    Set preferences = ThisDrawing.Application.preferences
    currSupportPath = preferences.Files.SupportPath
    newSupportPath = currSupportPath + ";Y:\Support\Startup;Y:\Support\Apps;Y:\Support\Blocks;Y:\Support\Menu;Y:\Support\Apps\Testing"
    preferences.Files.SupportPath = newSupportPath
End Sub

Sub Y_AutosavePath2()
    Dim preferences As AcadPreferences
    Dim currAutoSavePath As String
    Dim newAutoSavePath As String
   
    Set preferences = ThisDrawing.Application.preferences
    newAutoSavePath = "Y:\Support\AutoSave"
    preferences.Files.AutoSavePath = newAutoSavePath
End Sub

Sub Y_TemplatePath2()
    Dim preferences As AcadPreferences
    Dim currTemplateDWGPath As String
    Dim newTemplateDWGPath As String
   
    Set preferences = ThisDrawing.Application.preferences
    newTemplateDWGPath = "Y:\Support\Dwg_Templates"
    preferences.Files.TemplateDwgPath = newTemplateDWGPath

End Sub

CADDOG

  • Newt
  • Posts: 82
  • wishbonesr
Re: Suppot file search path(s) disappeared without reasons
« Reply #10 on: July 02, 2013, 04:16:03 PM »
From jtbworld.com, get the suite of path tools.  Really, for your task, you only need AddSupportPaths.

soo.... you could put all in the acaddoc.lsp or mod acaddoc.lsp to call your new lisp file that would contain the like of...

Code: [Select]
...
<function definition for AddSupportPaths from JTB World>
...

(setq paths2Add '("E:\\Support\\Path1"
  "E:\\Support\\Path2"
  "E:\\Support\\Path3"))

(mapcar 'AddSupportPaths (vl-remove-if-not 'findfile paths2Add))

And of course your new lisp will be in one of the default search paths.

MeasureUp

  • Bull Frog
  • Posts: 462
Re: Suppot file search path(s) disappeared without reasons
« Reply #11 on: July 02, 2013, 07:34:40 PM »
Many thanks to everyone. I will learn from you.

I have done some simple list functions for the other codes but I am not familiar to it.
How can I insert the "S:\\" (the USB path) to the SFSP as the 2nd item in the list?

CADDOG

  • Newt
  • Posts: 82
  • wishbonesr
Re: Suppot file search path(s) disappeared without reasons
« Reply #12 on: July 02, 2013, 10:57:34 PM »
How can I insert the "S:\\" (the USB path) to the SFSP as the 2nd item in the list?

For your request that can be added to your startup method of choice (ex. acaddoc.lsp)

Look at the last function call.  That is the one that needs to be changed to suite your needs.
(putsupportpath "S:\\" 1)
It says position 1, but it is an index position, like an array.  So index 1 is actually 2, where index 0 is 1, etc.

Code: [Select]
(vl-load-com)

;;function to accept a deliminated string <str> and the deliminator <delim>, and return a list of strings
(defun vl:string->list (str delim / lst loc)
  (while (setq loc (vl-string-search delim str))
    (setq lst (append lst (list (substr str 1 loc)))
  str (substr str (1+ (+ loc (strlen delim)))))
    )
  (append lst (list str))
  )

;;function to accept a list of strings <ls> and return a string deliminated by a deliminator <delim>
(defun vl:list->string (delim ls / out)
  (setq out (apply 'strcat (mapcar (function (lambda (x) (strcat x delim))) ls)))
  (if out (vl-string-right-trim delim out))
  )

;;function to add a list item <newitem> to an existing list <alist> at <position>
(defun vl:nth-add (newitem alist position / i p)
  (setq i -1 p -1)
  (append (vl-remove-if (function (lambda (x) (<= position (setq p (1+ p))))) alist)
  (list newitem)
  (vl-remove-if (function (lambda (x) (> position (setq i (1+ i))))) alist)
  )
  )

;;function to return support paths as a list of strings
(defun getSupportPaths (/  )
  (vl:string->list (vla-get-supportpath (vla-get-files (vla-get-preferences (vlax-get-acad-object)))) ";")
  )

;;function to accept a list of support path strings, and apply them to the search path preferences
(defun setSupportPaths (pathlst /)
  (vla-put-supportpath
    (vla-get-files (vla-get-preferences (vlax-get-acad-object)))
    (vl:list->string ";" pathlst)
    )
  )

;;main wrapper function to accept a path and desired hierachal location in the search path list.
;;if pathing already exists, then it will be relocated to new location.
(defun putSupportpath (newPath loc / paths)
 ;remove if found, so we can place in location where it needs to be
  (setq paths (vl-remove (strcase newPath) (mapcar 'strcase (getsupportpaths))))
  (setSupportPaths (vl:nth-add newPath paths loc))
  )


;;call the main wrapper with required vars
;;function: putsupportpath <pathing> <index location>
(putsupportpath "S:\\" 1)
(princ)
« Last Edit: July 03, 2013, 04:02:48 AM by CADDOG »

BlackBox

  • King Gator
  • Posts: 3770
Re: Suppot file search path(s) disappeared without reasons
« Reply #13 on: July 02, 2013, 11:31:08 PM »
How can I insert the "S:\\" (the USB path) to the SFSP as the 2nd item in the list?

You can use something like this:

Why don't you just pass the string returned by each 'Read-Line' call, to a parser sub-function, which returns a list of sub-strings:

Code - Auto/Visual Lisp: [Select]
  1.  
  2. (defun BBOX:Parser  (char string / i segments segment)
  3.   ;; BlackBox, TheSwamp.org
  4.   ;; Example: (BBOX:Parser "-" "dd-mm-yyyy")
  5.   ;; Returns: ("dd" "mm" "yyyy")
  6.   (while (setq i (vl-string-search char string))
  7.     (setq segments (cons (setq segment (substr string 1 i)) segments))
  8.     (setq string (substr string (+ 2 i)))
  9.   )
  10.   (reverse (cons string segments))
  11. )
  12.  

<snip>

... To break the string value into a list of strings (BBOX:Parser ";" <SFSP>), substitute, or reorder, or append as needed, and simply reassemble.
"How we think determines what we do, and what we do determines what we get."

CADDOG

  • Newt
  • Posts: 82
  • wishbonesr
Re: Suppot file search path(s) disappeared without reasons
« Reply #14 on: July 03, 2013, 03:54:25 AM »
... To break the string value into a list of strings (BBOX:Parser ";" <SFSP>), substitute, or reorder, or append as needed, and simply reassemble.

I'll comment code to explain what's going on.  <poke>