TextExpander to calculate CD3 Score?

Hi everyone,

Just started listening to Automators and registered - fair to say Automators has already cost me a fortune (TextExpander, Keyboard Maestro etc.) :smiley:

I’m hoping someone can help me out…I’ve just signed up for TextExpander and I am enjoying getting all my snippets created :slight_smile:

I would like to use Text Expander to generate my CD3 score for tasks which come into my Trello board. In theory, I would use a fill-in form to enter a description, Priority (1000, 100, 50 or 10), Size (estimated duration) and business Owner. Text Expander would then calculate the CD3 by dividing the priority by the size and paste them in a nice list like the following:

{Description}

Priority: 1000 (entered via fill-in)
Size: 10 (entered via fill-in)
CD3: 100 (calculated by TextExpander)
Business Owner: Jamie Grant (entered via fill-in)

I have never scripted using AppleScript or JavaScript and wondered if someone could point me in the right direction?

Many thanks,

Jamie

1 Like

Hi Jamie

Since you mentioned Keyboard Maestro is in your tool-belt, I felt free to offer a suggestion using it rather than TextExpander:

I think Keyboard Maestro is the right tool for this job because it has all of the pieces built-in, rather than trying to massage the output from TextExpander.

Here’s the macro I came up with:

The steps are pretty straight-forward:

  • The user is asked to choose a Priority from a dropdown list of 1000, 100, 50, or 10 (1,000 is the default)

  • The user is asked to enter a size (default is 10)

  • The user is asked to enter a Business Owner (defaults to Jamie Grant)

(You can change the defaults, of course, or leave them blank if you don’t want a default.)

Keyboard Maestro then calculates Priority divided by Size and outputs everything like so:

Priority:	1000
Size:		10
CD3:		100
Owner:		Jamie Grant

If your tab settings are the same as mine, the values should make a nice little column. Otherwise you’ll want to make changes in the “Insert Text” block. (There are tabs in there already.)

You can download the macro here (if it displays in your browser instead of downloading, click the “Back” button and then do a right/control-click and ‘Save As…’).

I’ll be happy to try to answer any questions you might have.

1 Like

Wow - thank you so much!! I have switched over to use Keyboard Maestro for doing this and thanks to your script, it’s working perfectly!

Text Expander and Keyboard Maestro is a seriously powerful combination!

Jamie.

1 Like

Here’s how it can be done in TextExpander.

47-Window

Gives this…

53-Window

… with this set-up …

… that utilises this script.

%filltop%

TextExpander.appendOutput("%fillarea:name=Description%\n\n");

let intPriority = %fillpopup:name=Priority:default=1000:100:50:10%;
TextExpander.appendOutput("Priority: " + intPriority + "\n");

let intSize = %filltext:name=Size:default=10%;
TextExpander.appendOutput("Size: " + intSize + "\n");

TextExpander.appendOutput("CD3: " + (intPriority / intSize) + "\n");

TextExpander.appendOutput("Business Owner: %filltext:name=Business Owner:default=Jamie Grant%");

Hope that helps.

This is brilliant - massive thanks to you too!

works like a charm!! I use a combination of mac (for home and business use) and PC for my day job - this works a treat on both…thank you!

Jamie

Hello!
To start with, thank you @sylumer for your excellent advice and very useful help on several places on this forum!! There are many instances where your help solved an issue I was facing, both regarding shortcuts and TextExpander! :smiley:

Now I am facing a challenge that I unfortunately am not able to solve, however. I also use one of your other scripts for TextExpander for calculation (Calculate (BASH)), but I am not that familiar with JavaScript (yet) so I do not know how to adapt the script mentioned in this post on calculation of CD3 score.

I am a teacher in law and am trying to figure out how to summarise the points to an exam directly in TextExpander, see below. We are using a very simple learning plattform and the points have to be written in plain text, otherwise we would use Numbers or Excel.

Questions 1-8: <fill in> points
Question 9:  <fill in> points
Question 10:  <fill in> points
Question 11: <fill in> points
Question 12:  <fill in> points  

Total points:  *here I would need the sum for questions 1-12 fill ins*

I hope there is an easy way to adjust your script? I just don’t know how :pleading_face:
Thank you in advance for any advice you might be able to provide!

Christine

Happy to help people where I can.

Yes there is.

We’ll take the filltop to make things look pretty.

%filltop%

We can then take the size field and replicate it a dozen times with a bit of rewording and by default, set some unique values purely to show the calculation’s working when you test it.

let intSize = %filltext:name=Size:default=10%;
TextExpander.appendOutput("Size: " + intSize + "\n");

Then use the same principle used for the CD3 calculation line.

TextExpander.appendOutput("CD3: " + (intPriority / intSize) + "\n");

That then gives you this; see if you can pick out what I have done from the descriptions above.

%filltop%

let intQ01 = %filltext:name=Question 1:default=2%;
TextExpander.appendOutput("Question 1: " + intQ01 + " points\n");
let intQ02 = %filltext:name=Question 2:default=4%;
TextExpander.appendOutput("Question 2: " + intQ02 + " points\n");
let intQ03 = %filltext:name=Question 3:default=8%;
TextExpander.appendOutput("Question 3: " + intQ03 + " points\n");
let intQ04 = %filltext:name=Question 4:default=16%;
TextExpander.appendOutput("Question 4: " + intQ04 + " points\n");
let intQ05 = %filltext:name=Question 5:default=32%;
TextExpander.appendOutput("Question 5: " + intQ05 + " points\n");
let intQ06 = %filltext:name=Question 6:default=64%;
TextExpander.appendOutput("Question 6: " + intQ06 + " points\n");
let intQ07 = %filltext:name=Question 7:default=128%;
TextExpander.appendOutput("Question 7: " + intQ07 + " points\n");
let intQ08 = %filltext:name=Question 8:default=256%;
TextExpander.appendOutput("Question 8: " + intQ08 + " points\n");
let intQ09 = %filltext:name=Question 9:default=512%;
TextExpander.appendOutput("Question 9: " + intQ09 + " points\n");
let intQ10 = %filltext:name=Question 10:default=1024%;
TextExpander.appendOutput("Question 10: " + intQ10 + " points\n");
let intQ11 = %filltext:name=Question 11:default=2048%;
TextExpander.appendOutput("Question 11: " + intQ11 + " points\n");
let intQ12 = %filltext:name=Question 12:default=4096%;
TextExpander.appendOutput("Question 12: " + intQ12 + " points\n");


TextExpander.appendOutput("\nTotal points: " + (intQ01 + intQ02 + intQ03 + intQ04 + intQ05 + intQ06 + intQ07 + intQ08 + intQ09 + intQ10 + intQ11 + intQ12 ) + "\n");

When I expand this snippet, and leave the values as the defaults, I get the following:

Question 1: 2 points
Question 2: 4 points
Question 3: 8 points
Question 4: 16 points
Question 5: 32 points
Question 6: 64 points
Question 7: 128 points
Question 8: 256 points
Question 9: 512 points
Question 10: 1024 points
Question 11: 2048 points
Question 12: 4096 points

Total points: 8190

Hope the above helps.

As an aside, I would suggest posting as a new topic next time and just linking back to a previous topic if one is relevant. This one’s coming up on it’s first anniversary :wink:

1 Like

Thank you soo much!!! WOW! I will be able to use this in so many instances, especially with your very useful explanations too! I am starting to see the places I can adapt and I will definitely start the JavaScript course that I got on Udemy, it seems it is a very powerful language!

I will also create a new thread next time. I have been following the forum since the podcast started but am quite new with the posting :smiley:

Have a very nice day/evening!
Christine