Jump to content

Recommended Posts

Posted

I would like to see all autolisp routines display some kind of command line prompt telling the user what to type to execute the routine. I have noticed, for example, that although a lisp file may be

named FlattenToZ.lsp the command to start the routine might be FTZ or F2Z. The user may not know this unless they either open the .lsp file with an ASCII text editor (like Notepad) or a .txt file accompanies the .lsp file.

 

I would suggest one of the following (or something similar) be incorporated into every lisp routine.

 

(princ "\nType XXX to start routine ")

 

...or...

 

(prompt "\nType XXX to execute. ")

(princ)

 

I'm sure there are other ways to get this message across. I think something like this would be benefical.

 

Other thoughts and comments are solicited and welcomed.

 

Regards,

 

ReMark

 

P.S. - I stopped writing lisp routines a while ago. If my code is in error please let me know. Thanks.

Posted

Am I right in thinking that if alert is used a message box appears. Something like this :

 

(alert
 "Type [XX] in the command line to start the routine\n\nAuthor: Joe Soap\nweb page: http://www.cadtutor.net\n\nTHIS PROGRAM IS PROVIDED \"AS IS\" AND WITH ALL FAULTS.\n\nPress OK to continue."
)

 

It also quite a while since I wrote any LISP.

Posted

Agreed. :thumbsup:

 

throw in the syntax as well for routine that requires an argument

 

 

Syntax:

(make_layer layername color)

Usage:

(make_layer "LAyer1" "2")

 

 

Posted

For sure one informational prompter is a very good programming practice – not all users have AutoLISP knowledge and therefore some may be unable to use the tool.

The worst case is when a developer is compiling his code and distributes it without any documentation – in this case his work is useless since the name of the command is rendered unreadable in the FAS/VLX file.

 

Regarding the usage of Alert box instead of prompt I think that this will become annoying after you get familiar with that routine.

 

Regards,

Mircea

Posted

As most will know, the syntax appears following the

 

