[JW Lua] Measurement Units

Jari Williamsson jari.williamsson at mailbox.swipnet.se
Mon Aug 11 23:01:48 CEST 2014


I've now added a code example about Measurement Units to the quick 
script page in the Wiki, since this topic seems like a very 
general-purpose thing.

http://jwmusic.nu/jwplugins/wiki/doku.php?id=jwlua:quickscripts


Best regards,

Jari Williamsson


On 2014-08-11 20:39, Gábor Orth wrote:
> Hi Jari,
>
> My first name is the Gabor! :D
> Thank you for your fast answer, it is  great help for me.
> That you write down is clear for me, thank you again.
>
> yours sincerely
> Gabor
>
>
>
>
> 2014-08-11 20:28 GMT+02:00 Jari Williamsson
> <jari.williamsson at mailbox.swipnet.se
> <mailto:jari.williamsson at mailbox.swipnet.se>>:
>
>     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>
>         <http://www.kottagrafika.hu>
>
>         Számítógépes kottagrafika, kotta archiválás, transzponálás
>
>
>         _________________________________________________
>         JWLua mailing list
>         JWLua at jwmusic.nu <mailto:JWLua at jwmusic.nu>
>         http://jwmusic.nu/mailman/__listinfo/jwlua_jwmusic.nu
>         <http://jwmusic.nu/mailman/listinfo/jwlua_jwmusic.nu>
>
>
>
>
>     _________________________________________________
>     JWLua mailing list
>     JWLua at jwmusic.nu <mailto:JWLua at jwmusic.nu>
>     http://jwmusic.nu/mailman/__listinfo/jwlua_jwmusic.nu
>     <http://jwmusic.nu/mailman/listinfo/jwlua_jwmusic.nu>
>
>
>
>
> --
> 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