Author Topic: Search path...  (Read 12618 times)

0 Members and 2 Guests are viewing this topic.

MP

  • Seagull
  • Posts: 17750
  • Have thousands of dwgs to process? Contact me.
Re: Search path...
« Reply #30 on: July 24, 2013, 11:45:22 AM »
Glad that's settled. Wanna go get some coffee?

beer sounds more better
Engineering Technologist • CAD Automation Practitioner
Automation ▸ Design ▸ Drafting ▸ Document Control ▸ Client
cadanalyst@gmail.comhttp://cadanalyst.slack.comhttp://linkedin.com/in/cadanalyst

JohnK

  • Administrator
  • Seagull
  • Posts: 10634
Re: Search path...
« Reply #31 on: July 24, 2013, 11:48:12 AM »
beer sounds more better

I'm on the clock but what-the-hell, I have some vacation hours left. You buy the first round and I'll be there in a few.
TheSwamp.org (serving the CAD community since 2003)
Member location map - Add yourself

Donate to TheSwamp.org

MP

  • Seagull
  • Posts: 17750
  • Have thousands of dwgs to process? Contact me.
Re: Search path...
« Reply #32 on: July 24, 2013, 11:49:53 AM »
You buy the first round and I'll be there in a few.

Right. Drinking by myself again, fml.
Engineering Technologist • CAD Automation Practitioner
Automation ▸ Design ▸ Drafting ▸ Document Control ▸ Client
cadanalyst@gmail.comhttp://cadanalyst.slack.comhttp://linkedin.com/in/cadanalyst

JohnK

  • Administrator
  • Seagull
  • Posts: 10634
Re: Search path...
« Reply #33 on: July 24, 2013, 12:05:21 PM »
Right. Drinking by myself again, fml.
Nope. You're my boy Blue! A small warning though, if you're gonna roll with me you have to bring an emergency kit: [ e.g. passport, tire repair kit, pitching wedge, and a spare set of socks ]. Last time me and the friends ended up in Northern MN in a lakeside motel. The owners comp'd us to two free rooms so, all-in-all it turned out to be a pretty cool night.  ...let's go.
TheSwamp.org (serving the CAD community since 2003)
Member location map - Add yourself

Donate to TheSwamp.org

MP

  • Seagull
  • Posts: 17750
  • Have thousands of dwgs to process? Contact me.
Re: Search path...
« Reply #34 on: July 24, 2013, 12:27:41 PM »
Nope. You're my boy Blue!

Weird. Ok, So I've never seen the movie "Old School", and accordingly, the "boy blue" phrase is new to me. Ok, the weird part. It's mostly new to me. My boss said it to me a couple times over the last month or so and I was like "whaaaa???". Now you've gone and used it. <blink> Guess I'll have to see the movie to appreciate what it means. Cannae do youtube from here and quick internet searches don't give me a good sense of what it means. tl;dr: I'm ignorant, this is not news and apologies for running this thread completely off the rails.
Engineering Technologist • CAD Automation Practitioner
Automation ▸ Design ▸ Drafting ▸ Document Control ▸ Client
cadanalyst@gmail.comhttp://cadanalyst.slack.comhttp://linkedin.com/in/cadanalyst

JohnK

  • Administrator
  • Seagull
  • Posts: 10634
Re: Search path...
« Reply #35 on: July 24, 2013, 12:43:44 PM »
Weird. Ok, So I've never seen the movie "Old School"...

lol No, that's cool! Just a term of endearment/rally cry. It's one of those movies you only need to see once (funny the first time and after the fact).

I had the same scenario with Jenny and the "Holly Grail". I had Jen watch it and the whole time she was complaining it was a stupid movie. But afterwards when she was in the shower and I ran in the bathroom and said: "run away! run far away!". I thought she was going to slip and fall down because she was laughing so hard.
TheSwamp.org (serving the CAD community since 2003)
Member location map - Add yourself

Donate to TheSwamp.org

dgorsman

  • Water Moccasin
  • Posts: 2437
Re: Search path...
« Reply #36 on: July 24, 2013, 02:07:41 PM »
Just be warned that searching through lots of sub-folders could take some time. Even worse if searching on a network / remote folder....

i tried it on a network with 1000 directories, and it locked up my acad.
im sure there is a limit on how many directories can search without causing issues.

would anyone have a good guess as to how many?

If you have to search through more than a handful of folders to find a support file, its time to re-evaluate the current scheme.
If you are going to fly by the seat of your pants, expect friction burns.

try {GreatPower;}
   catch (notResponsible)
      {NextTime(PlanAhead);}
   finally
      {MasterBasics;}

MP

  • Seagull
  • Posts: 17750
  • Have thousands of dwgs to process? Contact me.
Re: Search path...
« Reply #37 on: July 24, 2013, 02:53:22 PM »
lol No, that's cool! Just a term of endearment/rally cry ...

Ahhh cool; thx. In the interests of curbing any further thread de-railing capping it at that; cheers.
Engineering Technologist • CAD Automation Practitioner
Automation ▸ Design ▸ Drafting ▸ Document Control ▸ Client
cadanalyst@gmail.comhttp://cadanalyst.slack.comhttp://linkedin.com/in/cadanalyst

