Author Topic: Make,Model,Serial#  (Read 1718 times)

0 Members and 1 Guest are viewing this topic.

Water Bear

  • Guest
Make,Model,Serial#
« on: August 29, 2006, 03:46:49 PM »
I've used this format to search an external file
Code: [Select]
    (cond (fn
(setq fp   (open fn "r")
       loop T
)
(while (and loop (setq line (read-line fp)))
   (setq char (substr line 1 1))
   (cond ((= char ";")) ; do nothing character
((= char "*") ; flag character
  (setq rngmax (read (substr line 2)))
  (if (<= cfmax rngmax)
    (setq dlist (read-line fp)
  loop nil
    )
  )
)
   )
)
(close fp)
)
  )
When the external file is of the form:
*100
a,b,c

Can anyone show me how to make or fomat a compound search? Like something with three tiers. Manufacturer,Model, size...
« Last Edit: August 29, 2006, 05:40:36 PM by Water Bear »

ElpanovEvgeniy

  • Water Moccasin
  • Posts: 1569
  • Moscow (Russia)
Re: Make,Model,Serial#
« Reply #1 on: August 31, 2006, 01:20:07 PM »
Code: [Select]
(defun test (file / F LST X)
  ;(test "D:\\test.txt")
  (setq f (open file "r"))
  (while (setq x (READ-LINE f))
    (if (or
          (= (substr x 1 4) "Mod_")
          (= (substr x 1 4) "Man_")
          (= (substr x 1 4) "Siz_")
        ) ;_  or
      (setq lst (cons (substr x 5) lst))
    ) ;_  if
  ) ;_  while
  (close f)
  (reverse lst)
) ;_  defun
text-file:
Code: [Select]
I've used this format to search an external file
Code:
    (cond (fn
(setq fp   (open fn "r")
       loop T
)
(while (and loop (setq line (read-line fp)))
   (setq char (substr line 1 1))
   (cond ((= char ";")) ; do nothing character
((= char "*") ; flag character
  (setq rngmax (read (substr line 2)))
  (if (<= cfmax rngmax)
    (setq dlist (read-line fp)
  loop nil
    )
  )
)
   )
)
(close fp)
)
  )
Man_ULTRA MANUFACTURER-1234
When the external file is of the form:
*100
a,b,c

Mod_ULTRA MODEL-123-45/6789
Can anyone show me how to make or fomat a compound search?
 Like something with three tiers. Manufacturer,Model, size...

Siz_HUGE SIZE-1234x5678m

« Last Edit: 30-08-2006, 01:40:36 by Water Bear »
Report to moderator    Logged

-Is it better to burnout or simply fade away?
-Does fire yield to ice, or is it the other way around?
-Gutta cavat lapidem non vi, sed saepe cadendo
.....
Return Values
Code: [Select]
'("ULTRA MANUFACTURER-1234" "ULTRA MODEL-123-45/6789" "HUGE SIZE-1234x5678m")