ГлавнаяПоддержкаБлог
Главная arrow Исходные тексты arrow default.js/DoAction()
default.js/DoAction()
function DoAction(Action, SourceMessage, SourceFolder, TemplateFile, TemplateBody, NoUserInterface, ArrayParams){

  var ActionEnvironment = new TActionEnvironment();
  with(ActionEnvironment){
    FArrayParams = ArrayParams;
    event = Action;
    NoDisplay = NoUserInterface?true:false;
    om = SourceMessage?SourceMessage:CurrentMessage(ActionEnvironment);
    om = (om&&typeof(om.SafeSenderName)=='undefined')?SafeMailItem(om):om;
    cf = SourceFolder?SourceFolder:CurrentFolder(om);
    ItemType = cf.DefaultItemType;
    if(KeyState[1]&&!NoUserInterface){
      ItemType = olMailItem
    }
    if(TemplateFile||TemplateBody)
      tplInfo = [TemplateBody?TemplateBody:'', TemplateFile?TemplateFile:'']
    else
      tplInfo = GetTemplateForFolder(cf, ActionEnvironment);
    if(!tplInfo) return;
    if(!om)
      if(!(event>=60000000&&event70000000))
        event = bt_new;
    if(event!=bt_new&&om)
      try{ nmInternetCodepage = om.InternetCodepage }catch(e){}

    if(om && om.Class!=olMail)
      func.ShowTip('OMNotMail');
    ApplyParams(ActionEnvironment);

    switch(event){

      case bt_new:                                          // *************************************** bt_new
        if(!NoDisplay) func.ShowTip('UseTemplate');
        var stati = GetDefaultStationery();

        nm  = CreateItem(null, cf, ItemType);

        Params = AskParams(GetParamsFromTemplate(tplInfo), cf, NoDisplay);

        scr1 =  LoadFromFile(GetRegistryKey('ScriptInit'))+'\n'+
                GetSimpleActionScript(tplInfo, 'bef_All_');

        if(func.DebugState>=5)
          eval(scr1)
        else
          try{
            eval(scr1)
          }catch(e){alert(printf(ERR_RunConst, [e.name, e.message, scr1])); nm = null;}

        if(!nm) break;

        module_run(M_EV_TEMPLATE_INIT, null, ActionEnvironment);

        scr = PreParseScr(tplInfo, 'NEW', BodyFormat);
        if(func.DebugState>=5)
          eval(scr)
        else
          try{
            eval(scr)
          }catch(e){alert(printf(ERR_RunTemplate, [e.name, e.message, scr]));nm = null;}

        if(!nm) break;
        var withStationery;

        if(BodyFormat==olFormatHTML&&(nm.Class==olMail||nm.Class==olPost)){
          try{nm.BodyFormat = olFormatHTML;}catch(e){}
          withStationery = GetDefaultStationery()?1:0;
          re = re.replace(new RegExp(CursorStr, 'gi'), TextToCursor);
          if(!withStationery){nm.HTMLBody = re;}
          nm.Fields(CdoPR_HTML_BODY) = nm.HTMLBody // for Outlook XP
        }
        if(BodyFormat==olFormatPlain){
          try{nm.BodyFormat = olFormatPlain;}catch(e){}
          nm.Body = re
          re = nm.Body
          re = re.replace(new RegExp(CursorStr, 'gi'), TextToCursor+CursorStr);
          cursor = GetCursorPos(re);
          re = re.replace(new RegExp(CursorStr, 'gi'), '');
          nm.Body = re;
          if(nm.Class==olMail||nm.Class==olPost)
           nm.Fields(CdoPR_BODY) = nm.Body // for Outlook XP
        }

        if(!NoDisplay){
          nm.Display();

          if(nm.Class==olMail||nm.Class==olPost){
            nm.GetInspector; // 15.06.04
            if(nmInternetCodepage>=0)
             try{nm.InternetCodepage = nmInternetCodepage;}catch(e){}
            SetStationery(stati, 1);
            SetAccount(nm, Account);
            try{
              GotoCursor2(cursor, nm.GetInspector);
            }catch(e){}
          }
        }
      break;

      case bt_reply:                                          // *************************************** bt_reply
        if(!NoDisplay) func.ShowTip('UseTemplate');

        if(om.Class==olMail||om.Class==olPost)
          try{
            nm = SafeMailItem(om.Reply()); AddPluginInfo(nm);
          }catch(e){
            nm = CreateItem(null, cf, ItemType);
            MoveFieldsForReply(nm, om);
//            alert(printf(ERR_Reply, [e.message]),1); return
          }
        else
          nm = CreateItem(null, cf, ItemType);

        Params = AskParams(GetParamsFromTemplate(tplInfo), cf, NoDisplay);

        scr1 = LoadFromFile(GetRegistryKey('ScriptInit'))+'\n'+
               GetSimpleActionScript(tplInfo, 'bef_All_');

        if(func.DebugState>=5)
          eval(scr1)
        else
          try{
            eval(scr1)
          }catch(e){alert(printf(ERR_RunConst, [e.name, e.message, scr1]));nm = null;}

        if(!nm) break;

        module_run(M_EV_TEMPLATE_INIT, null, ActionEnvironment);

        try{
          if(!SubjectNoChange)
            nm.Subject = GenerateSubject(SourceMessagePart(mpSubject), PrefixReply, om, ActionEnvironment);
        }catch(e){}

        if(BodyFormat!=olFormatHTML&&(nm.Class==olMail||nm.Class==olPost)
           &&om.BodyFormat!=olFormatPlain
          ){
          RemoveHiddenAttachment(om, nm);
        }
        if(BodyFormat==olFormatHTML&&(nm.Class==olMail||nm.Class==olPost)){
          var om1  = CreateItem();
          try{om1.BodyFormat = olFormatPlain}catch(e){}

          try{om1.InternetCodepage = om.InternetCodepage;}catch(e){}
          
          if(CheckBodyFormat(om)==olFormatHTML)
            om1.HTMLBody = om.HTMLBody
          else{
            om1.Body = TBQuote(om.Body);
            try{om1.BodyFormat = olFormatHTML}catch(e){}
          }
          if(VersionOutlook()=10||CheckBodyFormat(om)!=olFormatHTML)
            try{om1.InternetCodepage = MainCodePage;}catch(e){}
          HTML_body = om1.HTMLBody;
          if(VersionOutlook()=10||CheckBodyFormat(om)!=olFormatHTML)
            try{nm.InternetCodepage = MainCodePage;}catch(e){}
          try{nm.InternetCodepage = om1.InternetCodepage;}catch(e){}
        }

        scr = PreParseScr(tplInfo, 'REPLY', BodyFormat);

        if(func.DebugState>=1)
          eval(scr)
        else
          try{
            eval(scr)
          }catch(e){alert(printf(ERR_RunTemplate, [e.name, e.message, scr]));nm = null;}

        if(!nm) break;
        if(BodyFormat==olFormatHTML&&(nm.Class==olMail||nm.Class==olPost)){
          try{nm.BodyFormat = olFormatHTML;}catch(e){}
          nm.HTMLBody = (HTML_before+re+HTML_after).replace(new RegExp(CursorStr, 'gi'), TextToCursor);
          nm.Fields(CdoPR_HTML_BODY) = nm.HTMLBody // for Outlook XP
        }else{
          try{nm.BodyFormat = olFormatPlain;}catch(e){}
          nm.Body = re
          re = nm.Body
          re = re.replace(new RegExp(CursorStr, 'gi'), TextToCursor+CursorStr);
          cursor = GetCursorPos(re);
          re = re.replace(new RegExp(CursorStr, 'gi'), '');
          nm.Body = re;
          if(nm.Class==olMail||nm.Class==olPost)
            nm.Fields(CdoPR_BODY) = nm.Body // for Outlook XP
        }

        if(!NoDisplay){
          nm.GetInspector; // 15.06.04
          if(nmInternetCodepage>=0)
            try{nm.InternetCodepage = nmInternetCodepage;}catch(e){}
          nm.Display();

          SetAccount(nm, Account);
          if(VersionOutlook()=10&&EditorPreferences[1]!=1&&BodyFormat==olFormatPlain)
            func.InspectorDelTwoLines(nm.GetInspector);
          GotoCursor2(cursor, nm.GetInspector);
        }
      break;

      case bt_replyall:                                          // *************************************** bt_replyall
        if(!NoDisplay) func.ShowTip('UseTemplate');
        if(om.Class==olMail||om.Class==olPost)
          try{
            nm = SafeMailItem(om.ReplyAll()); AddPluginInfo(nm);
          }catch(e){
            nm = CreateItem(null, cf, ItemType);
            MoveFieldsForReply(nm, om);
//          alert(printf(ERR_Reply, [e.message]),1); return
          }
        else
          nm = CreateItem(null, cf, ItemType);

        Params = AskParams(GetParamsFromTemplate(tplInfo), cf, NoDisplay);

        scr1 = LoadFromFile(GetRegistryKey('ScriptInit'))+'\n'+
               GetSimpleActionScript(tplInfo, 'bef_All_');

        if(func.DebugState>=5)
          eval(scr1)
        else
          try{
            eval(scr1)
          }catch(e){alert(printf(ERR_RunConst, [e.name, e.message, scr1]));nm = null;}

        if(!nm) break;

        module_run(M_EV_TEMPLATE_INIT, null, ActionEnvironment);

        try{
          if(!SubjectNoChange)
            nm.Subject = GenerateSubject(SourceMessagePart(mpSubject), PrefixReplyAll, om, ActionEnvironment);
        }catch(e){}
        
        if(BodyFormat!=olFormatHTML&&(nm.Class==olMail||nm.Class==olPost)
           &&om.BodyFormat!=olFormatPlain
          ){
          RemoveHiddenAttachment(om, nm);
        }
        if(BodyFormat==olFormatHTML&&(nm.Class==olMail||nm.Class==olPost)){
          var om1  = CreateItem();
          try{om1.BodyFormat = olFormatPlain}catch(e){}
          om1.InternetCodepage = om.InternetCodepage
          if(CheckBodyFormat(om)==olFormatHTML){
            om1.HTMLBody = om.HTMLBody
          }else{
            om1.Body = TBQuote(om.Body);
            try{om1.BodyFormat = olFormatHTML}catch(e){}
          }
          if(VersionOutlook()=10||CheckBodyFormat(om)!=olFormatHTML)
            om1.InternetCodepage = MainCodePage;
          HTML_body = om1.HTMLBody;
          if(VersionOutlook()=10||CheckBodyFormat(om)!=olFormatHTML)
            nm.InternetCodepage = MainCodePage;
        }

        scr = PreParseScr(tplInfo, 'REPLYALL', BodyFormat);
        if(func.DebugState>=5)
          eval(scr)
        else
          try{
            eval(scr)
          }catch(e){alert(printf(ERR_RunTemplate, [e.name, e.message, scr]));nm = null;}

        if(!nm) break;
        if(BodyFormat==olFormatHTML&&(nm.Class==olMail||nm.Class==olPost)){
          try{nm.BodyFormat = olFormatHTML;}catch(e){}
          nm.HTMLBody = (HTML_before+re+HTML_after).replace(new RegExp(CursorStr, 'gi'), TextToCursor);
          nm.Fields(CdoPR_HTML_BODY) = nm.HTMLBody // for Outlook XP
        }else{
          try{nm.BodyFormat = olFormatPlain;}catch(e){}
          nm.Body = re
          re = nm.Body
          re = re.replace(new RegExp(CursorStr, 'gi'), TextToCursor+CursorStr);
          cursor = GetCursorPos(re);
          re = re.replace(new RegExp(CursorStr, 'gi'), '');
          nm.Body = re;
          if(nm.Class==olMail||nm.Class==olPost)
            nm.Fields(CdoPR_BODY) = nm.Body // for Outlook XP
        }
        nm.GetInspector; // 15.06.04
        if(nmInternetCodepage>=0)
          try{nm.InternetCodepage = nmInternetCodepage;}catch(e){}

        if(!NoDisplay){
          nm.Display();
          SetAccount(nm, Account);
          if(VersionOutlook()=10&&EditorPreferences[1]!=1&&BodyFormat==olFormatPlain)
            func.InspectorDelTwoLines(nm.GetInspector);
          GotoCursor2(cursor, nm.GetInspector);
        }
      break;

      case bt_forward:                                          // *************************************** bt_forward
        if(!NoDisplay) func.ShowTip('UseTemplate');
        if(om.Class==olMail||om.Class==olPost)
          try{
            nm = SafeMailItem(om.Forward()); AddPluginInfo(nm);
          }catch(e){alert(printf(ERR_Reply, [e.message]),1); return}
        else
          nm = CreateItem(null, cf, ItemType);

        Params = AskParams(GetParamsFromTemplate(tplInfo), cf, NoDisplay);

        scr1 = LoadFromFile(GetRegistryKey('ScriptInit'))+'\n'+
               GetSimpleActionScript(tplInfo, 'bef_All_');

        if(func.DebugState>=5)
          eval(scr1)
        else
          try{
            eval(scr1)
          }catch(e){alert(printf(ERR_RunConst, [e.name, e.message, scr1]));nm = null;}

        if(!nm) break;

        module_run(M_EV_TEMPLATE_INIT, null, ActionEnvironment);

        try{
          if(!SubjectNoChange)
            nm.Subject = GenerateSubject(SourceMessagePart(mpSubject), PrefixForward, om, ActionEnvironment);
        }catch(e){}

        if(BodyFormat==olFormatHTML&&(nm.Class==olMail||nm.Class==olPost)){
          var om1  = CreateItem();
          try{om1.BodyFormat = olFormatPlain}catch(e){}
          om1.InternetCodepage = om.InternetCodepage
          if(CheckBodyFormat(om)==olFormatHTML){
            om1.HTMLBody = om.HTMLBody
          }else{
            om1.Body = om.Body;
            try{om1.BodyFormat = olFormatHTML}catch(e){}
          }
          if(VersionOutlook()=10||CheckBodyFormat(om)!=olFormatHTML)
            om1.InternetCodepage = MainCodePage;
          HTML_body = om1.HTMLBody;
          if(VersionOutlook()=10||CheckBodyFormat(om)!=olFormatHTML)
            nm.InternetCodepage = MainCodePage;
        }

        scr = PreParseScr(tplInfo, 'FORWARD', BodyFormat);
        if(func.DebugState>=5)
          eval(scr)
        else
          try{
            eval(scr)
          }catch(e){alert(printf(ERR_RunTemplate, [e.name, e.message, scr]));nm = null;}

        if(!nm) break;
        if(BodyFormat==olFormatHTML&&(nm.Class==olMail||nm.Class==olPost)){
          try{nm.BodyFormat = olFormatHTML;}catch(e){}
          nm.HTMLBody = re.replace(new RegExp(CursorStr, 'gi'), TextToCursor);
          nm.Fields(CdoPR_HTML_BODY) = nm.HTMLBody // for Outlook XP
        }else{
          try{nm.BodyFormat = olFormatPlain;}catch(e){}
          nm.Body = re
          re = nm.Body
          re = re.replace(new RegExp(CursorStr, 'gi'), TextToCursor+CursorStr);
          cursor = GetCursorPos(re);
          re = re.replace(new RegExp(CursorStr, 'gi'), '');
          nm.Body = re;
          if(nm.Class==olMail||nm.Class==olPost)
            nm.Fields(CdoPR_BODY) = nm.Body // for Outlook XP
        }
        nm.GetInspector; // 15.06.04
        if(nmInternetCodepage>=0)
          try{nm.InternetCodepage = nmInternetCodepage;}catch(e){}

        if(!NoDisplay){
          nm.Display();
          SetAccount(nm, Account);
          if(VersionOutlook()=10&&EditorPreferences[1]!=1&&BodyFormat==olFormatPlain)
            func.InspectorDelTwoLines(nm.GetInspector);
          GotoCursor2(cursor, nm.GetInspector);
        }
      break;

      case bt_redo:                                          // *************************************** bt_redo
        if(!NoDisplay) func.ShowTip('UseTemplate');
        var nm = CreateItem(null, cf, ItemType);

        Params = AskParams(GetParamsFromTemplate(tplInfo), cf, NoDisplay);

        scr1 = LoadFromFile(GetRegistryKey('ScriptInit'))+'\n'+
               GetSimpleActionScript(tplInfo, 'bef_All_');

        if(func.DebugState>=5)
          eval(scr1)
        else
          try{
            eval(scr1)
          }catch(e){alert(printf(ERR_RunConst, [e.name, e.message, scr1]));nm = null;}

        if(!nm) break;

        module_run(M_EV_TEMPLATE_INIT, null, ActionEnvironment);

        try{
          if(!SubjectNoChange)
            nm.Subject = GenerateSubject(SourceMessagePart(mpSubject), PrefixRepost, om, ActionEnvironment);
        }catch(e){}

        if(BodyFormat==olFormatHTML&&(nm.Class==olMail||nm.Class==olPost)){
          var om1  = CreateItem();
          try{om1.BodyFormat = olFormatPlain}catch(e){}
          om1.InternetCodepage = om.InternetCodepage
          if(CheckBodyFormat(om)==olFormatHTML){
            om1.HTMLBody = om.HTMLBody
          }else{
            om1.Body = om.Body;
            try{om1.BodyFormat = olFormatHTML}catch(e){}
          }
          if(VersionOutlook()=10||CheckBodyFormat(om)!=olFormatHTML)
            om1.InternetCodepage = MainCodePage;
          HTML_body = om1.HTMLBody;
          if(VersionOutlook()=10||CheckBodyFormat(om)!=olFormatHTML)
            nm.InternetCodepage = MainCodePage;
        }

        scr = PreParseScr(tplInfo, 'REPOST', BodyFormat);
        if(om.Class==olMail){AssignRecipients(nm, om)}
        if(func.DebugState>=5)
          eval(scr)
        else
          try{
            eval(scr)
          }catch(e){alert(printf(ERR_RunTemplate, [e.name, e.message, scr]));nm = null;}

        if(!nm) break;

        if(BodyFormat==olFormatHTML&&nm.Class==olMail){
          try{nm.BodyFormat = olFormatHTML;}catch(e){}
          nm.HTMLBody = re.replace(new RegExp(CursorStr, 'gi'), TextToCursor);
          nm.Fields(CdoPR_HTML_BODY) = nm.HTMLBody // for Outlook XP
        }else{
          try{nm.BodyFormat = olFormatPlain;}catch(e){}
          nm.Body = re
          re = nm.Body
          re = re.replace(new RegExp(CursorStr, 'gi'), TextToCursor+CursorStr);
          cursor = GetCursorPos(re);
          re = re.replace(new RegExp(CursorStr, 'gi'), '');
          nm.Body = re;
          if(nm.Class==olMail)
            nm.Fields(CdoPR_BODY) = nm.Body // for Outlook XP
        }
        nm.GetInspector; // 15.06.04
        if(nmInternetCodepage>=0){
          try{nm.InternetCodepage = nmInternetCodepage;}catch(e){}
        }
        if(!NoDisplay){
          nm.Display();
          SetAccount(nm, Account);
          GotoCursor2(cursor, nm.GetInspector);
        }
      break;
    } // switch(event)

    if(AfterCommands){
      if(func.DebugState>=5)
        eval(AfterCommands)
      else
        try{
          eval(AfterCommands);
        }catch(e){alert(printf(ERR_RunAfterCommands, [e.name, e.message, AfterCommands]))}
    }

  } // with(ActionEnvironment)
  glob('TextToCursor') = ''
  glob('BodyFormat') = null;
  return(ActionEnvironment)
}

