Hello, I want to open a folder with a script.
Hello, I want to open a folder with a script. When the folder is open a wallpaper should be set (a blurred picture). If the folder is closed another wallpaper should be set (same but not blurred). I tried the whole day to write the script but now my brain is Mousse au Chocolat 🙂 .
Can someone help please?
thx
]]>
< ![CDATA[
Is your folder a full-screen one?
]]>
< ![CDATA[
No, the folder slide in from the right of the screen. 240 x 800. I want to change the desktop background not the folder background.
]]>
< ![CDATA[
Yes, I was going to suggest that 😉
Changing the device wallpaper is not a good idea in my opinion. A full-screen item is how I will do it.
Check this script by Lukas Morawietz https://github.com/F43nd1r/DimBackground/blob/master/app/src/main/res/raw/dimbackground.js (it is a github link because the script is packed in an app)
Where it changes the properties of the editor, set the box background.
]]>
< ![CDATA[
Thank you. But this script is the cherry for my mousse (smile) . Maybe i could create an object with a blurred picture with the full screen size 480*800. This object can be set visible true/false on open/close folder.?
]]>
< ![CDATA[
That’s a good idea
]]>
< ![CDATA[
Ok, but how do i open a folder with a script. And if i start an app from the folder , the folder closes, how to make the fullscreen object invisible. I dont understand how i have to use “isVisible()” or “isOpen()”
?
]]>
< ![CDATA[
Use instead the resumed and paused event of the folder itself
The easier way is:
Resumed event: LL.getItemById(??).setVisibility(true);
Paused event:
LL.getItemById(??).setVisibility(false);
]]>
< ![CDATA[
Thank you, i try it tomorrow.
]]>
< ![CDATA[
Hi, cant sleep…
I get an error:
missing ) after argument list
This is the line
LL.getItemById(00003d).
setVisibility(true);
Whats wrong?
]]>
< ![CDATA[
😉
LL.getItemById(0x00003d).
setVisibility(true);
]]>
< ![CDATA[
Wow, thx! It looks great. Is it possible to set a fade in and out for the object with the blurred picture?
]]>
< ![CDATA[
Yes, but you will need a more complex script…like the one in the link 😉
However there is a different way to do that, with bindings.
1) set the resumed event to change a variable to 255
2) set the paused event to set that variable to 0
3) set the alpha binding of the item to
animate(“$thevariable”)
where thevariable is the variable you choose on previous steps
4) set the visibility binding of the item to
animate(“$thevariable”)==0?0:1
Not tested, if it doesn’t work ask
]]>
< ![CDATA[
Hello, i did everything you wrote. The only effect is, my object is invisible. Becomes visible in the editor, after closing the editor it disappears. I have to reload my previous settings (glad to have a backup) . Maybe my fault is the definition of the variable. I set the it like this
var myalpha=”255″
In the bindings
animate(“$myalpha”)
I put the last line in point 4 , exact as you wrote it.
I dont understand why ==0?0:1
]]>
< ![CDATA[
No no, forget about scripts, this is a different thing.
You don’t need to use run a script, you need to use set a variable.
The ==0?0:1 means “is the alpha 0? Then disable the item. It is not? Then enable it.
It is the same as:
if(animate(“$thevariable”)==0) return 0;
else return 1;
]]>
< ![CDATA[
Ok, thx.
Btw, the object with the picture can also set as a transparent color, so i can use it as “backround-dimmer” if a folder is open. Great!
]]>
< ![CDATA[
Where and how must i set the variable?
]]>
< ![CDATA[
Launch a shortcut, lightning launcher, set a variable, write the name of the variable, write the value of the variable
]]>
< ![CDATA[
YES, thank you! Now everything is working. I read the help about bindings. The part how to set the varables. I copied and modified the example.
This works.
var editor = LL.getVariables().edit();
editor.setInteger(“myalpha”, 255);
editor.commit();
Thanks again for your patience 😉
]]>