For people interested in scripting, I have updated the sample script package with a new reference plugin…
For people interested in scripting, I have updated the sample script package with a new reference plugin implementation for use with V14b6 and later.
The package features a sample counter plugin, with an object oriented approach. I believe it should greatly help in writing plugins and code re-use.
http://www.lightninglauncher.com/scripting/samples/SampleLLXScript-2.0.tar.gz
]]>« V14b6 beta (Previous Post)
(Next Post) Pierre Hébert with the addition of extend() and getMy() items and containers now share a lot of functionality. »
< ![CDATA[
Nice exemple !
What are the available classes in `net.pierrox.lightning_launcher.prefs.*` ?
]]>
< ![CDATA[
They are documented at:
http://www.lightninglauncher.com/scripting/reference/api-beta/reference/net/pierrox/lightning_launcher/prefs/package-summary.html
Basically these are the classes used in Lightning setting screens.
lightninglauncher.com – net.pierrox.lightning_launcher.prefs
]]>
< ![CDATA[
Is “my” a fixed keyword?
]]>
< ![CDATA[
In fact this is the use of the “getMy()” method. Rhino allows the use of properties when it detects getter and setter.
Usually I don’t use this feature and prefer to use the explicit method, but this time I found it was way better this way.
Instead of:
getActiveScreen().getCurrentDesktop().getId()
you could write
activeScreen.currentDesktop.id
Less verbose, but it can be confusing when mixed with functions and custom properties.
]]>
< ![CDATA[
1/ Is there a way to stop a script execution ?
Ex: instead of :
var counter = http://item.my.counter
if (!counter)
{
do_init()
}
Do something like :
var counter = http://item.my.counter
if (counter)
stop_the_script_here()
//else (no need)
do_init()
I like to avoid indentations when there are ways to avoid them.. (make sense ?)
Is it possible ?
]]>
< ![CDATA[
And also :
2/ Instead of :
getEvent().getItem().my.counter.nextValue();
Can we write :
event.item.my.counter.nextValue();
?
]]>
< ![CDATA[
For 1/ use return
For 2/ you can do that for all getters except getEvent() which is not a special function:
getEvent().item.my.counter.nextValue();
]]>
< ![CDATA[
Pierre Hébert 1/ oh yes of course it works, I was thinking about other languages for which it doesn’t work.. My bad, I should stop learning new language ^^
]]>