Applescript – Calculate expected cost in two currencies

When you plan your projects with Merlin for Mac, you will find lots of autocalculating columns helping you in accomplishing your goal.

Take the ‘Expected costs‘ column for example. It calculates expected costs by adding automatically expected work costs (due to assignments and resource prices), element costs and  base costs.

The project’s currency is a project setting and can be found or changed in File > Project Settings > General > Financial > Currency Symbol.

Should you need the same costs in an additional currency, you may enable ‘Expected Costs’ in the outline, copy the rows, paste in Excel, Numbers or a similar party application, and let the third party application calculate the costs in a second currency according to the current exchange rate.

However… to those visiting this pages from time to time should not come as a surprise,  that we’ve wrote a script accomplishing this in Merlin. Feel free to use and share as find appropriate 🙂

 

(*     Scripting with Merlin 2

    You may incorporate this ProjectWizards sample code into your program(s) without
    restriction.  This ProjectWizards sample code has been provided "AS IS" and the
    responsibility for its operation is yours.  You are not permitted to
    redistribute this ProjectWizards sample code as "ProjectWizards sample code" after having
    made changes.  If you're going to redistribute the code, we require
    that you make it clear that the code was descended from ProjectWizards sample
    code, but that you've made changes.

    Copyright ® 2013 ProjectWizards, Melle, Germany. All rights reserved.

    This script goes throught all activities of the top most opened project, asks for the project currency, the foreign currency, the exchange rate (proposes a link of a service outputting this information), calculates expected costs based on expected work, element and base costs of each item in the foreign currency, and writes this value in the 'Additional title' column. 

     Applescript restrictions allow this script neither to retrieve for the project's currency, nor define a custom column title to 'Additional title', or define a right alignment of the same column. Those actions are to be done by the Merlin user in the respective dialogues.

    Written by Vicky Stamatopoulou
    For ProjectWizards
    Sept 4, 2013

    Copyright © for the 'Trim' function belongs to the late Jürgen Schell · http://www.j-schell.de

*)

property NeedAProjectMessage : "You must have an open project in order to run this script"

property BaseCurrencyTitle : "Base currency"
property BaseCurrency : "Please select your project's base currency."
property DefaultCurrencyString : "USD"
 Continue reading