quote:
Originally posted by Mattike
You should set a variable (like PlusWnd) which gets the return value of MsgPlus.CreateWnd, like:
code:
var PlusWnd = MsgPlus.CreateWnd( 'windows_new.xml', 'Polite', 0 );
Then, you get the line from the file:
code:
var filePath = MsgPlus.ScriptFilesPath + "\\myfile.txt";
var sLine = new ActiveXObject('Scripting.FileSystemObject').GetFile(filePath).OpenAsTextStream(1, -1).ReadLine();
Then, you set the value using SetControlText:
code:
PlusWnd.SetControlText("EdtWelcomeMsg", sLine);
thank you but it is still not clear how i should use that variable is it like this?
code:
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 filePath = MsgPlus.ScriptFilesPath + "\\myfile.txt";
var sLine = new ActiveXObject('Scripting.FileSystemObject').GetFile(filePath).OpenAsTextStream(1, -1).ReadLine();
var PlusWnd = MsgPlus.CreateWnd( 'windows_new.xml', 'Polite', 0 );
PlusWnd.SetControlText("EdtWelcomeMsg", sLine)
break;
}
}
i think actually not
but is it then like this
code:
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=MsgPlus.CreateWnd( 'windows_new.xml', 'Polite', 0 );
break;
}
function readfileandsetdefault()
{
var filePath = MsgPlus.ScriptFilesPath + "\\myfile.txt";
var sLine = new ActiveXObject('Scripting.FileSystemObject').GetFile(filePath).OpenAsTextStream(1, -1).ReadLine();
var PlusWnd = MsgPlus.CreateWnd( 'windows_new.xml', 'Polite', 0 );
PlusWnd.SetControlText("EdtWelcomeMsg", sLine)
}
}