Silentdragon
Full Member
if(life==null && wrists) EmoAlert();
Posts: 148 Reputation: 2
34 / / –
Joined: Jun 2006
|
RE: [request] Flashing Keyboard LED's when message received
code: //WML Flash 1.0 for MPL! (Smilie) by ivan300@yahoo.com
// slightly modified by djcarre@gmail.com
var selectiveBlink = 0
var VK_num = 144
var VK_scroll = 145
var VK_caps = 20
var KEYEVENTF_KEYUP = 0x02
var count = 0
function OnEvent_Initialize(bMessengerStart){
}
function OnEvent_Uninitialize(bMessengerExit){
}
//when a chat window is created it starts a timer
function OnEvent_ChatWndCreated(){
MsgPlus.AddTimer('check', 200);
}
function OnEvent_ChatWndReceiveMessage(Wnd, Origin,Message,MessageKind){
if(selectiveBlink == 1) {
var contacts = new Enumerator(Wnd.Contacts);
for (; !contacts.atEnd(); contacts.moveNext())
{
var contact = contacts.item();
switch(contact){
case 'someemail@hotmail.com' :
case 'someemail2@hotmail.com' :
MsgPlus.AddTimer('check',200);
count++;
break;
}
if(count) break;
}
count = 0;
} else
if(Origin != Messenger.MyName)
MsgPlus.AddTimer('check',200);
return Message;
}
//when the chat window is closed it stops the timers and turns the light off
function OnEvent_ChatWndDestroyed(){
MsgPlus.CancelTimer('check');
MsgPlus.CancelTimer('check2');
}
//stops the blining when you type into the convo
//make sure to change VK_scroll accordingly if youre using a different led
function OnEvent_ChatWndEditKeyDown(Wnd, key){
if(key != VK_scroll && key != VK_caps){
MsgPlus.CancelTimer('check');
MsgPlus.CancelTimer('check2');
}
}
//to change which light you want to blink change the
// Vk_scroll to VK_num for num lock or VK_caps for caps lock
//this turns the light off and on depending on the timers
function OnEvent_Timer(sTimerId){
if(sTimerId == 'check'){
//Debug.Trace('check');
Interop.Call('user32', 'keybd_event', VK_scroll, 0, 0, 0);
Interop.Call('user32', 'keybd_event', VK_scroll, 0, 2, 0);
if(!Interop.Call('user32', 'GetKeyState', VK_caps))
MsgPlus.AddTimer('check2', 100);
else {
Interop.Call('user32', 'keybd_event', VK_caps, 0, KEYEVENTF_KEYUP, 0);
Interop.Call('user32', 'keybd_event', VK_caps, 0, 0, 0);
}
}
if(sTimerId == 'check2'){
//Debug.Trace('check2')
Interop.Call('user32', 'keybd_event', VK_scroll, 0, 0, 0);
Interop.Call('user32', 'keybd_event', VK_scroll, 0, KEYEVENTF_KEYUP, 0);
if(!Interop.Call('user32', 'GetKeyState', VK_caps))
MsgPlus.AddTimer('check', 100);
else {
Interop.Call('user32', 'keybd_event', VK_caps, 0, KEYEVENTF_KEYUP, 0);
Interop.Call('user32', 'keybd_event', VK_caps, 0, 0, 0);
}
}
}
Set at the top if you want to have enable selectiving blinking. Set the emails if needed. If Caps Lock is on the script will only blink the scroll once, otherwise it will blink till you press Caps Lock, and it auto disables caps lock after its pressed.
|
|