code:
//Global Variables:
var DefWelcomeMsg = "";
var DefGoodbyeMsg = "";
//Functions
function OnEvent_Initialize(MessengerStart) {
var fsObj = new ActiveXObject("Scripting.FileSystemObject");
var fileObj = fsObj.OpenTextFile(MsgPlus.ScriptFilesPath + '\\defwelcomemsg.txt', 1)
DefWelcomeMsg = fileObj.ReadAll();
fileObj.Close();
//Not sure, but I think you could probably reuse the fileObj too.
var fileObj2 = fsObj.OpenTextFile(MsgPlus.ScriptFilesPath + '\\defgoodbyemsg.txt', 1)
DefGoodbyeMsg = fileObj2.ReadAll();
fileObj2.Close();
}
function OnGetScriptMenu(Location) {
var ScriptMenu ="<ScriptMenu>";
ScriptMenu +="<MenuEntry Id=\"window\">Polite Preferences</MenuEntry>";
ScriptMenu +="</ScriptMenu>";
return ScriptMenu;
}
function OnEvent_MenuClicked(MenuId, Location, Wnd) {
switch(MenuId) {
case "window":
var PlusWnd = MsgPlus.CreateWnd( 'windows_new.xml', 'Polite', 0 );
PlusWnd.SetControlText("EdtWelcomeMsg", DefWelcomeMsg)
PlusWnd.SetControlText("EdtGoodbyeMsg", DefGoodbyeMsg)
break;
}
}
function OverwriteFile (file, content) {
var fileObj = new ActiveXObject("Scripting.FileSystemObject").OpenTextFile(MsgPlus.ScriptFilesPath + '\\' + file, 2);
fileObj.write(content);
fileObj.Close();
}
function OnPoliteEvent_CtrlClicked(PlusWnd, CtrlId) {
if(CtrlId == "Btnlol") {
OverwriteFile("defwelcomemsg.txt", PlusWnd.GetControlText("EdtWelcomeMSg"));
OverwriteFile("defgoodbyemsg.txt", PlusWnd.GetControlText("EdtGoodbyeMsg"));
}
}
function OnEvent_Signin(Email) {
var Message = DefWelcomemsg;
MsgPlus.DisplayToast("Hello", Message);
}
function OnEvent_Signout(Email) {
var Message = DefGoodbyemsg;
MsgPlus.DisplayToast("Goodbye", Message);
}
this is my script can you see the ctrlclic on button=btnlol??
that overwrite function doesn;t work plz help me!
debug ouput:
code:
Function called: OnEvent_Signin
Error: 'DefWelcomemsg' is not defined.
Line: 58. Code: -2146823279.
Function OnEvent_Signin returned an error. Code: -2147352567
plz help