Template files for developing JavaScript User Tools 2014-09-23 07:49 pm After studying a user tool I downloaded a while ago (mmr.js from Warren Porter), I wanted to try to write a tool myself. So I downloaded a Java Script Editor and started to experiment. After many trials and errors, I decided to first write a template script, that I could use as a starting point for developing a specific tool. When testing it, I discovered the different behaviour of the User Tool Environment, depending of the input type and return format.So I ended up with 3 different templates: 1 for tools with input type 'Clip Text' (and also 'Clip Text' as the only allowed return format), 1 for input type 'File Text' and return format 'File Text' and 1 for input type 'File Text' and Return Format 'Clip Text'.You can find these template files in attachment. (After download, change the extention 'txt' to 'js'.)I used each of these templates to write a user tool, which you will will find in seperate posts.Any comments are welcome.P.S. You can find these tools also on my website http://opagust.wordpress.com Quote Selected Last Edit: 2014-10-03 07:10 am by Opagust
Re: Template files for developing JavaScript User Tools Reply #1 – 2014-09-23 11:19 pm Thank you,will try to make time to check 'em out soon. Quote Selected
Re: Template files for developing JavaScript User Tools Reply #2 – 2014-09-24 02:31 am Quote from: Opagust – 2014-09-23 07:49 pmAfter studying a user tool I downloaded a while ago (mmr.js from Warren Porter), I wanted to try to write a tool myself. So I downloaded a Java Script Editor and started to experiment. Thank you. And I have to thank Rick G for getting me off the ground. Probably the most useful thing I discovered was a way to covert a web page to a js tool with minimal changes to the working part of the script. Browsers have a variety of consoles and debugging tools to quickly identify and fix problems before sharing them with the world. Quote Selected
Re: Template files for developing JavaScript User Tools Reply #3 – 2014-09-24 09:00 am Quote from: Opagust – 2014-09-23 07:49 pmP.S. You can find these tools also on my website http://opagust.wordpress.comHmmm, seems to be a private website and requires a logon and password. Quote Selected
Re: Template files for developing JavaScript User Tools Reply #4 – 2014-09-24 01:51 pm Quote from: Richard Woodroffe – 2014-09-24 09:00 amHmmm, seems to be a private website and requires a logon and password.Oops, didn't know that. I thought the logon and password was only necessary for me writing in it. Found the setting and changed it to public. Should be solved now. Quote Selected
Re: Template files for developing JavaScript User Tools Reply #5 – 2014-10-03 07:11 am I added following function to the templates: GetProp, SetProp, RemoveProp, GetOpt, SetOpt, RemoveOpt Quote Selected
Re: Template files for developing JavaScript User Tools Reply #6 – 2014-10-05 03:10 am This is not quite a "template" but shows how I now create a Javascript user tool. Starting with something like rubato.html I have access to more detailed error messages and debugging tools when working out the problems. I'm showing it here just as a comparison with the .js version. Once done, many things are already in place to convert it to a user tool.Thanks to Rick G for pointing me in the right direction. Quote Selected Last Edit: 2024-04-01 03:48 am by Warren Porter
Re: Template files for developing JavaScript User Tools Reply #7 – 2014-10-05 08:23 am Quote from: Opagust – 2014-10-03 07:11 amI added following function to the templates: GetProp, SetProp, RemoveProp, GetOpt, SetOpt, RemoveOptI discovered some bugs in the new functions SetProp and SetOpt (for operators other then "=") , and also in the function ModPositions (handling accidentals, chords with "pos2" and option "Stem" in Restchords).Updates will follow as soon as possible. Quote Selected Last Edit: 2014-10-06 12:24 pm by Opagust
Re: Template files for developing JavaScript User Tools Reply #8 – 2014-10-09 09:44 am Quote from: Opagust – 2014-10-05 08:23 amUpdates will follow as soon as possible.I corrected the bugs. Furthermore I isolated the common functions in a seperate file 'functions.js' and removed them from the templates. So in the future I won't have to change three templates for 1 change. See attached files (and don't forget to change the extension into 'js' after downloading. Quote Selected Last Edit: 2014-12-06 09:03 am by Opagust
Re: Template files for developing JavaScript User Tools Reply #9 – 2014-10-13 07:26 am I discovered and corrected 2 typos in function GetOpt ('optarry' and 'optary' instead of 'optarray'). Quote Selected Last Edit: 2014-12-06 09:01 am by Opagust
Re: Template files for developing JavaScript User Tools Reply #10 – 2014-12-06 09:04 am I added 2 functions to the tool 'Functions': GetLineProp and SetLineProp, wich I used in my new tool 'MetronomeStaff' (see https://forum.noteworthycomposer.com/?topic=8963.msg63692#msg63692) Quote Selected