Hello!
I would like to to write a little script for my PC locker application, that would be able to change the Windows Live Messenger's state to "Away" when the PC is locked by the user. The program should read the lock value (is the pc locked or not atm) from a file, for example an "ini", but a plain text file would be good also (that plain-text is the way I've tried to write that script too).
So could someone help me please?
Thats my (first) script, and as I said before the debugger says "fsObj isn't defined".
The status change function is working anyway.
jscript code:
function OnEvent_Initialize(MessengerStart)
{
addTimer();
Old_Status = 0;
isGone = false;
locked = false;
if (ReadLineFromFile('lockstatus.ini', 1) == "true")
{
// status changing code need to be here...
}
if (locked == false)
{
if (Messenger.MyStatus == STATUS_INVISIBLE)
{
return;
}
Old_Status = Messenger.MyStatus;
Messenger.MyStatus = STATUS_AWAY
isGone = true;
}
}
function addTimer()
{
MsgPlus.AddTimer("Lock",10000);
}
function OnEvent_Uninitialize(MessengerExit)
{
}
function ReadLineFromFile (file, line)
{
var fileObj = fsObj.OpenTextFile(MsgPlus.ScriptFilesPath + '\\' + file, 1);
var lineResult = fileObj.ReadAll();
lineResult = lineResult.split('\r\n');
fileObj.Close();
return lineResult[line];
}
function OnEvent_Timer(timerID){
if(timerID == "Lock")
{
if (locked == false)
{
if (Messenger.MyStatus == STATUS_INVISIBLE)
{
return;
}
Old_Status = Messenger.MyStatus;
Messenger.MyStatus = STATUS_AWAY
isGone = true;
}
}
addTimer();
}