Jump to content

Create Temp DCL File Error missing semicolon


Recommended Posts

Posted
(defun c:test2 ()	;Command test2
(vl-load-com) 		;load VLISP
  (setq tempname (vl-filename-mktemp "temp.dcl") filen (open tempname "w")) ;create temporary dcl
  (foreach stream
    '("kzzbss:dialog{"
      "\n  label="temporary dialog";"
      "\n  :popup_list{key="tag";label="Attributes:";list="List1\\nList2\\nList3\\nList4\\nList5\\nList6\\nList7\\nList8";}"
      "\n  :edit_box{key="str"; label="value:";}"
      "\n  ok_cancel;}")
  (princ stream filen))	;Write the above data in temporary dcl
  (close filen)		;close file
  (setq dclname tempname)
  (setq dcl_re (load_dialog dclname)) 			;load temporary dcl
  (if (not (new_dialog "kzzbss" dcl_re)) (exit))
  (action_tile "accept" "(OKaction)(done_dialog 1)")	;Define the action for the OK button
  (action_tile "cancel" "(done_dialog)")
  (setq std (start_dialog))
  (unload_dialog dcl_re)		;unload_dialog
  (vl-file-delete dclname)		;Delete temporary dcl files
  (if (= std 1) (run the program))	;run
  (princ)
)

error in above program  

 

 

err.png

Posted

You need to add a backslash before each double quote when you include a string into another.

'("kzzbss :dialog{"
      "label=\"temporary dialog\";"
      ":popup_list{key=\"tag\";label=\"Attributes:\";list=\"List1\\nList2\\nList3\\nList4\\nList5\\nList6\\nList7\\nList8\";}"
      ":edit_box{key=\"str\"; label=\"value:\";}"
      "ok_cancel;}")

 

  • Thanks 1
Posted
8 minutes ago, Tharwat said:

You need to add a backslash before each double quote when you include a string into another.

'("kzzbss :dialog{"
      "label=\"temporary dialog\";"
      ":popup_list{key=\"tag\";label=\"Attributes:\";list=\"List1\\nList2\\nList3\\nList4\\nList5\\nList6\\nList7\\nList8\";}"
      ":edit_box{key=\"str\"; label=\"value:\";}"
      "ok_cancel;}")

 

thanks its working

Posted (edited)

Just a comment I use a library List box.lsp making a  list dcl then you can use it in any code with out having to copy and edit the source into every code. Its just 2 lines of code, plus list. This version matches what was provided by Lee-mac. I have another similar. You could do it to what you have done.

 

(setq lst (list "l1" "l2" "l3" "l4" "L5"))

(if (not LM:listbox)(load "ListBoxV1-2.lsp")) ; loads the lisp if not already loaded
(setq ans (LM:listbox "please choose " lst 1))

 

Edited by BIGAL
  • Thanks 1

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...