Jump to content

List of preset text


Jamesclark64

Recommended Posts

As always with a new user, I don't know your LISP abilities so will assume you can work it out from this... if not jus ask for more help

Link to comment
Share on other sites

10 hours ago, Steven P said:

As always with a new user, I don't know your LISP abilities so will assume you can work it out from this... if not jus ask for more help

I've spent a few hours on it but I'm ashamed to say I'm out of my depth. not sure what part is the dcl example and what part if any is the .lsp file.  Not quite sure what I'm doing No idea what "!!*MUST BE STRING*!!" means.

Link to comment
Share on other sites

18 minutes ago, Jamesclark64 said:

I've spent a few hours on it but I'm ashamed to say I'm out of my depth. not sure what part is the dcl example and what part if any is the .lsp file.  Not quite sure what I'm doing No idea what "!!*MUST BE STRING*!!" means.

 

That's no problem, people come to ask questions who are pretty good and are stuck, others come here whose boss tells them "get a LISP for that" and have to search what a LISP is... and everything in between.

 

So assuming you can load and run a LISP program (or else see this: http://lee-mac.com/runlisp.html) save the code from alanjt to a file, call the file what you want with a '.l;sp' extension. In notepad for example in the save as use a file type *.* and call the file say DropDownBox.lsp.

 

We're not going to modify what he suggested, it is a useful little function to use in the future (Which reminds me, I might come back to that later for something else for me)

 

All that he wrote is a LISP, the way it works the LISP creates a temporary DCL file (on the fly) and refers to that, next time the LISP is run it will recreate that file (this is in the background, no need to worry about it), the benefit of this is that you don't need to worry about file locations for the DCL pop up.. it is just there.

 

To run what he suggests use the line (sorry if you know all this.. start at the beginning) 

 

(AT:listselect mytitle mylabel myheight mywidth mymultiselect mylist)

 

Each of these apart from mylist need to be a string. (You can have a list, a string or an integer, a string being text ( 'Hello World'), an integer is a number ('123')  and a list is, well, a list ("Hello World" "123"). You might note here that the strings have quotes around them and the number 123 is a string

 

You can also use variables in the command above.

 

You might go for something like this then:

 

(AT:listselect "Some Lists" "Select Text" "7" "25" "false" mylist)

 

all strings. Except mylist. We can define that in a LISP. If we were using numbers it might be something like (AT:listselect "Some Lists" "Select Text" 7 25 "false" mylist), no quotes around the numbers and cause an error later on - for this code, others are different

 

So put together you might run the code with something like:

 

(defun c:DropDownList ( / mylist myresult)

  (setq mylist (list ; create a list
    "SP"
    "JC"
    (rtos (+ 5 7))
    "Hello"
    "World"
  )) ; above list written on seperate lines for clarity, could be a single line with a space between list items)  

  (setq myresult (AT:listselect "Some Lists" "Select Text" "7" "25" "false" mylist)) ; run another function, AT:listselect


;; Do your thing here
  (princ (nth 0 myresult)) ; (nth 0... or (car... to return a string of the first entity
;;


  (princ) ; exit silently - nothing shown in command line at exit
) ; end function

 

Save that in your LSP file and see how it goes.

 

Apologies if you know all of that

 

 

 

 

  • Like 1
Link to comment
Share on other sites

On 05/02/2023 at 21:44, Steven P said:

 

That's no problem, people come to ask questions who are pretty good and are stuck, others come here whose boss tells them "get a LISP for that" and have to search what a LISP is... and everything in between.

 

So assuming you can load and run a LISP program (or else see this: http://lee-mac.com/runlisp.html) save the code from alanjt to a file, call the file what you want with a '.l;sp' extension. In notepad for example in the save as use a file type *.* and call the file say DropDownBox.lsp.

 

We're not going to modify what he suggested, it is a useful little function to use in the future (Which reminds me, I might come back to that later for something else for me)

 

All that he wrote is a LISP, the way it works the LISP creates a temporary DCL file (on the fly) and refers to that, next time the LISP is run it will recreate that file (this is in the background, no need to worry about it), the benefit of this is that you don't need to worry about file locations for the DCL pop up.. it is just there.

 

To run what he suggests use the line (sorry if you know all this.. start at the beginning) 

 

(AT:listselect mytitle mylabel myheight mywidth mymultiselect mylist)

 

Each of these apart from mylist need to be a string. (You can have a list, a string or an integer, a string being text ( 'Hello World'), an integer is a number ('123')  and a list is, well, a list ("Hello World" "123"). You might note here that the strings have quotes around them and the number 123 is a string

 

You can also use variables in the command above.

 

You might go for something like this then:

 

(AT:listselect "Some Lists" "Select Text" "7" "25" "false" mylist)

 

all strings. Except mylist. We can define that in a LISP. If we were using numbers it might be something like (AT:listselect "Some Lists" "Select Text" 7 25 "false" mylist), no quotes around the numbers and cause an error later on - for this code, others are different

 

So put together you might run the code with something like:

 

(defun c:DropDownList ( / mylist myresult)

  (setq mylist (list ; create a list
    "SP"
    "JC"
    (rtos (+ 5 7))
    "Hello"
    "World"
  )) ; above list written on seperate lines for clarity, could be a single line with a space between list items)  

  (setq myresult (AT:listselect "Some Lists" "Select Text" "7" "25" "false" mylist)) ; run another function, AT:listselect


;; Do your thing here
  (princ (nth 0 myresult)) ; (nth 0... or (car... to return a string of the first entity
;;


  (princ) ; exit silently - nothing shown in command line at exit
) ; end function

 

Save that in your LSP file and see how it goes.

 

Apologies if you know all of that

 

Thank you for taking the time to gi through this. Works an absolute treat now.  Very much appreciated. 

 

 

 

  • Like 1
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...