[ANSWERED]How to change the z-order using a script

Posted on
Sat Dec 28, 2013 2:22 pm
macpro offline
User avatar
Posts: 765
Joined: Dec 29, 2005
Location: Third byte on the right

[ANSWERED]How to change the z-order using a script

I'm working on control panels that will run 24/7 on an iPad mini in a browser.
This means the screen will be on/lit all the time.

To dim the screen I've created a couple of PNG files:
TouchPanel+.png is totally transparent.
TouchPanel+Grey50.png is 50% grey.
TouchPanel+Black.png is 100% black.

The images are 1024 x 768 and I've put a "Variable Value" item on the control page with the highest possible z-order.
When the variable TouchPanel has a value of "Grey50" or "Black", the screen is dimmed or "off".

The "Variable Value" also has a server action that clears the value of the variable "TouchPanel".
This makes the screen visible again, just by tapping somewhere on the screen.

So far so good. But... because this picture is on top of everything else, the other buttons on the control pages no longer work.
That's why I'm looking for a way to change the z-order of a control page item via AppleScript or Python code.
Move it to something like 99999 when I want to dim the screen and move it to 0 when I want the screen to be visible.

Can this be done somehow?
Last edited by macpro on Sat Dec 28, 2013 4:34 pm, edited 1 time in total.

Posted on
Sat Dec 28, 2013 3:30 pm
roussell offline
User avatar
Posts: 1108
Joined: Aug 18, 2008
Location: Alabama

Re: How to change the z-order using a script

Slick idea, I was toying with how to do dim the screen myself and I like your approach. What if the TouchPanel+.png was 1x1 pixels in size rather than full screen - that would only isolate a 1x1 area in the middle of your screen. I think the z-order is best if it can be done, but the above may be a reasonable substitute.

Terry

Posted on
Sat Dec 28, 2013 3:50 pm
macpro offline
User avatar
Posts: 765
Joined: Dec 29, 2005
Location: Third byte on the right

Re: How to change the z-order using a script

Thanks!!!! This works!

I've made TouchPanel+.png a 1x1 pixel and put it in the upper left corner.
When this picture is shown, the screen is in normal mode and all buttons are working.

When I change the variable TouchPanel to "Black", the TouchPanel+Black.png is shown over the entire screen. And it also responds to the server action that clears TouchPanel back to empty. Thus making the screen visible again.

Posted on
Sat Dec 28, 2013 4:08 pm
roussell offline
User avatar
Posts: 1108
Joined: Aug 18, 2008
Location: Alabama

Re: How to change the z-order using a script

Cool, I'm glad you got it working. After I posted I did a search and found a nice app that does similar.

If your iPad is jailbroken - which I highly recommend for a dedicated controller - there are two must-have apps on Cydia.

The first is "Activator" which remaps your home button to do whatever you want it to do - for instance relaunching or switching to Indigo Touch rather than the home screen. You can also remap it to do certain thins when locked, unlocked, etc. and it catches single, double and triple taps and can do different things for each.

The second app is the one I just found - "Dim to black screen". This gets rid of the lock screen and instead after the time out (it uses the regular lock screen selection in settings) dims the screen to about 50% for a few seconds, and then goes completely black. A simple touch of the screen brings back the full brightness, no unlocking necessary.

Both "Activator" and "Dim to Black Screen" are free and available on the Cydia app store for jailbroken devices.

Your method has the added benefit of being able to darken the screen from the server, and using the variable you can tell if someone is actually at a particular touchscreen. The app above actually turns off the backlight which should translate into a longer backlight life over placing a black image onscreen. I've got it running on my iPads now and will report back if anything out of the ordinary occurs.

Disclaimer: I'm sure Matt and Jay do not support the use of jailbroken hardware and the above in no way represents a Perceptive Automation approved course-of-action. My own personal opinion is that Apple has abandoned the iPad 1s and no longer offer SW updates so that makes it fair game. Plus it's my freaking device and I'll do whatever I want with it. 8)

Terry

Posted on
Sat Dec 28, 2013 4:21 pm
macpro offline
User avatar
Posts: 765
Joined: Dec 29, 2005
Location: Third byte on the right

Re: How to change the z-order using a script

I'm not sure if I can jailbreak this iPad. It runs iOS 7 and they are still working on that / just released it?
But I'm planning to stay away from jailbreaks if not needed.

The dim app sounds OK, but has the drawback that it will also dim the screen when people are in the room.

My solution indeed is server controlled, and I've already tied it to the alarm system. When the alarm is set to on, the iPad screen goes to "black" (with the backlite still on, that's true). When the alarm is disarmed, the iPad screen goes into normal mode.

When I press the black screen, the screen returns to normal and a timer starts for 60 seconds. After that, the screen will go back to black. This way I can use the iPad when it's in "dark mode" and it will return to a black screen automatically.

Page 1 of 1

Who is online

Users browsing this forum: No registered users and 8 guests