andrew_nao

  • Guest
Re: Search path...
« Reply #38 on: July 24, 2013, 03:18:54 PM »
Just be warned that searching through lots of sub-folders could take some time. Even worse if searching on a network / remote folder....

i tried it on a network with 1000 directories, and it locked up my acad.
im sure there is a limit on how many directories can search without causing issues.

would anyone have a good guess as to how many?

If you have to search through more than a handful of folders to find a support file, its time to re-evaluate the current scheme.

i just testing with 1000 to see how deep i could take it and how long it would go.
i personally would just find the path of the file and hardcode it in

dgorsman

  • Water Moccasin
  • Posts: 2437
Re: Search path...
« Reply #39 on: July 24, 2013, 05:42:00 PM »
Hardcoding paths require changes to code if the path changes.  Look at the number of posters who have a LISP they inherited and need to make it work on a new computer, new network location, new AutoCAD version.  To my mind changing data requires less knowledge than changing code, so I use a combination of registry values, XML files, and generic search patterns to handle changes with less work and by those who don't understand LISP (like IT  :angel: ).
If you are going to fly by the seat of your pants, expect friction burns.

try {GreatPower;}
   catch (notResponsible)
      {NextTime(PlanAhead);}
   finally
      {MasterBasics;}

irneb

  • Water Moccasin
  • Posts: 1794
  • ACad R9-2016, Revit Arch 6-2016
Re: Search path...
« Reply #40 on: July 25, 2013, 01:10:40 AM »
i tried it on a network with 1000 directories, and it locked up my acad.
im sure there is a limit on how many directories can search without causing issues.
would anyone have a good guess as to how many?
Nope, it's a bit like asking: "How long is a string?"

It all depends on how fast your whole setup is. I.e. discs, network connection, PC, OS's filesystem interface (both yours and the server's), congestion on the network, number of files in each folder, number of folders, length of filenames, etc. etc. etc.

That's why I posted the link to that other thread. The only way to limit the amount the function needs to search through would be to use something like dgorsman's idea of depth-limiting. I.e. how deep you search into nested folders. Or use a list of possible folders through which to search - i.e. add the folder into your Support Folders Search Path and use the findfile function.

Hardcoding paths require changes to code if the path changes.  Look at the number of posters who have a LISP they inherited and need to make it work on a new computer, new network location, new AutoCAD version.  To my mind changing data requires less knowledge than changing code, so I use a combination of registry values, XML files, and generic search patterns to handle changes with less work and by those who don't understand LISP (like IT  :angel: ).
Too true, if you constantly need to search for a file you need to find another way. Either add it to your SFSP, or have a setting which tells you where it is (Registry or some file in acad's setup folders). That's going to be exponentially faster than even limiting the depth of nested search folders.
Common sense - the curse in disguise. Because if you have it, you have to live with those that don't.

irneb

  • Water Moccasin
  • Posts: 1794
  • ACad R9-2016, Revit Arch 6-2016
Re: Search path...
« Reply #41 on: July 25, 2013, 02:19:18 AM »
I know that a specified file is existing and I want to find its location.
How do I get the path of the document (txt, doc... etc.)?
Thanks in advance.
This might be a bit late in this thread  :? Hidden in the other matter  :-(

But re-reading the OP, I'd like to ask a question: When you state that you know the specified file exists, do you already have it somewhere (say in a variable) and simply want to know its path? E.g. is it in the same folder as your DWG? Or perhaps even in the same folder as your CUI(x) file?
Common sense - the curse in disguise. Because if you have it, you have to live with those that don't.

andrew_nao

  • Guest
Re: Search path...
« Reply #42 on: July 25, 2013, 01:10:09 PM »
Hardcoding paths require changes to code if the path changes.  Look at the number of posters who have a LISP they inherited and need to make it work on a new computer, new network location, new AutoCAD version.  To my mind changing data requires less knowledge than changing code, so I use a combination of registry values, XML files, and generic search patterns to handle changes with less work and by those who don't understand LISP (like IT  :angel: ).

if youre starting from scratch, to me anyway, it would make sense to hardcode the path.

however, im the type of person that would take the time to try and modify the code

andrew_nao

  • Guest
Re: Search path...
« Reply #43 on: July 25, 2013, 01:12:25 PM »
.. i.e. add the folder into your Support Folders Search Path and use the findfile function.
that sounds like it would be the best idea, use code to add the paths to the SFSP


MeasureUp

  • Bull Frog
  • Posts: 462
Re: Search path...
« Reply #44 on: July 25, 2013, 11:42:35 PM »
To Kerry:
your code works but it is slow when searching in entire disk or in network server, as irneb points out. Thanks.

To Kerry and Lee:
Both of you have helped me a lot in the past. I appreciate your help very much.
I think what CADDOG said is right. Hope you can give more explanation to each other without fighting in any kind. I am a bit upset when you are angry as both of you are vary good in programming and have helped many people here.
« Last Edit: July 26, 2013, 12:11:19 AM by MeasureUp »