Create a Simple Fee Calculator app using Automator?

I'm pretty clueless about programming, but I'm otherwise pretty Mac-savvy. With some help, I can usually get the job done.


I'd like to create a convenient little app using Automator to calculate the statutory fee I will charge a client based on the size of their estate/portfolio.


The fee is calculated as follows:


4% of the first $100,000

3% of the next $100,000

2% of the next $800,000

1% of the next $9,000,000

0.5% of the next $15,000,000


So an estate/portfolio worth $450,000 would be charged at 4% of the first $100K ($4,000), plus 3% of the next $100K ($3,000), plus 2% of the next $800K ($5,000 in this example), for a total fee of $12,000.


Ideally I would launch the app, and have it ask "what is the estimated value of the estate?" I would then enter the dollar amount, and the app would run the calculation and generate the result. In an even more ideal situation, it would also show the results of each sub-calculation in addition to the total amount.


I've been trying to figure this out on my own, and I'm stuck. Can anyone help or point me in the right direction?


Thanks!



MacBook

Posted on Mar 11, 2020 2:06 PM

Reply
9 replies

Mar 11, 2020 9:27 PM in response to gsparks

This is the AppleScript version of that magic box where you put in a quarter in (your estate value), and a hand comes out of the box with your fee total. It produces $12000 for a $450,000 estate and $15,000 fee for a $600,000 estate valuation. It is fugly, but it works for these two estate valuation examples. Try it with other amounts which you can enter as $450000, $450,000, or 450000 formats.


Launch the Script Editor from Dock : Launchpad : Other. Copy/paste the following AppleScript into the Script Editor, click the hammer icon (compile), and then run. It will prompt you for the Estate value, and produce an output dialog:



You can initially save the AppleScript source by the first save and format as text to (e.g. esv.applescript). If you press the option key and Save As… you can save it as a double-clickable application (e.g. esv.app) on your Deskop.


The AppleScript code is in the reply to this post as the hosting software restricts how much can be posted at one time.

Mar 11, 2020 4:58 PM in response to Barney-15E

Thanks for the response. Yes, I’m aware I could create a spreadsheet in excel, but I’m looking for a quick, simpler solution than having to launch MS bloatware.


I know Applescript can do the simple arithmetic. It’s the script writing I’m not totally familiar with. Ideally, I’d like an Applescript to run the math, step by step and return results. And save the script as an app that I can quickly launch and just as quickly quit.


I probably could have been more elegant in my hastily written original post.

Mar 12, 2020 4:41 PM in response to gsparks

I know you don't want a spreadsheet but here is a quick non-bloatware Numbers version:



The calculation in the formula shown is that of cell E5.


In addition to total commission it performs and shows the intermediate calculations you wanted.


You did not define commissions > $25 million so it won't work for amounts that exceed it. Decide what to do about that.


I'd prefer to use VikingOSX's magic box too, but until he gets it working you can use the above.

Mar 12, 2020 5:10 PM in response to gsparks

Well, I had some very early successes, and for awhile today, thought I had it working when I was able to enter numbers up to 20,000,000 and get a result that matched calculations. However, as soon as I entered different portfolio values, then the results fell apart; the rule syntax became a quagmire, and I no longer have time to work on this.


So it looks like a spreadsheet solution, which I believe is better suited for this type of application.


The AppleScript has got me annoyed and I may continue to work on this just to conquer it, but don't expect anything soon, or potentially ever.

Mar 12, 2020 5:24 PM in response to gsparks

the rule syntax became a quagmire,


I figured it would.


Stepwise scales like you're proposing just don't lend themselves well to mathematical elegance. They're not logical.


You're better off using a function like f(x) = f(0) * e^rx


I know what you propose is simple and easy for a client to understand, but from a purely mathematical perspective I'd graph what you want to achieve, and find a function that resembles it. But that's me.

This thread has been closed by the system or the community team. You may vote for any posts you find helpful, or search the Community for additional answers.

Create a Simple Fee Calculator app using Automator?

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple Account.