(defun c:[b][color=red]syntax[/color][/b]

the 'c:' indicates that the program may be called from the command line.

 

For small snippets of code posted, I mostly don't add a prompt as the syntax is usually obvious in short programs; however, for larger programs with many lines of code, I usually add a command-line message or add a message in the code header (for what good that does... nobody reads the code headers it seems)...

 

Lee

Posted

While you, me and others who are familiar with autolisp routines may know enough to open the file and look for the syntax many people who come here looking for help do not know what autolisp is and do not know how to load an autolisp routine. Therefore, I would not expect them to intuitively know enough to open the .lsp file and view what is written. Thus my suggestion.

 

Question: How many of these people would even know what an ASCII text editor is? This is what their face would look like if you asked them :? or this :unsure:.

Posted
I would like to see all autolisp routines display some kind of command line prompt telling the user what to type to execute the routine. I have noticed, for example, that although a lisp file may be

named FlattenToZ.lsp the command to start the routine might be FTZ or F2Z. The user may not know this unless they either open the .lsp file with an ASCII text editor (like Notepad) or a .txt file accompanies the .lsp file.

 

...

 

I'm sure there are other ways to get this message across. I think something like this would be benefical.

 

Other thoughts and comments are solicited and welcomed.

 

 

ReMark,

 

Having each LISP routine prompt the user with the syntax needed to invoke the command is great - when you only have a handful of commands being loaded. :ouch:

 

However, as my code library has grown, I found it easier to instead have only one prompt:

 

Transportation ToolBox Loaded... © 2009, by [[i]RenderMan[/i]]
 >>  TOOLBOX  >>  List of ToolBox Commands

 

 

When the user enters TOOLBOX at the command line (and hits enter), an excel spreadsheet is opened, which provides the user the entire catalog of enhancements available for our 'Transportation ToolBox'.

 

I find using excel simple, and more complete than using a text file, or adding descriptions to the code. Doing so allows me to add formatting, descriptions, etc. in an easy to read.

 

More importantly, doing so is easy to update! :wink:

 

Feel free to use it, if you like:

 

(defun c:Toolbox  (/ f)
 (if (findfile (setq f "[color=red]FilePath[/color]\\[color=blue]FileName[/color].xlsx"))
   (startapp "C:\\Program Files\\Microsoft Office\\Office12\\EXCEL.EXE" f)
   (alert (strcat "File Cannot Be Found: \n\n" f)))
 (princ))

 

 

 

P.S. - I stopped writing lisp routines a while ago. If my code is in error please let me know. Thanks.

 

 

You're missing

 tags, bud. :P

 

Cheers! :beer:

Posted

Missing code tags? Oh, no! I'm in violation. Guess I should expect a visit from the Code Tag Enforcement Squad any minute now. I can't wait to see the ticket they write me. $$$

Posted

Oh! ... since the thread title is vague enough to make this relevant :lol:!

 

I also incorporate a validation test which loads at drawing open to prevent unauthorized users.

 

If the user is not part of our group (we have several), all functionality is re-defined with an error message, which prompts them to contact me.

 

This is necessary, as our groups work very differently, and someone outside of our group might unwittingly mess with their environment, sysvars, layers, etc. if they're not careful.

 

;;;--------------------------------------------------------------------;
;;; My error message function:
(defun MyErrMsg  ()
 (alert
   (strcat
     "Error: Unauthorized User "
     "\n------------------------------------------------------- "
     "\nTransportation ToolBox Has Been Disabled... "
     "\n------------------------------------------------------- \n"
     "\nPlease Contact [[i]RenderMan[/i]]: " "\n"
     "\nPhone | [[i]Call_RenderMan[/i]] "
     "\nEmail   | [[i]Email_RenderMan[/i]] "))
 (princ))
;;;--------------------------------------------------------------------;
;;; My validation function:
(defun MyValidation (/ userName )
 (vl-load-com)
 (if (not (vl-position (setq userName (getvar 'loginname)) (list userName1 userName2)))
   (progn
     (defun c:MyFunc1 () (MyErrMsg))
     (defun c:MyFunc2 () (MyErrMsg))
     (defun c:MyFunc3 () (MyErrMsg))
     (terpri)
     (prompt "\n <!> Transportation Toolbox Disabled <!> ")
     (terpri)
     (MyErrMsg)))
 (princ))
;;;--------------------------------------------------------------------;
(MyValidation)
(princ)

 

 

:veryevil:

 

 

No demand loading!? Nope... not yet.

 

While we have many automations, they take up very little RAM, and well, we're just not there yet. I see that being where we go in the near future though.

 

Hope this helps!

Posted
Missing code tags? Oh, no! I'm in violation. Guess I should expect a visit from the Code Tag Enforcement Squad any minute now. I can't wait to see the ticket they write me. $$$

 

Out of everything in my post - THAT is what you comment on. :lol: Classic. lmao

Posted

I also incorporate a validation test which loads at drawing open to prevent unauthorized users.

 

If the user is not part of our group (we have several), all functionality is re-defined with an error message, which prompts them to contact me.

 

This is necessary, as our groups work very differently, and someone outside of our group might unwittingly mess with their environment, sysvars, layers, etc. if they're not careful.

Mine just plain wont run if the User doesn't have the proper authorization to access the programs.

  • 3 weeks later...
Posted

I don't think it's too much to ask that the user of any autolisp code offered in this forum meet two requirements :

1 - Learn what (defun c:abc (/ ) means in order to change the name when necessary and 2 - Be able to view and minimally edit the source to accomplish a name change. All these lisp programs are written mostly by amateur programmers at no cost and no warranty. The aim, I presume, of the lisp forum is more towards education than giving away user friendly goodies. There is no shortage of high quality tutorials in this forum. Let's encourage everyone to use them.

Posted
Oh! ... since the thread title is vague enough to make this relevant :lol:!

 

I also incorporate a validation test which loads at drawing open to prevent unauthorized users.

 

If the user is not part of our group (we have several), all functionality is re-defined with an error message, which prompts them to contact me.

 

This is necessary, as our groups work very differently, and someone outside of our group might unwittingly mess with their environment, sysvars, layers, etc. if they're not careful.

.............................

 

Not quite the same but my previous employer would sell on script which I had written (compiled) to their clients. To protect the interests of the company I ended up with a method that connected to a sql database somewhere on the internet on the first instance of use. If they had an available licence a registry key was written based on their several aspects about their computer. Hehe none of this crazy open forum stuff we've got here.:)

 

SOliver

Posted

Like renderman we have a "How to manuals" on our server where we put helpfull hints generally screen grabs and comments in a word doc. Anyway we have a Lisp doc that lists all the lisps and VBA etc in an index and then at least a 1-2 line description including the bold shortcut. I distrubute this to all new staff and make sure they read it. Often remind existing staff to re-read as well. All new program details are emailed to our team and discussed at team meetings.

 

When this doesn't work the manual and a 2x4 seems to jog their memory

Posted
Like renderman we have a "How to manuals" on our server where we put helpfull hints generally screen grabs and comments in a word doc. Anyway we have a Lisp doc that lists all the lisps and VBA etc in an index and then at least a 1-2 line description including the bold shortcut. I distrubute this to all new staff and make sure they read it. Often remind existing staff to re-read as well. All new program details are emailed to our team and discussed at team meetings.

 

 

Good ideas.

 

Going one step further for all new programs, now that we use Outlook 2007 I utilize (vlax-get-or-create-object "Outlook.Application") for a routine which sends out automated bulletins. (**Using Outlook 2007 or newer prevents the error popup when getting the recipients collection**)

 

I've also included a routine (which I comment out when not needed) that is loaded via an ACADDOC.lsp load statement, which returns whatever data, value, or setting I am interested in of a specified user... the user's (vlax-get-or-create-object "Outlook.Application") will then send me an automated email containing the queried information. Having an Outlook email just makes it simpler (for me) to track which tasks I've not yet addressed. We find this to be less intrusive on production time.

 

When this doesn't work the manual and a 2x4 seems to jog their memory

 

 

... is there anything a 2x4 cannot help one to remember!? :lol:

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