So I'm really new to jscript and looking for some input. I've got a script i'm working on that in the end will both lock the computer and set the status to away and the PSM to "I'm not here right now" or something of the sort.
I haven't exactly worked out how I want to do this yet but I'm already coding it. I'm not sure if I can tie this script to a shortcut key or if I can add a button on the WLM interface or create another menu entry on the Messenger Plus Live menu...
Anyway, here is the issue i'm having with my dialog:
I have the simple interface XML created and saved using UTF-16 encoding (little endian).
code:
var Wnd = MsgPlus.CreateWnd("lock.xml", "WndLock")
that fires up the window (for right now as part of the OnEvent_Initialize function)
The dialog is a simple "Lock Computer?" with a 'yes' and 'no' button. Next I have a function setup to handle the clicking of 'yes' and 'no' that looks like this:
code:
function OnWndLockEvent_CtrlClicked(Wnd, ControlId)
{
if(ControlId == "BtnNo")
Wnd.Close(7);
else(ControlId == "BtnYes")
Interop.Call("User32.dll", "LockWorkStation", "", "N");
}
Separately these two statements work just fine. However when you combine them using if/else you get some unwanted behavoir. Run the script and you can click "yes" and it locks the computer, if you click "No" the dialog closes but the computer also locks.
How do you prevent it from running the if and else statements when you click No?
Changing the else to an if on the btnyes section fixed this..
Is that really considered good to to say:
If(blah)
blah
If(blah2)
blah
I've just always been accustomed to doing if/then/else/elseif type of a flow.