Author Topic: Steering Findfile search  (Read 1914 times)

0 Members and 1 Guest are viewing this topic.

Krushert

  • Seagull
  • Posts: 13679
  • FREE BEER Tomorrow!!
Steering Findfile search
« on: July 06, 2011, 11:08:51 AM »
How do I steer findfile search to look for the needle that is only under haystack "U" and not for the needle that is under haystack "C"?

Code: [Select]
(setq MyDocPrefx (getvar "MYDOCUMENTSPREFIX"))
(setq OldUserFolder1 (vl-filename-directory (findfile (strcat MyDocPrefx "acad.pgp"))))
I + XI = X is true ...  ... if you change your perspective.

I no longer CAD or Model, I just hang out here picking up the empties beer cans

BlackBox

  • King Gator
  • Posts: 3770
Re: Steering Findfile search
« Reply #1 on: July 06, 2011, 11:11:49 AM »
Not sure I understand you fully, but you might try this adaptation:

Code: [Select]
(setq MyDocPrefx (getvar "MYDOCUMENTSPREFIX"))
(setq OldUserFolder1 (vl-filename-directory (findfile (strcat MyDocPrefx "\\acad.pgp"))))

Note the "\\" prefix in front of "acad.pgp" now.
"How we think determines what we do, and what we do determines what we get."

Krushert

  • Seagull
  • Posts: 13679
  • FREE BEER Tomorrow!!
Re: Steering Findfile search
« Reply #2 on: July 06, 2011, 11:18:00 AM »
Tried that.  It upchuck a "bad argument type:  stringp nil"  :x
I + XI = X is true ...  ... if you change your perspective.

I no longer CAD or Model, I just hang out here picking up the empties beer cans

BlackBox

  • King Gator
  • Posts: 3770
Re: Steering Findfile search
« Reply #3 on: July 06, 2011, 11:26:15 AM »
Tried that.  It upchuck a "bad argument type:  stringp nil"  :x

That's because your findfile returned nil (meaning acad.pgp was not found).

Perhaps this is a more appropriate test:

Code: [Select]
(if (setq
      path (findfile
             (strcat (setq MyDocPrefx (getvar "MYDOCUMENTSPREFIX"))
                     "\\acad.pgp")))
  (setq OldUserFolder1 (vl-filename-directory path))
  (alert (strcat "ACAD.pgp cannot be found at :"
                 "\n\n"
                 MyDocPrefx)))
"How we think determines what we do, and what we do determines what we get."

Krushert

  • Seagull
  • Posts: 13679
  • FREE BEER Tomorrow!!
Re: Steering Findfile search
« Reply #4 on: July 06, 2011, 11:53:53 AM »
Okay that did not upchuck but it did return your alert message.

That being said, now I know (or believe) that find file is not looking in the sub-folders.  For this particular user, his PGP file is located 2 folders down in his Mydocs folder.

  Each my users ACAD user files are in folders with different names and I am try to correct that with code when I install 2012.
I + XI = X is true ...  ... if you change your perspective.

I no longer CAD or Model, I just hang out here picking up the empties beer cans

Lee Mac

  • Seagull
  • Posts: 12926
  • London, England
Re: Steering Findfile search
« Reply #5 on: July 06, 2011, 12:01:39 PM »
Maybe this might help?

JohnK

  • Administrator
  • Seagull
  • Posts: 10660
Re: Steering Findfile search
« Reply #6 on: July 06, 2011, 12:23:47 PM »
A few of ElpanovEvgeniy's file routines have helped me several times.

Link:
https://www.theswamp.org/index.php?topic=15186.msg184298#msg184298
TheSwamp.org (serving the CAD community since 2003)
Member location map - Add yourself

Donate to TheSwamp.org

Krushert

  • Seagull
  • Posts: 13679
  • FREE BEER Tomorrow!!
Re: Steering Findfile search
« Reply #7 on: July 06, 2011, 01:25:53 PM »
Thanks Guys!

Thanks helped!
I + XI = X is true ...  ... if you change your perspective.

I no longer CAD or Model, I just hang out here picking up the empties beer cans