function ValueExists(Mass, Value){
  for(var i=0;iMass.length;i++){
    if(Mass[i]==Value) return(true)
  }
  return(false)
}

function AddItemsToMenu(MenuItem, Regexp, SourceText){
  MenuItem.RemoveChilds();
  var Mas = []
  var List, LineNo;
  while((List = Regexp.exec(SourceText)) != null){
    if(!ValueExists(Mas, List[1])){
      LineNo = -1;
      try{
        LineNo = SourceText.substring(0, List.index).split('\n').length;
      }catch(e){}
      Mas[Mas.length] = [List[1], LineNo];
    }
  }
//  Mas.sort();
  var DoBreak = -1;
  for(var i=0;iMas.length;i++){
    DoBreak++;
    with(MenuItem.Add()){
      Caption = Mas[i][0];
      ID = Mas[i][1]
      if(DoBreak>15){
        Break = 1;
        DoBreak = 0;
      }
    }
  }
}

function ContextMenu(Sender, SourceText){
  var CreateItems = Sender.Count==1;

  var Funcs, Vars;
  if(CreateItems){
    Funcs   = Sender.Add(); Funcs.Caption = TCM_Functions; Funcs.ID = -1;
    Vars    = Sender.Add(); Vars.Caption  = TCM_Variables; Vars.ID = -1;
  }else{
    Funcs = Sender.Items(0);
    Vars  = Sender.Items(1);
  }

  if(!SourceText) return;

  AddItemsToMenu(Funcs, /^.*function\s*(\S+)\s*\{/gim,  SourceText);
  AddItemsToMenu(Vars,  /^.*var\s*(\S+)\s*/gim,         SourceText);

  if(CreateItems)
    Sender.Items(0).Delete();

}


function CreateStartLetter(){
  var Inbox = func.Application.GetNameSpace("MAPI").GetDefaultFolder(olFolderInbox);
  if(!Inbox) return;
  var StartLetter = CreateItem(null, Inbox, Inbox.DefaultItemType);
  if(!StartLetter) return;
  with(StartLetter){

    try{BodyFormat = olFormatPlain}catch(e){}

    var FileName1 = func.Path+'Scr\\Lang\\Add\\Welcome_'+LNG+'.txt';
    var FileName2 = func.Path+'Scr\\Lang\\Add\\Welcome_'+REF_lng+'.txt';
    var BodyMSG = "";
    if(FileExists(FileName1))
      BodyMSG = LoadFromFile(FileName1)
    else
      if(FileExists(FileName2))
        BodyMSG = LoadFromFile(FileName2)
    if(!BodyMSG) return;

    var BodyMSGHeaders = BodyMSG.split('\r\n\r\n').shift().split('\r\n');

    Body = BodyMSG.substr(BodyMSG.indexOf('\r\n\r\n')+4);
    Subject = BodyMSGHeaders[1];
    try{
      Fields(CdoPR_SENDER_NAME) = BodyMSGHeaders[0]
      Fields(CdoPR_SENT_REPRESENTING_NAME) = BodyMSGHeaders[0]
      Fields(CdoPR_SENDER_EMAIL_ADDRESS) = EMAIL_support
      Fields(CdoPR_SENT_REPRESENTING_EMAIL_ADDRESS) = EMAIL_support
      Fields(CdoPR_SENDER_ENTRYID) = 0;
    }catch(e){}
    Fields(CdoPR_BODY) = Body // for Outlook XP
  }
  StartLetter.Save();
  StartLetter.Move(Inbox);
}

function SendKeyEvent(EventID){
  func.SendEvent(EV_ID_BUTTON_CLICK, null, EventID)
}

function GetDefaultHotKeys(){

  glob('DefaultHotKeys') = 
  		 [['idEV_New',		BT_NewMessage,	'Ctrl+N', '', 'SendKeyEvent(bt_new);'],
  		  ['idEV_Reply',	BT_Reply,		'Ctrl+R', '', 'SendKeyEvent(bt_reply);'],
  		  ['idEV_ReplyAll',	BT_ReplyAll,	'Ctrl+O', '', 'SendKeyEvent(bt_replyall);'],
  		  ['idEV_Forward',	BT_Forward,		'Ctrl+F', '', 'if(!glob("MODAL_FORM")){SendKeyEvent(bt_forward);}else{Done = false;};'],
  		  ['idEV_Repost',	BT_Repost,		'Ctrl+P', '', 'SendKeyEvent(bt_redo);'],
  		  ['idEV_Check',	BT_Check,		'F6',	  '', 'SendKeyEvent(bt_Check);'],
  		  ['idEV_CheckEdit',	ACTIONS_AdvCaption,	'Shift+F6',  '', 'func.EditFileScript(GetRegistryKey("ScriptAction"), ACTIONS_AdvCaption);'],
  		  ['idEV_Options',	BT_Options,		'F12',	  '', 'SendKeyEvent(bt_prop);'],
//  		  ['idEV_FolderProp',	MST_Options,	'Ctrl+F12',  '', 'func.FolderProperty();'],
  		  ['idEV_CurrTempl',	PROP_PAGE_EdtCurTempl,'F11',  '', 'SendKeyEvent(bt_templatecurr);']

  		 ];

  glob('EV_HOTKEYS_DATA') = glob('EV_HOTKEYS_DATA').concat(glob('DefaultHotKeys'));
}

function DoDefaultHotKey(){
  var ac = glob('SENDER');
  var DefaultHotKeys = glob('EV_HOTKEYS_DATA'); //glob('DefaultHotKeys');
  for(var i=0;iDefaultHotKeys.length;i++){
    if(DefaultHotKeys[i][0]==ac&&DefaultHotKeys[i][4]){
      var Done = true;
      eval(DefaultHotKeys[i][4]);
      glob('EV_ID_DOHOTKEY_RESULT') = Done?1:0;
    }
  }
}

function ModulesLoadLNGFile(module){
  var lang = glob('CURRENT_LANG');
  var filelng = module.filename.replace(/\\[^\\]+\.js/i, '\\lng\\'+lang+'.js')
  if(!FileExists(filelng)){
   var filelng = module.filename.replace(/\\[^\\]+\.js/i, '\\lng\\'+REF_lng+'.js')
  }
  var scrm = LoadFromFile(filelng);

  var L = [];
  try{
   eval(scrm);
  }catch(e){alert(printf(ERR_RunEvent, [e.name, e.message, scrm]))}
  return(L);
}

function installModule(moduleObj, filename){
  var command = 'install'
  var silent = true;
  try{
    command = moduleObj.WScript.arguments.count()>=1?moduleObj.WScript.arguments(0):null;
    silent  = moduleObj.WScript.arguments.count()>1?(moduleObj.WScript.arguments(1)=='silent'?1:null):null;
  }catch(e){}

  var RegPath = MODULEREG;
  if(!command||command == 'install'){
    var Sh = new ActiveXObject('WScript.Shell');
    var Key = RegPath+moduleObj.name+'\\';
    Sh.RegWrite(Key, moduleObj.WScript.ScriptFullName);
    if(moduleObj.options){
      if(typeof(moduleObj.options)=="object"){
        for(var i=0;imoduleObj.options.length;i++){
          Sh.RegWrite(Key+moduleObj.options[i][0], moduleObj.options[i][1]); // Default params        
        }
      }else{
        Sh.RegWrite(Key+'Options', moduleObj.options); // Default params        
      }  
    }  
    Sh = null;
    if(!silent)
      alert('Module ['+moduleObj.name+'] '+moduleObj.WScript.ScriptFullName+'\n\nINSTALLED\n\nPlease, restart Outlook.', 1)
  }else{
   if(command == 'uninstall'){
     var Sh = new ActiveXObject('WScript.Shell');
     var Key = RegPath+moduleObj.name+'\\';
     try{
      Sh.RegDelete(Key);
     }catch(e){}
     Sh = null;
     if(!silent)
       alert('Module ['+moduleObj.name+'] '+moduleObj.WScript.ScriptFullName+'\n\nREMOVED\n\nPlease, restart Outlook.', 1)
   }else{
     alert('Module ['+moduleObj.name+'] from '+moduleObj.WScript.ScriptFullName+'\n\nInstall:\t'+moduleObj.WScript.ScriptName+' install\nRemove:\t'+moduleObj.WScript.ScriptName+' uninstall\n\n', 1)
   }
  }
}


function ModuleRegRead(module, Key){
  var RegPath = GetReestrPath()+'Modules\\';
  Key = RegPath+module.name+'\\'+Key;
  return(RegRead(Key));
}

function ModuleRegWrite(module, Key, value){
  var RegPath = GetReestrPath()+'Modules\\';
  Key = RegPath+module.name+'\\'+Key;
  RegWrite(Key, value)
}

function RemoveHiddenAttachment(om, nm){
  var newAtt = nm.Attachments;
  var oldAtt = om.Attachments;
  for(var i=newAtt.count;i>0;i--){
    var nAtt = newAtt.item(i);
    for(var j=1;j=oldAtt.count;j++){
      if(nAtt.DisplayName==oldAtt.item(j).DisplayName){
        nAtt.Delete();
        break;
      }
    }
  }
}

function ModuleShowDialog(module, Params, FileName, Path, Width, Height){
  
  var FormDialog = new Form();
  var Hash = FormDialog.object.hash;
  for(key in Params){
    Hash(key) = Params[key];
  }

  var lang = glob('CURRENT_LANG');
  Path = Path?Path:"pages";
  var filen = module.filename.replace(/\\[^\\]+\.js/i, '\\'+Path+'\\'+lang+'\\'+FileName)
  if(!FileExists(filen)){
        var filen = module.filename.replace(/\\[^\\]+\.js/i, '\\'+Path+'\\'+REF_lng+'\\'+FileName)
  }
  var Res = FormDialog.fForm(filen, module.name+' ver '+module.version, Width, Height);
  var Result = []
  Result['RESULT'] = Res;

  var Keys = (new VBArray(Hash.Keys())).toArray();
  for(i in Keys){
    Result[Keys[i]] = Hash(Keys[i]);
  }
  Hash = null;
  FormDialog.Quit();
  FormDialog = null;
  return(Result);
}

 


Загрузить Potolook
 
Плагин Potolook для Microsoft Outlook
Ментальная арифметика для детей
© 2004-2012 Позитик. Все права защищены.

Microsoft®, Outlook® и эмблема Office являются охраняемыми товарными знаками корпорации Майкрософт (Microsoft Corporation) в США и/или других странах.
Копирование и использование материалов разрешается только в случае указания явной гиперссылки на сайт http://www.potolook.ru, как на источник получения информации.

Разработка сайта — "Позитик"

Рейтинг@Mail.ru