* plugin programmer query

Writing and using plugins for Version 5 and above.
Post Reply
User avatar
Ron Melby
Megastar
Posts: 825
Joined: 15 Nov 2016 15:40
Family Historian: V6.2

plugin programmer query

Post by Ron Melby » 19 Jan 2022 00:03

I expect more than one answer but would like all opinions.

If a plugin tool (my profiler) puts out a report, and you give it no default path, where should the output go?
desktop? project folder? plugin data? or elsewhere?
FH V.6.2.7 Win 10 64 bit

User avatar
tatewise
Megastar
Posts: 24422
Joined: 25 May 2010 11:00
Family Historian: V7
Location: Torbay, Devon, UK
Contact:

Re: plugin programmer query

Post by tatewise » 19 Jan 2022 09:47

IMO it depends on who is interested in the report.
If it is the plugin author then the Project's Plugin Data folder seems appropriate.
If it is the plugin end-user then the Project's Public folder may be a better option.
In any case, the path could be an optional setting, and the tool should tell the user where the report has been saved.
Mike Tate ~ researching the Tate and Scott family history ~ tatewise ancestry

avatar
MortimerCat
Newbie
Posts: 4
Joined: 20 Apr 2021 06:59
Family Historian: V7

Re: plugin programmer query

Post by MortimerCat » 26 Jan 2022 08:23

I would like to find reports in a sub-folder within my Documents folder

{HOME}/Documents/{plugin name}/myReport.txt

User avatar
Ron Melby
Megastar
Posts: 825
Joined: 15 Nov 2016 15:40
Family Historian: V6.2

Re: plugin programmer query

Post by Ron Melby » 28 Jan 2022 16:15

Mortimer Cat (I will have a look see, maybe I can incorporate that by parameter and arguement)

I am trying to make the profiler use 'sloppy' arguments and am soliciting any changes for comprehension and readability to the @usage of the program, currently as follows:

@Usage :

(1):
local _prf = require '_prf'

(2):
__prf.start()
prf.start(['call'])
_prf.start(['opcod'])
_prf.start(['opcod',] *choice:(['min'], ['mid'], *default:['max'])])
_prf.start(['opcod',] *range choice:[(1000, 100000}])

--**
dependant on plugin size in bytes, regardless of your choice of arguments, the profiler may choose either ('call') or ('opcod', 'max') as arguments.

<code>

(3):
_prf.stop()

(4):
_prf.report()
_prf.report([folder])
_prf.report(*ordering:['flow'])
_prf.report([folder,] *ordering:['flow'])

--**
only an existing folder argument without a file will be used if provided.
Such as:
'C:/Users/admin/Desktop/' (**which Windows has understood since about 1998)
or
'C:\\Users\\admin\\Desktop\\'
no file name can be provided; it is built in the profiler.
If more than a fully qualified folder name only is provided, or a fully qualified folder name is not correctly provided, or no folder argument is provided, then the default folder will be chosen, ie:
'C:/ProgramData/Calico Pie/Family Historian/Plugin Data/'
adapted for your installation as retrieved by:
fhGetContextInfo('CI_APP_DATA_FOLDER')

the default sorting of the report is time, descending. if you want the report in flow of program use the argument 'flow'
FH V.6.2.7 Win 10 64 bit

User avatar
Ron Melby
Megastar
Posts: 825
Joined: 15 Nov 2016 15:40
Family Historian: V6.2

Re: plugin programmer query

Post by Ron Melby » 30 Jan 2022 16:01

Mortimer Cat you will need to comment line 117 and enable line 118, note that the folder must exist prior to running the profiler. I have path systems file and folder management systems and save and restore systems, but they are a large body and I use them as requires, so I am reticent to do any save and restore of settings, since I do not use chill code but something much more efficient and readable, and incompatible with most plugins that save and restore settings.

such as it is, here it is folks.
Attachments
_prf.fh_lua
(21.76 KiB) Downloaded 23 times
FH V.6.2.7 Win 10 64 bit

Post Reply