Thumbnails


Enlarge images:
http://www.alvarezeninternet.com/adesktop/sensor1.jpghttp://www.alvarezeninternet.com/adesktop/sensor2.jpgThis project involves both hardware and software. The goal is that MaLa is automatically set up before it starts according to the actual orientation of your TVset or monitor. The way to achieve this is a little crazy (and possibly stupid), but it's easy, cheap and it works flawlessly.
Let us start with the software. The included file sensor.exe must be run before MaLa. If yout frontend is replacing userinit.exe (read the chapter named LOAD ON START), you can add it to the same line, separated by a comma: d:\mala\sensor.exe,d:\mala\mala.exe You may have to edit the .ahk file (scripts source folder) and recompile to fit your folder settings. The script code perform this simple task: check if any of the drives in the computer has the label named SENSOR. If so, it modifies mala.ini setting the value of vertical= and flip= to 1. Otherwise, the setting will be 0.
Hardware. You need a pendrive (the cheapest you can find). Plug it to a USB extension cable (a decent cable with shielding). Make a longitudinal cut near the female end and extract the red wire (power). Cut it. Lengthen each end using two cables. Now, buy a mercury switch and solder its pins to the red cables. Fit the switch inside a little box with the appropriate inclination (tests are necessary). So, when the box is in horizontal position, the circuit is opened and the pendrive is off. When the box is vertical, the mercury inside the switch falls, closes the circuit and the pendrive is powered on. Fit the pendrive and some cable inside the box, and attach it to the top of your monitor. You can see a photo of the result here:
http://www.alvarezeninternet.com/arcadedesktop/sensor.jpg)
Voila! Now we have a digital tilt sensor acting as a switch with a pendrive, which works as a variable for a script that tells MaLa whether the monitor is in vertical or horizontal position. You will never have to manually rotate your layout again.
Possible improvements: make the script load even before the Windows boot screen, so that it can also set the orientation of this image. However, as far as I know, it is impossible to run the program at that point. Anyway, I already have the rotary boot screen script which reads MaLa orientation on exit and sets the boot screen to the next time you restart you system. It is the only solution.
As usually, the binary files and all you need is included in the zip file of my Low Res Mala Layout:
http://www.alvarezeninternet.com/malalayout/This is the code:
#NoTrayIcon
Drives=DEFGHIJKLMNOPQRSTUVWXYZ
Loop, Parse, Drives
{
DriveGet, Var, Label, % A_LoopField ":"
res .= Var "`n"
}
if res contains SENSOR
{
IniWrite, 1, d:\mala\mala.ini, GUI, vertical
IniWrite, 1, d:\mala\mala.ini, GUI, flip
}
else
{
IniWrite, 0, d:\mala\mala.ini, GUI, vertical
IniWrite, 0, d:\mala\mala.ini, GUI, flip
}
exitapp