[JW Lua] Measurement Units

Jari Williamsson jari.williamsson at mailbox.swipnet.se
Mon Aug 11 20:28:32 CEST 2014


Orth,

(Btw, are you using the Hungarian name order, so Orth is your first name?)

Since Finale only uses EVPUs internally, all other units need to be 
converted to EVPUs. The FCString:GetMeasurement() function can turn a 
measurement string into EVPUs, so a solution could be a wrapper 
function, like in the example below.
The string conversion supports the same measurement suffixes that Finale 
supports (e for EVPUs, c for centimeters, i for inches, etc). Please 
note that it currently only supports '.' as a decimal point.

So if you just write the measurement as a Lua string inside a ToEvpus() 
call you would be able to use it. (The example will print 1134, which 
would be the EVPU equivalent of 10 centimeters.) If the string has no 
suffix, the current default measurement will be assumed.

---
function ToEvpus(text)
     local str = finale.FCString()
     str.LuaString = text
     return str:GetMeasurement(finale.MEASUREMENTUNIT_DEFAULT)
end

print ( ToEvpus("10c") )
---

Best regards,

Jari Williamsson


On 2014-08-11 19:30, Gábor Orth wrote:
>
> Hi Jari,
>
> Firstly, thank you for your  hard work on the Lua language
>
> I able to write a simple, short script, by which I setting the positions
> of the margins on a new score.
> I have just one question.
> Can I set the measurement units (EVPUs, Inches, etc) in the Lua code?
> Or is it will a features of the future?
>
> Sorry for my english! I hope, You understand me!
>
>
> Yours sincerely
>
>
> --
> www.kottagrafika.hu <http://www.kottagrafika.hu>
> Számítógépes kottagrafika, kotta archiválás, transzponálás
>
>
> _______________________________________________
> JWLua mailing list
> JWLua at jwmusic.nu
> http://jwmusic.nu/mailman/listinfo/jwlua_jwmusic.nu
>






More information about the JWLua mailing list