What happened to the Messenger Plus! forums on msghelp.net?
Shoutbox » MsgHelp Archive » Messenger Plus! for Live Messenger » Scripting » if = true and also executing else

if = true and also executing else
Author: Message:
dfnkt
New Member
*


Posts: 3
Joined: Sep 2010
O.P. if = true and also executing else
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.
09-10-2010 08:47 PM
Profile E-Mail PM Find Quote Report
« Next Oldest Return to Top Next Newest »

Messages In This Thread
if = true and also executing else - by dfnkt on 09-10-2010 at 08:47 PM
RE: if = true and also executing else - by CookieRevised on 09-10-2010 at 10:47 PM
RE: if = true and also executing else - by dfnkt on 09-11-2010 at 04:04 AM
RE: if = true and also executing else - by Matti on 09-11-2010 at 09:19 AM
RE: RE: if = true and also executing else - by dfnkt on 09-11-2010 at 01:48 PM
RE: if = true and also executing else - by Eljay on 09-11-2010 at 02:04 PM


Threaded Mode | Linear Mode
View a Printable Version
Send this Thread to a Friend
Subscribe | Add to Favorites
Rate This Thread:

Forum Jump:

Forum Rules:
You cannot post new threads
You cannot post replies
You cannot post attachments
You can edit your posts
HTML is Off
myCode is On
Smilies are On
[img] Code is On