Page 1 of 1

Small trick for add-in documentation/help text to appear in _this.display

Posted: Wed May 16, 2018 1:15 am
by mamo
Dear community,

this is just to share with you a minor trick to enhance the documentation of add-ins.

An add-in documentation text file can be made to appear in the own window of the object the add-in is registered to once the user provides a string such as "help" or just "?" as the first argument when calling the add-in from the command line, i.e., "myequation.myaddin ?". See program sniplet below.

Best, mamo

Code: Select all

' ... other parts of the addin programme

%addindoc=@addinspath+"\addindir\addinname.txt"  'path of the add-in documentation text file
%helpargs="help ?"  'one of these strings as first argument would trigger the display of the help text
%tmptxt=_$tmptxt      'name for the temportary text object

%arg1=@word(lower(@trim(%args)), 1)
if @wfind(%helpargs, arg1)  then
   text {%tmptxt}
   {%tmptxt}.append(file) %addindoc
   _this.display {%tmptxt}
   delete {%tmptxt}
   stop
endif   

' ... other parts of the addin programme

Re: Small trick for add-in documentation/help text to appear in _this.display

Posted: Wed Nov 07, 2018 12:43 am
by tvonbrasch
Great idea, really useful.


Here is an alternative way of opening an add-in documentation file. may be useful if the file is in pdf or another file format. it is assumed that the file is located in the same folder as the add-in:

Code: Select all

' ... other parts of the addin programme

   %about="addin_about.pdf"
   if @upper(%0)="HELP" or %0="?" then
      setmaxerrs 10
      %runpath=@runpath
      shell(t=3) {%runpath}\{%about}
      stop
   endif
   
' ... other parts of the addin programme    



Thomas