Author Topic: lisp variable in a path?  (Read 2898 times)

0 Members and 1 Guest are viewing this topic.

pmvliet

  • Guest
lisp variable in a path?
« on: December 16, 2004, 04:51:40 PM »
Hi Everyone,

can you set a variable
Code: [Select]
(setq client "riteaid")
and then have "client" be in a path such as
Code: [Select]
"i:\\standards\\retail\\_$ client\\_$ client.bat"
I tried putting _$ client in () but that didn't help either.

the path really should be
i:\\standards\\retail\\riteaid\\riteaid.bat

thanks, I am slowly trying to learn this.
The reason is I am trying to load and un-load menu's but the menu that is being unloaded may not always be the same one. I was thinking if I could have the menu name as a constant variable, that would be one way around it. Here is the code that I am working with.
Code: [Select]

(defun c:riteaid ()
  (startapp "i:\\standards\\retail\\riteaid\\riteaid.bat")
(command "menuload"
"i:\\standards\\retail\\riteaid\\menu\\riteaid"
)
(menucmd "p1=+acad.pop1")
(menucmd "p16=+riteaid.pop1")
(alert "Notice:\nThe riteaid Workspace has been loaded!")
)


I am trying to pull in a menu, then load a pulldown. But then I want to remove the menu replace it with another one and then load that pop menu.

TIA
Pieter

Mark

  • Custom Title
  • Seagull
  • Posts: 28683
lisp variable in a path?
« Reply #1 on: December 16, 2004, 04:57:12 PM »
Use 'strcat' i.e.
Code: [Select]

(strcat "i:\\standards\\retail\\"client"\\"client".bat")
TheSwamp.org  (serving the CAD community since 2003)

pmvliet

  • Guest
lisp variable in a path?
« Reply #2 on: December 16, 2004, 04:59:19 PM »
6 minutes Mark!
You are quick.
I gota read how that works. Thanks for the heads up.

Pieter

whdjr

  • Guest
lisp variable in a path?
« Reply #3 on: December 16, 2004, 05:03:03 PM »
What is the bat file loading?
Can you post the bat file?

Right off hand I would say you could use strcat to do what I think you want.

whdjr

  • Guest
lisp variable in a path?
« Reply #4 on: December 16, 2004, 05:03:36 PM »
Dang MARK!!!!! :(



 :D  :D  :D  :D  :D
It's about time you beat me.

Mark

  • Custom Title
  • Seagull
  • Posts: 28683
lisp variable in a path?
« Reply #5 on: December 16, 2004, 05:08:35 PM »
Quote from: whdjr
Dang MARK!!!!! :(

nanananana ............. *grin*
TheSwamp.org  (serving the CAD community since 2003)

whdjr

  • Guest
lisp variable in a path?
« Reply #6 on: December 16, 2004, 05:10:30 PM »
--||thssssttttt||--

 :lol:

pmvliet

  • Guest
lisp variable in a path?
« Reply #7 on: December 17, 2004, 12:59:36 PM »
Ok, I read what stract and it says this is something that "string concatenates" or combines whatever follows into a single string.

so if I add this (what mark said)
Code: [Select]
(strcat "i:\\standards\\retail\\"client"\\"client".bat")

is it defining strcat to be i:\standards\retail\riteaid\riteaid.bat
so does it evaluate the variable client into the process?
If it does define strcat to the above, how do I call this?

I guess I am confused on how to incorporate this with my startapp
line of
Code: [Select]
(startapp "i:\\standards\\retail\\riteaid\\riteaid.bat")


THis is what I have now
Code: [Select]
(defun c:riteaid (/ client)
  (setq client "riteaid")
  (startapp
    (strcat "i:\\standards\\retail\\"client"\\"client".bat")
  )
  (command "menuload"
  (strcat "i:\\standards\\retail\\"client"\\menu\\"client")
)
   (menucmd "p16=-(_$ client).pop1")
  (
   (menucmd "p16=+(_$ client).pop1")
    (alert "Notice:\nThe riteaid Workspace has been loaded!")
  )
)

pmvliet

  • Guest
lisp variable in a path?
« Reply #8 on: December 17, 2004, 01:04:48 PM »
If you want to see what my batch file is doing, this is it

Code: [Select]

:1
if exist c:\Autocad goto 2
md c:\AutoCad
md c:\AutoCad\Autosave
md c:\AutoCad\BAK
md c:\AutoCad\Fonts
md c:\AutoCad\Linetype
md "c:\AutoCad\Plot Styles"
md c:\AutoCad\Plotters
md c:\AutoCad\Temp
md c:\AutoCad\Textures

:2
del /q "c:\autocad\fonts\*.*"
del /q "c:\autocad\linetype\*.*"
del /q "c:\autocad\Plot styles\*.*"
del /q "c:\autocad\textures\*.*"

copy "i:\standards\retail\riteaid\font\*.*" "c:\autocad\fonts\*.*"
copy "i:\standards\retail\riteaid\Plot styles\*.*" "c:\autocad\Plot styles\*.*"


Basically this is a archaic/crude way to get rid of different AutoCad Profiles. We need the profiles for search paths, colortables, fonts, plotters etc. I just don't like that my users have to keep switching profiles to work on another client.

And for those that are asking: I have used them for 3 years now. We have an excess of 25-30 different profiles for all different clients. I am trying to take it a step further so I don't have to keep disturbing the users.

Pieter

Mark

  • Custom Title
  • Seagull
  • Posts: 28683
lisp variable in a path?
« Reply #9 on: December 17, 2004, 03:38:33 PM »
this is my best guess.
Code: [Select]

(defun c:riteaid (/ client)
  (setq client "riteaid")
  (startapp
(strcat "i:\\standards\\retail\\" client "\\" client ".bat")
)
  (command
"menuload"
(strcat "i:\\standards\\retail\\" client "\\menu\\" client)
)
  (menucmd (strcat "p16=-" client ".pop1"))
  (
   (menucmd (strcat "p16=+" client ".pop1"))
(alert "Notice:\nThe riteaid Workspace has been loaded!")
)
  )
TheSwamp.org  (serving the CAD community since 2003)

pmvliet

  • Guest
lisp variable in a path?
« Reply #10 on: December 20, 2004, 01:37:03 PM »
Thanks Mark,

that is a step closer. Still having issues with loading and unloading menu's
and also the pull downs. I need to set some time to play with it.
The variable works pretty neat.

I am also getting a
Quote
; error: no function definition: nil

once it loads so i need to track that down.

Also need to look into if then statements so tat the code and check existing conditions.

Thanks,
Pieter