quote:
Originally posted by whiz
Okay, I've now got this new sign-in code:
code:
...
But whether the script is "enabled" or "disabled" (as set in the script menu), it always comes up! Any ideas?
That's because of the way the menu function you posted earlier was coded.
JScript code:
function OnEvent_MenuClicked(sMenuId)
{
if(sMenuId=="Enable")
{
[b]var[/b] bEnabled = true; var Message = "Toaster has just been enabled!";
Message = MsgPlus.RemoveFormatCodes(Message);
MsgPlus.DisplayToast("Toaster", Message);
Debug.Trace("Toaster | Enable");
}
if(sMenuId=="Disable")
{
[b]var[/b] bEnabled = false; var Message = "Toaster has just been disabled!";
Message = MsgPlus.RemoveFormatCodes(Message);
MsgPlus.DisplayToast("Toaster", Message);
Debug.Trace("Toaster | Disable");
}
}
The bolded var statements redeclare the bEnabled variable as a local variable, so their values aren't saved to the global variable.
In other words; this menu function does not change the script's status in any way.
Remove both bolded "var"s (so the lines say "bEnabled = true/false;") and you should be fine.