I've made it, now in true 'How to Write a MAKI Script' style, I'm going to try to explain it.
It acts exactly as it reads, if the system active status equals 0 (false, not active) then run the following line of code. The then statment is implyed by the line not having a ';' at the end of it.
the line of code 'MinimizeB.LeftClick();' says find the MinimizeB object, and click the left mouse on it.
So there you have it, a long winded explanation of something you probaly already understood.
Oh and by the way, it's an add-on, and it has no openable containers.
Include the all important std.mi, I've inclosed it in '<' and '>' because that includes it from the compliers path rather than the scripts, that way you only have to remember that one line and not figure out how many folders up you should go.code:
#include
these define every object you use, don't forget the ';' after each line.code:
Global Layout NormalLayout;
Global Button MinimizeB;
Global Timer minTimer;
code:
System.onScriptLoaded(){
Layout NormalLayout = getContainer("main").getLayout("normal");
MinimizeB = NormalLayout.getObject("minimize");
minTimer = new Timer;
minTimer.setDelay(100);
minTimer.start();
}
defines that the events and fuctions between the following '{' and '}' will happen when the script is loaded.code:
System.onScriptLoaded(){
this gets the layout normal in the container main, I could have used:code:
Layout NormalLayout = getContainer("main").getLayout("normal");
But the other way is shorter and sweeter, and gets rid of a Global line.code:
MainContainer = getContainer("main")
Layout NormalLayout = MainContainer.getLayout("normal");
since maki doesn't have a minimize function, this gets a minimize button from a container to use instead. a dummy minimize button looks like this:code:
MinimizeB = NormalLayout.getObject("minimize");
No need for images or x&y, since the button won't be shown in the container anyway.code:
action="minimize"
/>
this is the last peice of the System.onScriptLoaded() event. It sets up a timer, the timer that will be used to check wether winamp is active. It sets the delay to 100 milliseconds and starts the timer. This means it will run every 100 miliseconds.code:
minTimer = new Timer;
minTimer.setDelay(100);
minTimer.start();
}
This is the code that the timer triggers, it is outside the System.onScriptLoaded(), because it is a event of it's own, and it has it's own '{' and '}'.code:
minTimer.onTimer() {
if(System.isAppActive() == 0)
MinimizeB.LeftClick();
}
It acts exactly as it reads, if the system active status equals 0 (false, not active) then run the following line of code. The then statment is implyed by the line not having a ';' at the end of it.
the line of code 'MinimizeB.LeftClick();' says find the MinimizeB object, and click the left mouse on it.
So there you have it, a long winded explanation of something you probaly already understood.
Oh and by the way, it's an add-on, and it has no openable containers.
Comment