Jump to content

Recommended Posts

Posted

I have created a couple simple DCL boxes for users to enter information. Now I want to make one that is just a pulldown menu and the items in the list are files from a directory (that way it's always updated automatically). then execute that file when the user clicks on it. So think of "file" as .lsp for example. The user would find it in the pulldown and click on it and it will execute it.

 

any help would be appreciated. Also, is there any online tutorials that teach DCL and/or documentation that lists every function in DCL and what it does?

 

Thanks!

  • Replies 28
  • Created
  • Last Reply

Top Posters In This Topic

  • jmerch

    13

  • MSasu

    7

  • BlackBox

    5

  • LibertyOne

    2

Posted

Basically, there are some steps you may follow:

 

 

  • Create the list of LSP files in your path:

(setq MyToolsList (vl-directory-files MyToolsPath "*.LSP" 1))

  • Load the list of available tools in interface:

(start_list DCLListBox)
(mapcar 'add_list MyToolsList)
(end_list)

  • Get the current selection when user press the OK button:

(action_tile "accept" "(setq ToolToRun (get_tile \"DCLListBox\"))(done_dialog 1)")
(action_tile "cancel" "(done_dialog 0)")

  • After the dialog is closed with OK call the tool chosed by user:

(if (= (getvar "DIASTAT") 1)
(load (strcat MyToolsPath (nth (atoi ToolToRun) MyToolsList)))
)

Regards,

Mircea

Posted

jmerch - he who googles, finds...

 

Now I'm going to give all y'all a great tip for finding anything on google. You want good resources on DCL programming. Not just one but a multiple of resources. Looking for "DCL" is a good start, but that just might give you the "Department of Correctional Loafers", which we really don't need. "DCL" is an abbreviation of "Dialog Control Language". Use that in your search. And we're looking for documents, right? Perhaps a paperless form of a document? A so called PDF? Type this in Google's search box:

filetype:PDF "dialog control language"

This should give you some good reading material.

 

Another good search tactic I use is Google Images. Search for "dialog control language" in google images and see what comes up. Follow the images to a website that is describing how to write them.

 

Hope these two tips help you with your search.

Posted

I do use google searches quite a bit and use most of your tips (I didn't know you could specify filetypes in searches like that), before I ever go to asking the question on posts. DCL actually pulls up more results for Disney Cruise Line :D

 

Thanks for the tip.

Posted

Google fan here. sign_google.gif

 

FTFY:

 

Type this in Google's search box:

Consider the results from this search string (linked):

 

[url="http://lmgtfy.com/?q=filetype%3APDF+%22dialog+control+language%22"]filetype:PDF "dialog control language"[/url]

This should give you some good reading material.

 

:P

Posted
DCL actually pulls up more results for Disney Cruise Line :D

True, true :)

Posted

Not a bad idea using a dcl to pick a lisp for my five cents worth we have all our lisps in a pull down menu they are listed in alphabetical order grouped A-D E-H etc with sub menus and the description is not necessarily the name of the lisp. Thats the only drawback I see in using lisp file names. The advantage also I can go straight to a z lisp without scrolling we have 60+.

 

Also have dvb as well in menu plus lots of other stuff

Posted

I like the pull down menu idea, but we don't use them...all ribbon and quick commands here. I was hoping in a DCL list you could still type the beginning letter of the file and it would skip to there...

Posted

Thanks for all the help/suggestions. Here's my "go-at-it" and am getting the fixnump error. After the error, the command line still spits out each file I'm requesting out of the directory though...just not in a dialog box :) I have read a DCL tutorial, understand most of it but some of the examples went in a different direction so I had to start trial and error (I know, don't shoot me). Any assistance with this is much appreciated.

 

(defun c:test2()
   (setq scriptlist (vl-directory-files "Z:/CAD/CAD-MECH/PM Shared/Scripts" "*.cod" 1))
   (if(not(new_dialog "scripts" scriptlist))(exit))
   (start_list "scr_list")
       (mapcar 'add_list scriptlist)
   (end_list)
   (action_tile "accept" "(setq mytile (atoi(get_tile \"scr_list\")))(done_dialog 1)")
   (action_tile "cancel" "(done_dialog 0)")
   (if (= (getvar "DIASTAT") 1)
     (executescript (stracat "Z:/CAD/CAD-MECH/PM Shared/Scripts" (nth mytile scriptlist)))
   )
)

Posted

I have made some corrections to your code - see below. Most important comment is to avoid to use the same variable to store the list of files and the ID of dialog box:

 

(defun c:test2()
   (setq scriptlist (vl-directory-files "Z:/CAD/CAD-MECH/PM Shared/Scripts" "*.cod" 1))

   [color=red](setq DCLid (load_dialog "scr_list.dcl"))[/color]
   (if (not (new_dialog "scripts" [color=red]DCLid[/color])) (exit))

   (start_list "scr_list")
       (mapcar 'add_list scriptlist)
   (end_list)

   (action_tile "accept" "(setq mytile (atoi (get_tile \"scr_list\")))(done_dialog 1)")
   (action_tile "cancel" "(done_dialog 0)")

[color=red]   (start_dialog)[/color]
[color=red]   (unload_dialog DCLid)[/color]

   (if (= (getvar "DIASTAT") 1)
     (executescript ([color=red]strcat[/color] "Z:/CAD/CAD-MECH/PM Shared/Scripts" (nth mytile scriptlist)))
   )
)

 

Regards,

Mircea

Posted

I'm so....not smart. I should have known to load the fricking dialog...duh :oops:

 

Thanks for your corrections. I got the DCL box to pop up now. The only outstanding issue is when the user selects the file and clicks ok, the "executescript" function still runs like normal and has the user re-select it...which is not what I'm shooting for. So, from what I see, it's not gathering the whole path of "Z:/CAD/CAD-MECH/PM Shared/Scripts/Script Name". I think it has something to do with mytile returning an integer...but I tried putting itoa in the (nth mytile scriptlist).

Posted

I just spotted another issue:

(strcat "Z:/CAD/CAD-MECH/PM Shared/Scripts[color=red]/[/color]" (nth mytile scriptlist))

 

Regards,

Mircea

Posted

Glad to help you. You're welcome!

 

Regards,

Mircea

Posted

I'd also like to tweak this so that the .cod doesn't show up in the list....from what I've researched, it appears the best method would be to use vl-filename-base. But where can I introduce this?

Posted
I'd also like to tweak this so that the .cod doesn't show up in the list....from what I've researched, it appears the best method would be to use vl-filename-base. But where can I introduce this?

 

Lemon squeezy. ;)

 

(setq scriptlist [color=blue](mapcar 'vl-filename-base[/color] (vl-directory-files "Z:/CAD/CAD-MECH/PM Shared/Scripts" "*.cod" 1)[color=blue])[/color])

Posted

I will do instead:

 

(mapcar 'add_list (mapcar 'vl-filename-base scriptlist))

 

Regards,

Mircea

Posted

Out of curiosity, would this work? :unsure:

 

(mapcar
 '(lambda (x) (add_list (vl-filename-base x)))
 (vl-directory-files "Z:/CAD/CAD-MECH/PM Shared/Scripts" "*.cod" 1))

... If so, this only requires the list to be iterated once, rather than twice (once for each mapcar). ;)

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