AkelPad Forum Index AkelPad
Support forum
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Scripts collection
Goto page Previous  1, 2, 3 ... 8, 9, 10 ... 16, 17, 18  Next
 
Post new topic   Reply to topic    AkelPad Forum Index -> Plugins
View previous topic :: View next topic  
Author Message
KDJ



Joined: 06 Mar 2010
Posts: 1259
Location: Poland

PostPosted: Sun Jan 16, 2011 7:03 pm    Post subject: Reply with quote

Sorts lines according to two keys: by line length and by string, alphabetically or numerically.
Removes duplicate lines.
Reverses the order of lines.

SortLines.js

Code:
// SortLines.js - ver. 2014-04-14 (x86/x64)
//
// Usage:
// Call("Scripts::Main", 1, "SortLines.js")
//
// Shortcut keys in dialog box:
// Enter - Sort
// Esc   - Close
// Shift+Alt+Right (Left, Down, Up, End, Home, PgDn, PgUp) - move dialog box.

if (AkelPad.GetLangId(0 /*LANGID_FULL*/) == 0x0415) //Polish
{
  var sTxtCaption   = "Sortowanie wierszy";
  var sTxtRange     = "Zakres";
  var sTxtFrom      = "Od";
  var sTxtTo        = "Do";
  var sTxtLines     = "Wiersze:";
  var sTxtColumns   = "&Kolumny:";
  var sTxtKeys      = "Klucze sortowania";
  var sTxtKey1      = "Klucz &1 - Długość wiersza";
  var sTxtKey2      = "Klucz &2 - Zawartość wiersza";
  var sTxtEntLine   = "Cały &wiersz";
  var sTxtDesc      = "&Malejąco";
  var sTxtIgCase    = "&Ignoruj wlk. liter";
  var sTxtString    = "&String";
  var sTxtLocale    = "&Alfabetycznie";
  var sTxtNum       = "&Numerycznie";
  var sTxtSortAnd   = "Sortuj, a następnie";
  var sTxtRemoDuKey = "&Usuń wiersze z duplikatami kluczy";
  var sTxtExtrDuKey = "&Zachowaj tylko wiersze z duplikatami kluczy";
  var sTxtExtrUnKey = "Zac&howaj tylko wiersze z unikalnymi kluczami";
  var sTxtNoSort    = "Nie sortuj, ale";
  var sTxtReverse   = "&Odwróć kolejność wierszy";
  var sTxtCopyToCB  = "Wynik kopiuj do schowka, nie zmieniaj &tekstu";
  var sTxtUsePlug   = "Użyj wtyczki &Format";
  var sTxtSort      = "Sortuj";
  var sTxtUndo      = "&Cofnij";
  var sTxtRedo      = "&Powtórz";
  var sTxtNoRangeL  = "Brak zakresu wierszy.";
  var sTxtNoKey2    = "Brak zakresu kolumn w drugim kluczu sortowania.";
}
else
{
  var sTxtCaption   = "Sort lines";
  var sTxtRange     = "Range";
  var sTxtFrom      = "From";
  var sTxtTo        = "To";
  var sTxtLines     = "Lines:";
  var sTxtColumns   = "&Columns:";
  var sTxtKeys      = "Keys";
  var sTxtKey1      = "Key &1 - Line length";
  var sTxtKey2      = "Key &2 - Line content";
  var sTxtEntLine   = "&Entire line";
  var sTxtDesc      = "&Descending";
  var sTxtIgCase    = "&Ignore case";
  var sTxtString    = "&String";
  var sTxtLocale    = "&Alphabetically";
  var sTxtNum       = "&Numerically";
  var sTxtSortAnd   = "Sort, and also";
  var sTxtRemoDuKey = "Re&move lines with duplicate keys";
  var sTxtExtrDuKey = "E&xtract lines with duplicate keys";
  var sTxtExtrUnKey = "Extra&ct lines with unique keys";
  var sTxtNoSort    = "No sort, but";
  var sTxtReverse   = "Reverse &order of lines";
  var sTxtCopyToCB  = "Resul&t copy to clipboard, do not replace text";
  var sTxtUsePlug   = "Use &Format plugin";
  var sTxtSort      = "Sort";
  var sTxtUndo      = "&Undo";
  var sTxtRedo      = "&Redo";
  var sTxtNoRangeL  = "There is no range of lines.";
  var sTxtNoKey2    = "There is no range of columns in second key.";
}

var DT_DWORD    = 3;
var BM_SETCHECK = 241;

var oSys       = AkelPad.SystemFunction();
var hMainWnd   = AkelPad.GetMainWnd();
var hEditWnd   = AkelPad.GetEditWnd();
var hGuiFont   = oSys.Call("Gdi32::GetStockObject", 17 /*DEFAULT_GUI_FONT*/);
var hInstDLL   = AkelPad.GetInstanceDll();
var sClassName = "AkelPad::Scripts::" + WScript.ScriptName + "::" + hInstDLL;
var bKey1      = 0;
var bDescLen   = 0;
var bKey2      = 1;
var bEntLine   = 0;
var bDesc      = 0;
var bIgCase    = 1;
var nMethod    = 1;
var nSortAnd   = 0;
var nNoSort    = 0;
var bCopyToCB  = 0;
var bUsePlug   = 0;
var nUndoLimit = 0;
var nRedoLimit = 0;
var nWordWrap;
var nLastCol;
var hWndDlg;
var lpBuffer;
var bGetSel;
var lpStrA;
var lpStrB;
var bIsReturn;
var hFocus;
var nWndPosX;
var nWndPosY;

ReadWriteIni(0);

var aWnd        = [];
var IDRANGE     = 1000;
var IDFROM      = 1001;
var IDTO        = 1002;
var IDLINES     = 1003;
var IDBEGLINE   = 1004;
var IDENDLINE   = 1005;
var IDSORT1     = 1006;
var IDKEY1      = 1007;
var IDDESCLEN   = 1008;
var IDSORT2     = 1009;
var IDKEY2      = 1010;
var IDENTLINE   = 1011;
var IDFROM2     = 1012;
var IDTO2       = 1013;
var IDCOLUMNS   = 1014;
var IDBEGCOL    = 1015;
var IDENDCOL    = 1016;
var IDDESC      = 1017;
var IDIGCASE    = 1018;
var IDSORT3     = 1019;
var IDSTRING    = 1020;
var IDLOCALE    = 1021;
var IDNUM       = 1022;
var IDSORT4     = 1023;
var IDREMODUKEY = 1024;
var IDEXTRDUKEY = 1025;
var IDEXTRUNKEY = 1026;
var IDNOSORT    = 1027;
var IDREVERSE   = 1028;
var IDREMODULIN = 1029;
var IDEXTRDULIN = 1030;
var IDEXTRUNLIN = 1031;
var IDCOPYTOCB  = 1032;
var IDUSEPLUG   = 1033;
var IDSORT      = 1034;
var IDUNDO      = 1035;
var IDREDO      = 1036;

var CLASS   = 0;
var WND     = 1;
var EXSTYLE = 2;
var STYLE   = 3;
var X       = 4;
var Y       = 5;
var W       = 6;
var H       = 7;
var TXT     = 8;

//0x50000000 - WS_VISIBLE|WS_CHILD
//0x50000007 - WS_VISIBLE|WS_CHILD|BS_GROUPBOX
//0x50000009 - WS_VISIBLE|WS_CHILD|BS_AUTORADIOBUTTON
//0x50010000 - WS_VISIBLE|WS_CHILD|WS_TABSTOP
//0x50010003 - WS_VISIBLE|WS_CHILD|WS_TABSTOP|BS_AUTOCHECKBOX
//0x50012080 - WS_VISIBLE|WS_CHILD|WS_TABSTOP|ES_AUTOHSCROLL|ES_NUMBER
//Windows               CLASS, WND, EXSTYLE,      STYLE,   X,   Y,   W,   H, TXT
aWnd[IDRANGE    ] = ["BUTTON",   0,       0, 0x50000007,  10,  10, 185,  70, sTxtRange];
aWnd[IDFROM     ] = ["STATIC",   0,       0, 0x50000000,  70,  30,  55,  13, sTxtFrom];
aWnd[IDTO       ] = ["STATIC",   0,       0, 0x50000000, 130,  30,  55,  13, sTxtTo];
aWnd[IDLINES    ] = ["STATIC",   0,       0, 0x50000000,  20,  45,  50,  13, sTxtLines];
aWnd[IDBEGLINE  ] = ["STATIC",   0,   0x200, 0x50000000,  70,  45,  55,  20, ""];
aWnd[IDENDLINE  ] = ["STATIC",   0,   0x200, 0x50000000, 130,  45,  55,  20, ""];
aWnd[IDSORT1    ] = ["BUTTON",   0,       0, 0x50000007,  10,  90, 290,  52, sTxtKeys];
aWnd[IDKEY1     ] = ["BUTTON",   0,       0, 0x50010003,  20, 115, 150,  16, sTxtKey1];
aWnd[IDDESCLEN  ] = ["BUTTON",   0,       0, 0x50010003, 205, 115,  90,  16, sTxtDesc];
aWnd[IDSORT2    ] = ["BUTTON",   0,       0, 0x50000007,  10, 135, 290, 130, ""];
aWnd[IDKEY2     ] = ["BUTTON",   0,       0, 0x50010003,  20, 150, 150,  16, sTxtKey2];
aWnd[IDENTLINE  ] = ["BUTTON",   0,       0, 0x50010003,  70, 180, 120,  16, sTxtEntLine];
aWnd[IDFROM2    ] = ["STATIC",   0,       0, 0x50000000,  70, 205,  55,  13, sTxtFrom];
aWnd[IDTO2      ] = ["STATIC",   0,       0, 0x50000000, 130, 205,  55,  13, sTxtTo];
aWnd[IDCOLUMNS  ] = ["STATIC",   0,       0, 0x50000000,  20, 220,  50,  13, sTxtColumns];
aWnd[IDBEGCOL   ] = ["EDIT",     0,   0x200, 0x50012080,  70, 220,  55,  20, ""];
aWnd[IDENDCOL   ] = ["EDIT",     0,   0x200, 0x50012080, 130, 220,  55,  20, ""];
aWnd[IDDESC     ] = ["BUTTON",   0,       0, 0x50010003, 205, 150,  90,  16, sTxtDesc];
aWnd[IDIGCASE   ] = ["BUTTON",   0,       0, 0x50010003, 205, 170,  90,  16, sTxtIgCase];
aWnd[IDSORT3    ] = ["BUTTON",   0,       0, 0x50000007, 195, 185, 105,  80, ""];
aWnd[IDSTRING   ] = ["BUTTON",   0,       0, 0x50000009, 205, 200,  90,  16, sTxtString];
aWnd[IDLOCALE   ] = ["BUTTON",   0,       0, 0x50000009, 205, 220,  90,  16, sTxtLocale];
aWnd[IDNUM      ] = ["BUTTON",   0,       0, 0x50000009, 205, 240,  90,  16, sTxtNum];
aWnd[IDSORT4    ] = ["BUTTON",   0,       0, 0x50000007,  10, 275, 290,  85, sTxtSortAnd];
aWnd[IDREMODUKEY] = ["BUTTON",   0,       0, 0x50010003,  60, 295, 230,  16, sTxtRemoDuKey];
aWnd[IDEXTRDUKEY] = ["BUTTON",   0,       0, 0x50010003,  60, 315, 230,  16, sTxtExtrDuKey];
aWnd[IDEXTRUNKEY] = ["BUTTON",   0,       0, 0x50010003,  60, 335, 230,  16, sTxtExtrUnKey];
aWnd[IDNOSORT   ] = ["BUTTON",   0,       0, 0x50000007,  10, 370, 290, 105, sTxtNoSort];
aWnd[IDREVERSE  ] = ["BUTTON",   0,       0, 0x50010003,  60, 390, 230,  16, sTxtReverse];
aWnd[IDREMODULIN] = ["BUTTON",   0,       0, 0x50010003,  60, 410, 230,  16, sTxtRemoDuKey];
aWnd[IDEXTRDULIN] = ["BUTTON",   0,       0, 0x50010003,  60, 430, 230,  16, sTxtExtrDuKey];
aWnd[IDEXTRUNLIN] = ["BUTTON",   0,       0, 0x50010003,  60, 450, 230,  16, sTxtExtrUnKey];
aWnd[IDCOPYTOCB ] = ["BUTTON",   0,       0, 0x50010003,  20, 485, 270,  16, sTxtCopyToCB];
aWnd[IDUSEPLUG  ] = ["BUTTON",   0,       0, 0x50010003,  20, 505, 270,  16, sTxtUsePlug];
aWnd[IDSORT     ] = ["BUTTON",   0,       0, 0x50010000, 220,  10,  80,  23, sTxtSort];
aWnd[IDUNDO     ] = ["BUTTON",   0,       0, 0x50010000, 220,  35,  80,  23, sTxtUndo];
aWnd[IDREDO     ] = ["BUTTON",   0,       0, 0x50010000, 220,  60,  80,  23, sTxtRedo];

if (hEditWnd)
{
  nWordWrap = AkelPad.SendMessage(hEditWnd, 3241 /*AEM_GETWORDWRAP*/, 0, 0);
  if (nWordWrap > 0) AkelPad.Command(4209 /*IDM_VIEW_WORDWRAP*/);

  if (AkelPad.WindowRegisterClass(sClassName))
  {
    if (lpBuffer = AkelPad.MemAlloc(256 * _TSIZE))
    {
      hWndDlg = oSys.Call("User32::CreateWindowEx" + _TCHAR,
                  0,               //dwExStyle
                  sClassName,      //lpClassName
                  sTxtCaption,     //lpWindowName
                  0x90CA0000,      //WS_VISIBLE|WS_POPUP|WS_CAPTION|WS_SYSMENU|WS_MINIMIZEBOX
                  0,               //x
                  0,               //y
                  315,             //nWidth
                  560,             //nHeight
                  hMainWnd,        //hWndParent
                  0,               //ID
                  hInstDLL,        //hInstance
                  DialogCallback); //Script function callback. To use it class must be registered by WindowRegisterClass.
      if (hWndDlg)
      {
        //Disable main window, to make dialog modal
        oSys.Call("User32::EnableWindow", hMainWnd, false);

        //Message loop
        AkelPad.WindowGetMessage();
      }
      AkelPad.MemFree(lpBuffer);
    }
    AkelPad.WindowUnregisterClass(sClassName);
  }

  if (nWordWrap > 0) AkelPad.Command(4209 /*IDM_VIEW_WORDWRAP*/);
}

function DialogCallback(hWnd, uMsg, wParam, lParam)
{
  var i, nLowParam;

  if (uMsg == 1) //WM_CREATE
  {
    for (i = 1000; i < aWnd.length; ++i)
    {
      aWnd[i][WND] = oSys.Call("User32::CreateWindowEx" + _TCHAR,
                       aWnd[i][EXSTYLE], //dwExStyle
                       aWnd[i][CLASS],   //lpClassName
                       0,                //lpWindowName
                       aWnd[i][STYLE],   //dwStyle
                       aWnd[i][X],       //x
                       aWnd[i][Y],       //y
                       aWnd[i][W],       //nWidth
                       aWnd[i][H],       //nHeight
                       hWnd,             //hWndParent
                       i,                //ID
                       hInstDLL,         //hInstance
                       0);               //lpParam
      SetWindowFontAndText(aWnd[i][WND], hGuiFont, aWnd[i][TXT]);
    }

    GetSelection();
    SetSelection();
    CheckButtons();
    CheckUndoRedo();

    //Set window position
    if ((nWndPosX == undefined) || (nWndPosY == undefined))
      MoveWindow(hMainWnd, hWnd, "RT");
    else
      MoveWindow(hMainWnd, hWnd, [nWndPosX, nWndPosY]);
  }

  else if (uMsg == 7) //WM_SETFOCUS
    oSys.Call("User32::SetFocus", aWnd[IDKEY1][WND]);

  else if (uMsg == 256) //WM_KEYDOWN
  {
    if (wParam == 27) //VK_ESCAPE
      oSys.Call("User32::PostMessage" + _TCHAR, hWndDlg, 16 /*WM_CLOSE*/, 0, 0);
    else if (wParam == 13) //VK_RETURN
    {
      if (! bIsReturn)
      {
        hFocus = oSys.Call("User32::GetFocus");
        if ((hFocus != aWnd[IDSORT][WND]) && (hFocus != aWnd[IDUNDO][WND]) && (hFocus != aWnd[IDREDO][WND]))
          oSys.Call("User32::PostMessage" + _TCHAR, hWnd, 273 /*WM_COMMAND*/, IDSORT, 0);
      }
    }
  }

  else if (uMsg == 257) //WM_KEYUP
    bIsReturn = 0;

  else if ((uMsg == 260) /*WM_SYSKEYDOWN*/ &&
           (oSys.Call("User32::GetAsyncKeyState", 0xA0 /*VK_LSHIFT*/)))
  {
    if (wParam == 0x27) //VK_RIGHT
      MoveWindow(hMainWnd, hWnd, "R");
    else if (wParam == 0x25) //VK_LEFT
      MoveWindow(hMainWnd, hWnd, "L");
    else if (wParam == 0x28) //VK_DOWN
      MoveWindow(hMainWnd, hWnd, "D");
    else if (wParam == 0x26) //VK_UP
      MoveWindow(hMainWnd, hWnd, "U");
    else if (wParam == 0x23) //VK_END
      MoveWindow(hMainWnd, hWnd, "E");
    else if (wParam == 0x24) //VK_HOME
      MoveWindow(hMainWnd, hWnd, "H");
    else if (wParam == 0x22) //VK_NEXT
      MoveWindow(hMainWnd, hWnd, "B");
    else if (wParam == 0x21) //VK_PRIOR
      MoveWindow(hMainWnd, hWnd, "T");
  }

  else if (uMsg == 273) //WM_COMMAND
  {
    nLowParam = LoWord(wParam);

    if ((nLowParam == IDBEGCOL) || (nLowParam == IDENDCOL))
    {
      CheckEditValue(nLowParam);
      if (bGetSel)
        SetSelection();
    }

    else if (((nLowParam >= IDKEY1) && (nLowParam <= IDENTLINE)) ||
             ((nLowParam >= IDDESC) && (nLowParam <= IDUSEPLUG)))
    {
      CheckButtons(nLowParam);
    }

    else if (nLowParam == IDSORT)
    {
      if (SortLines())
      {
        CheckUndoRedo(nLowParam);
        GetSelection();
      }
    }

    else if (nLowParam == IDUNDO)
    {
      bIsReturn = 1;
      CheckUndoRedo(nLowParam);
      GetSelection();
    }

    else if (nLowParam == IDREDO)
    {
      bIsReturn = 1;
      CheckUndoRedo(nLowParam);
      GetSelection();
    }
  }

  else if (uMsg == 16) //WM_CLOSE
  {
    ReadWriteIni(1);

    //Enable main window
    oSys.Call("User32::EnableWindow", hMainWnd, true);
    //Destroy dialog
    oSys.Call("User32::DestroyWindow", hWnd);
  }

  else if (uMsg == 2) //WM_DESTROY
  {
    //Exit message loop
    oSys.Call("User32::PostQuitMessage", 0);
  }

  else
    SetDefID(hWnd);

  return 0;
}

function SetWindowFontAndText(hWnd, hFont, sText)
{
  AkelPad.SendMessage(hWnd, 48 /*WM_SETFONT*/, hFont, true);
  oSys.Call("User32::SetWindowText" + _TCHAR, hWnd, sText);
}

function MoveWindow(hWndParent, hWnd, vAction)
{
  var aRectParent;
  var aRect;
  var nX;
  var nY;

  if (! hWndParent)
    hWndParent=oSys.Call("User32::GetDesktopWindow");

  aRectParent = GetWindowPos(hWndParent);
  aRect       = GetWindowPos(hWnd);

  nX = aRect.left;
  nY = aRect.top;

  if (vAction == "R") //Move right
    nX = aRect.left + ((aRect.left < aRectParent.right - 50) ? 20 : 0);
  else if (vAction == "L") //Move left
    nX = aRect.left - ((aRect.right > aRectParent.left + 50) ? 20 : 0);
  else if (vAction == "D") //Move down
    nY = aRect.top + ((aRect.top < aRectParent.bottom - 50) ? 20 : 0);
  else if (vAction == "U") //Move up
    nY = aRect.top - ((aRect.bottom > aRectParent.top + 50) ? 20 : 0);
  else if (vAction == "E") //Move end (right)
    nX = aRect.left + (aRectParent.right - aRect.right);
  else if (vAction == "H") //Move home (left)
    nX = aRect.left + (aRectParent.left - aRect.left);
  else if (vAction == "B") //Move bottom
    nY = aRect.top + (aRectParent.bottom - aRect.bottom);
  else if (vAction == "T") //Move top
    nY = aRect.top + (aRectParent.top - aRect.top);
  else if (vAction == "C") //Center window
  {
    nX = aRectParent.left + ((aRectParent.right  - aRectParent.left) / 2 - (aRect.right  - aRect.left) / 2);
    nY = aRectParent.top  + ((aRectParent.bottom - aRectParent.top)  / 2 - (aRect.bottom - aRect.top)  / 2);
  }
  else if (vAction == "LT") //Move left top
  {
    nX = aRectParent.left;
    nY = aRectParent.top;
  }
  else if (vAction == "RT") //Move right top
  {
    nX = aRect.left + (aRectParent.right - aRect.right);
    nY = aRectParent.top;
  }
  else if (vAction == "LB") //Move left bottom
  {
    nX = aRectParent.left;
    nY = aRect.top + (aRectParent.bottom - aRect.bottom);
  }
  else if (vAction == "RB") //Move right bottom
  {
    nX = aRect.left + (aRectParent.right - aRect.right);
    nY = aRect.top + (aRectParent.bottom - aRect.bottom);
  }
  else
  {
    nX = vAction[0];
    nY = vAction[1];
  }

  oSys.Call("User32::SetWindowPos", hWnd, 0, nX, nY, 0, 0, 0x15 /*SWP_NOZORDER|SWP_NOACTIVATE|SWP_NOSIZE*/);
}

function GetWindowPos(hWnd)
{
  var lpRect = AkelPad.MemAlloc(16) //sizeof(RECT);
  var aRect  = [];

  oSys.Call("User32::GetWindowRect", hWnd, lpRect);

  aRect.left   = AkelPad.MemRead(lpRect,     DT_DWORD);
  aRect.top    = AkelPad.MemRead(lpRect + 4, DT_DWORD);
  aRect.right  = AkelPad.MemRead(lpRect + 8, DT_DWORD);
  aRect.bottom = AkelPad.MemRead(lpRect +12, DT_DWORD);
  AkelPad.MemFree(lpRect);

  return aRect;
}

function LoWord(nParam)
{
  return (nParam & 0xFFFF);
}

function SetDefID(hWnd)
{
  var nID    = 1000;
  var hFocus = oSys.Call("User32::GetFocus");

  while ((nID < aWnd.length) && (hFocus != aWnd[nID][WND]))
    ++nID;

  if ((nID != IDUNDO) && (nID != IDREDO))
    nID = IDSORT;

  oSys.Call("User32::DefDlgProc" + _TCHAR, hWnd, 1025 /*DM_SETDEFID*/, nID, 0);
}

function ReadWriteIni(bWrite)
{
  var oFSO     = new ActiveXObject("Scripting.FileSystemObject");
  var sIniName = WScript.ScriptFullName.substring(0, WScript.ScriptFullName.lastIndexOf(".")) + ".ini";
  var aRect;
  var oFile;
  var sIniTxt;

  if (bWrite)
  {
    aRect = GetWindowPos(hWndDlg);

    sIniTxt = 'nWndPosX='  + aRect.left + ';\r\n' +
              'nWndPosY='  + aRect.top  + ';\r\n' +
              'bKey1='     + bKey1 + ';\r\n' +
              'bDescLen='  + bDescLen + ';\r\n' +
              'bKey2='     + bKey2 + ';\r\n' +
              'bEntLine='  + bEntLine + ';\r\n' +
              'bDesc='     + bDesc + ';\r\n' +
              'bIgCase='   + bIgCase + ';\r\n' +
              'nMethod='   + nMethod + ';\r\n' +
              'nSortAnd='  + nSortAnd + ';\r\n' +
              'nNoSort='   + nNoSort + ';\r\n' +
              'bCopyToCB=' + bCopyToCB + ';\r\n' +
              'bUsePlug='  + bUsePlug + ';'

    oFile = oFSO.OpenTextFile(sIniName, 2, true, 0);
    oFile.Write(sIniTxt);
    oFile.Close();
  }

  else if (oFSO.FileExists(sIniName))
  {
    try
    {
      eval(AkelPad.ReadFile(sIniName));
    }
    catch (oError)
    {
    }
  }
}

function CheckButtons(nButton)
{
  if ((nButton == IDKEY1) && ((! bKey1) || (bKey2)))
    bKey1 = ! bKey1;
  else if (nButton == IDDESCLEN)
    bDescLen = ! bDescLen;
  else if ((nButton == IDKEY2) && ((! bKey2) || (bKey1)))
    bKey2 = ! bKey2;
  else if (nButton == IDENTLINE)
    bEntLine = ! bEntLine;
  else if (nButton == IDDESC)
    bDesc = ! bDesc;
  else if (nButton == IDIGCASE)
    bIgCase = ! bIgCase;
  else if ((nButton == IDSTRING) || (nButton == IDLOCALE) || (nButton == IDNUM))
    nMethod = nButton - IDSTRING + 1;
  else if ((nButton == IDREMODUKEY) || (nButton == IDEXTRDUKEY) || (nButton == IDEXTRUNKEY))
  {
    if (nSortAnd == nButton - IDREMODUKEY + 1)
      nSortAnd = 0;
    else
      nSortAnd = nButton - IDREMODUKEY + 1;
  }
  else if ((nButton == IDREVERSE)   || (nButton == IDREMODULIN) ||
           (nButton == IDEXTRDULIN) || (nButton == IDEXTRUNLIN))
  {
    if (nNoSort == nButton - IDREVERSE + 1)
      nNoSort = 0;
    else
      nNoSort = nButton - IDREVERSE + 1;
  }
  else if (nButton == IDCOPYTOCB)
    bCopyToCB = ! bCopyToCB;
  else if (nButton == IDUSEPLUG)
    bUsePlug = ! bUsePlug;

  if ((bUsePlug) && ((nNoSort > 1) || (nMethod == 2)))
    nMethod = 1;

  AkelPad.SendMessage(aWnd[IDKEY1][WND],      BM_SETCHECK, bKey1,           0);
  AkelPad.SendMessage(aWnd[IDDESCLEN][WND],   BM_SETCHECK, bDescLen,        0);
  AkelPad.SendMessage(aWnd[IDKEY2][WND],      BM_SETCHECK, bKey2,           0);
  AkelPad.SendMessage(aWnd[IDENTLINE][WND],   BM_SETCHECK, bEntLine,        0);
  AkelPad.SendMessage(aWnd[IDDESC][WND],      BM_SETCHECK, bDesc,           0);
  AkelPad.SendMessage(aWnd[IDIGCASE][WND],    BM_SETCHECK, bIgCase,         0);
  AkelPad.SendMessage(aWnd[IDSTRING][WND],    BM_SETCHECK, (nMethod == 1),  0);
  AkelPad.SendMessage(aWnd[IDLOCALE][WND],    BM_SETCHECK, (nMethod == 2),  0);
  AkelPad.SendMessage(aWnd[IDNUM][WND],       BM_SETCHECK, (nMethod == 3),  0);
  AkelPad.SendMessage(aWnd[IDREMODUKEY][WND], BM_SETCHECK, (nSortAnd == 1), 0);
  AkelPad.SendMessage(aWnd[IDEXTRDUKEY][WND], BM_SETCHECK, (nSortAnd == 2), 0);
  AkelPad.SendMessage(aWnd[IDEXTRUNKEY][WND], BM_SETCHECK, (nSortAnd == 3), 0);
  AkelPad.SendMessage(aWnd[IDREVERSE][WND],   BM_SETCHECK, (nNoSort == 1),  0);
  AkelPad.SendMessage(aWnd[IDREMODULIN][WND], BM_SETCHECK, (nNoSort == 2),  0);
  AkelPad.SendMessage(aWnd[IDEXTRDULIN][WND], BM_SETCHECK, (nNoSort == 3),  0);
  AkelPad.SendMessage(aWnd[IDEXTRUNLIN][WND], BM_SETCHECK, (nNoSort == 4),  0);
  AkelPad.SendMessage(aWnd[IDCOPYTOCB][WND],  BM_SETCHECK, bCopyToCB,       0);
  AkelPad.SendMessage(aWnd[IDUSEPLUG][WND],   BM_SETCHECK, bUsePlug,        0);

  oSys.Call("User32::EnableWindow", aWnd[IDKEY1][WND],      (nNoSort != 1) && (! bUsePlug));
  oSys.Call("User32::EnableWindow", aWnd[IDDESCLEN][WND],   (nNoSort == 0) && bKey1 && (! bUsePlug));
  oSys.Call("User32::EnableWindow", aWnd[IDKEY2][WND],      (nNoSort != 1));
  oSys.Call("User32::EnableWindow", aWnd[IDENTLINE][WND],   (nNoSort != 1) && bKey2);
  oSys.Call("User32::EnableWindow", aWnd[IDFROM2][WND],     (nNoSort != 1) && bKey2 && (! bEntLine));
  oSys.Call("User32::EnableWindow", aWnd[IDTO2][WND],       (nNoSort != 1) && bKey2 && (! bEntLine));
  oSys.Call("User32::EnableWindow", aWnd[IDCOLUMNS][WND],   (nNoSort != 1) && bKey2 && (! bEntLine));
  oSys.Call("User32::EnableWindow", aWnd[IDBEGCOL][WND],    (nNoSort != 1) && bKey2 && (! bEntLine));
  oSys.Call("User32::EnableWindow", aWnd[IDENDCOL][WND],    (nNoSort != 1) && bKey2 && (! bEntLine));
  oSys.Call("User32::EnableWindow", aWnd[IDDESC][WND],      (nNoSort == 0) && bKey2);
  oSys.Call("User32::EnableWindow", aWnd[IDIGCASE][WND],    (nNoSort != 1) && bKey2 && ((nMethod != 3) || bUsePlug));
  oSys.Call("User32::EnableWindow", aWnd[IDSTRING][WND],    (nNoSort != 1) && bKey2);
  oSys.Call("User32::EnableWindow", aWnd[IDLOCALE][WND],    (nNoSort != 1) && bKey2 && (! bUsePlug));
  oSys.Call("User32::EnableWindow", aWnd[IDNUM][WND],       (nNoSort != 1) && bKey2 && (! (bUsePlug && (nNoSort > 1))));
  oSys.Call("User32::EnableWindow", aWnd[IDREMODUKEY][WND], (nNoSort == 0) && (! bUsePlug));
  oSys.Call("User32::EnableWindow", aWnd[IDEXTRDUKEY][WND], (nNoSort == 0) && (! bUsePlug));
  oSys.Call("User32::EnableWindow", aWnd[IDEXTRUNKEY][WND], (nNoSort == 0) && (! bUsePlug));
  oSys.Call("User32::EnableWindow", aWnd[IDCOPYTOCB][WND],  (! bUsePlug));
}

function CheckUndoRedo(nButton)
{
  var nBegSel  = AkelPad.GetSelStart();
  var sTxtUndo = aWnd[IDUNDO][TXT];
  var sTxtRedo = aWnd[IDREDO][TXT];

  if (nButton == IDSORT)
  {
    if (nUndoLimit < AkelPad.SendMessage(hEditWnd, 3084 /*AEM_GETUNDOLIMIT*/, 0, 0))
      ++nUndoLimit;
    nRedoLimit = 0;
  }
  else if ((nButton == IDUNDO) && (nUndoLimit))
  {
    --nUndoLimit;
    ++nRedoLimit;
    AkelPad.SendMessage(hEditWnd, 3077 /*AEM_UNDO*/, 0, 0);
  }
  else if ((nButton == IDREDO) && (nRedoLimit))
  {
    ++nUndoLimit;
    --nRedoLimit;
    AkelPad.SendMessage(hEditWnd, 3078 /*AEM_REDO*/, 0, 0);
    AkelPad.SetSel(nBegSel, AkelPad.GetSelEnd());
  }

  if (nUndoLimit)
    sTxtUndo += " (" + nUndoLimit + ")";
  if (nRedoLimit)
    sTxtRedo += " (" + nRedoLimit + ")";

  if (((oSys.Call("User32::GetFocus") == aWnd[IDUNDO][WND]) && (nUndoLimit == 0)) ||
      ((oSys.Call("User32::GetFocus") == aWnd[IDREDO][WND]) && (nRedoLimit == 0)))
    oSys.Call("User32::SetFocus", aWnd[IDKEY1][WND]);

  SetWindowFontAndText(aWnd[IDUNDO][WND], hGuiFont, sTxtUndo);
  SetWindowFontAndText(aWnd[IDREDO][WND], hGuiFont, sTxtRedo);

  oSys.Call("User32::EnableWindow", aWnd[IDUNDO][WND], nUndoLimit);
  oSys.Call("User32::EnableWindow", aWnd[IDREDO][WND], nRedoLimit);
}

function CheckEditValue(nID)
{
  var pEditValue;

  oSys.Call("User32::GetWindowText" + _TCHAR, aWnd[nID][WND], lpBuffer, 256);
  pEditValue = AkelPad.MemRead(lpBuffer, _TSTR);

  if (pEditValue == 0)
  {
    SetWindowFontAndText(aWnd[nID][WND], hGuiFont, "1");
    AkelPad.SendMessage(aWnd[nID][WND], 177 /*EM_SETSEL*/, 0, -1);
  }
  else if (pEditValue > nLastCol)
  {
    SetWindowFontAndText(aWnd[nID][WND], hGuiFont, String(nLastCol));
    AkelPad.SendMessage(aWnd[nID][WND], 177 /*EM_SETSEL*/, 0, -1);
  }
}

function GetSelection()
{
  var lpBegSel = AkelPad.MemAlloc(_X64 ? 24 : 12 /*sizeof(AECHARINDEX)*/);
  var lpEndSel = AkelPad.MemAlloc(_X64 ? 24 : 12 /*sizeof(AECHARINDEX)*/);
  var nLine1, nLine2, nCol1, nCol2;

  AkelPad.SendMessage(hEditWnd, 3123 /*AEM_EXGETSEL*/, lpBegSel, lpEndSel);

  nLine1 = AkelPad.MemRead(lpBegSel, DT_DWORD) + 1;
  nLine2 = AkelPad.MemRead(lpEndSel, DT_DWORD) + 1;

  if ((nLine1 == nLine2) && (! bGetSel))
  {
    nLine1 = 1;
    nLine2 = AkelPad.SendMessage(hEditWnd, 3129 /*AEM_GETLINENUMBER*/, 0 /*AEGL_LINECOUNT*/, 0);
  }

  nLastCol = LineMaxLength(nLine1, nLine2) + 1;
  SetWindowFontAndText(aWnd[IDBEGLINE][WND], hGuiFont, String(nLine1));
  SetWindowFontAndText(aWnd[IDENDLINE][WND], hGuiFont, String(nLine2));

  if (! bGetSel)
  {
    if (AkelPad.MemRead(lpBegSel + (_X64 ? 16 : 8), DT_DWORD) < AkelPad.MemRead(lpEndSel + (_X64 ? 16 : 8), DT_DWORD))
    {
      nCol1 = AkelPad.MemRead(lpBegSel + (_X64 ? 16 : 8), DT_DWORD) + 1;
      nCol2 = AkelPad.MemRead(lpEndSel + (_X64 ? 16 : 8), DT_DWORD) + 1;
    }
    else
    {
      nCol1 = AkelPad.MemRead(lpEndSel + (_X64 ? 16 : 8), DT_DWORD) + 1;
      nCol2 = AkelPad.MemRead(lpBegSel + (_X64 ? 16 : 8), DT_DWORD) + 1;
    }
 
    if (nCol1 > nLastCol)
      nCol1 = nLastCol;
    if (nCol2 > nLastCol)
      nCol2 = nLastCol;

    SetWindowFontAndText(aWnd[IDBEGCOL][WND],  hGuiFont, String(nCol1));
    SetWindowFontAndText(aWnd[IDENDCOL][WND],  hGuiFont, String(nCol2));
    bEntLine = ! AkelPad.SendMessage(hEditWnd, 3127 /*AEM_GETCOLUMNSEL*/, 0, 0);
  }

  AkelPad.MemFree(lpBegSel);
  AkelPad.MemFree(lpEndSel);
  bGetSel = 1;
}

function LineMaxLength(nLine1, nLine2)
{
  var nMaxLenL = 0;
  var nBegLine;
  var nLenLine;
  var i;

  for (i = nLine1 - 1; i < nLine2; ++i)
  {
    nBegLine = AkelPad.SendMessage(hEditWnd, 187 /*EM_LINEINDEX*/, i, 0);
    nLenLine = AkelPad.SendMessage(hEditWnd, 193 /*EM_LINELENGTH*/, nBegLine, 0);
    if (nLenLine > nMaxLenL)
      nMaxLenL = nLenLine;
  }

  return nMaxLenL;
}

function SetSelection()
{
  var hWndFocus = oSys.Call("User32::GetFocus");
  var lpSelect  = AkelPad.MemAlloc(_X64 ? 56 : 32 /*sizeof(AESELECTION)*/);
  var lpBegSel  = lpSelect;
  var lpEndSel  = lpSelect + (_X64 ? 24 : 12);
  var lpSelFlag = lpSelect + (_X64 ? 48 : 24);
  var nColSel   = 1;
  var nLine1, nLine2, nCol1, nCol2;

  oSys.Call("User32::GetWindowText" + _TCHAR, aWnd[IDBEGLINE][WND], lpBuffer, 256);
  nLine1 = Number(AkelPad.MemRead(lpBuffer, _TSTR)) - 1;
  oSys.Call("User32::GetWindowText" + _TCHAR, aWnd[IDENDLINE][WND], lpBuffer, 256);
  nLine2 = Number(AkelPad.MemRead(lpBuffer, _TSTR)) - 1;

  if ((hWndFocus == aWnd[IDBEGCOL][WND]) || (hWndFocus == aWnd[IDENDCOL][WND]))
  {
    oSys.Call("User32::GetWindowText" + _TCHAR, aWnd[IDBEGCOL][WND], lpBuffer, 256);
    nCol1 = Number(AkelPad.MemRead(lpBuffer, _TSTR)) - 1;
    oSys.Call("User32::GetWindowText" + _TCHAR, aWnd[IDENDCOL][WND], lpBuffer, 256);
    nCol2 = Number(AkelPad.MemRead(lpBuffer, _TSTR)) - 1;
  }
  else
  {
    nCol1   = 0;
    nCol2   = AkelPad.SendMessage(hEditWnd, 193 /*EM_LINELENGTH*/, AkelPad.SendMessage(hEditWnd, 187 /*EM_LINEINDEX*/, nLine2, 0), 0);
    nColSel = 0;
  }

  AkelPad.MemCopy(lpBegSel, nLine1,  DT_DWORD);
  AkelPad.MemCopy(lpBegSel + (_X64 ? 16 : 8), nCol1, DT_DWORD);
  AkelPad.MemCopy(lpEndSel, nLine2,  DT_DWORD);
  AkelPad.MemCopy(lpEndSel + (_X64 ? 16 : 8), nCol2, DT_DWORD);
  AkelPad.MemCopy(lpSelFlag, nColSel, DT_DWORD);

  AkelPad.SendMessage(hEditWnd, 3132 /*AEM_INDEXUPDATE*/, 0, lpBegSel);
  AkelPad.SendMessage(hEditWnd, 3132 /*AEM_INDEXUPDATE*/, 0, lpEndSel);

  AkelPad.SendMessage(hEditWnd, 3126 /*AEM_SETSEL*/, 0, lpSelect);

  AkelPad.MemFree(lpSelect);
}

function SortLines()
{
  var aTxt  = [];
  var sText = "";
  var nLine1;
  var nLine2;
  var nCol1;
  var nCol2;

  oSys.Call("User32::GetWindowText" + _TCHAR, aWnd[IDBEGLINE][WND], lpBuffer, 256);
  nLine1 = Number(AkelPad.MemRead(lpBuffer, _TSTR)) - 1;
  oSys.Call("User32::GetWindowText" + _TCHAR, aWnd[IDENDLINE][WND], lpBuffer, 256);
  nLine2 = Number(AkelPad.MemRead(lpBuffer, _TSTR)) - 1;
  oSys.Call("User32::GetWindowText" + _TCHAR, aWnd[IDBEGCOL][WND], lpBuffer, 256);
  nCol1 = Number(AkelPad.MemRead(lpBuffer, _TSTR)) - 1;
  oSys.Call("User32::GetWindowText" + _TCHAR, aWnd[IDENDCOL][WND], lpBuffer, 256);
  nCol2 = Number(AkelPad.MemRead(lpBuffer, _TSTR)) - 1;

  if (nLine1 == nLine2)
  {
    AkelPad.MessageBox(hWndDlg, sTxtNoRangeL, sTxtCaption, 48 /*MB_ICONEXCLAMATION*/);
    return 0;
  }

  if ((nCol1 == nCol2) && bKey2 && (! bEntLine) && (nNoSort != 1))
  {
    AkelPad.MessageBox(hWndDlg, sTxtNoKey2, sTxtCaption, 48 /*MB_ICONEXCLAMATION*/);
    oSys.Call("User32::SetFocus", aWnd[IDENDCOL][WND]);
    AkelPad.SendMessage(aWnd[IDENDCOL][WND], 177 /*EM_SETSEL*/, 0, -1);
    return 0;
  }

  if (bUsePlug)
  {
    if (! bEntLine)
    {
      oSys.Call("User32::SetFocus", aWnd[IDENDCOL][WND]);
      SetSelection();
    }
    SortByPlugin();
    oSys.Call("User32::SetFocus", aWnd[IDSORT][WND]);
    return 1;
  }

  else
  {
    if (nNoSort == 1)
    {
      aTxt  = AkelPad.GetSelText(1 /*\r*/).split("\r");
      sText = aTxt.reverse().join("\r");
    }

    else
    {
      aTxt.length = 2;
      aTxt[0] = AkelPad.GetSelText(1 /*\r*/).split("\r");
      if (bEntLine)
        aTxt[1] = AkelPad.GetSelText(1 /*\r*/).split("\r");
      else
      {
        aTxt[1] = GetTextRangeColumn([nLine1, nCol1], [nLine2, nCol2]);
      }

      aTxt = ArrayTransp(aTxt);

      ArraySort(aTxt);

      for (i = 0; i < aTxt.length; ++i)
      {
        sText += aTxt[i][0] + "\r";
      }
      sText = sText.slice(0, -1);
    }

    if (bCopyToCB)
    {
      AkelPad.SetClipboardText(sText);
      return 0;
    }
    else
    {
      AkelPad.ReplaceSel(sText, 1);
      return 1;
    }
  }
}

function GetTextRangeColumn(aBeg, aEnd, bReturnText, nNewLine, bFillSpaces)
{
  var nBegLine1;
  var nBegLine2;
  var nLenLine2;
  var nLine1;
  var nLine2;
  var nCol1;
  var nCol2;
  var aLines;
  var nWidth;
  var i;

  if (aBeg[0] < aEnd[0])
  {
    nLine1 = aBeg[0];
    nLine2 = aEnd[0];
  }
  else
  {
    nLine1 = aEnd[0];
    nLine2 = aBeg[0];
  }

  if (aBeg[1] < aEnd[1])
  {
    nCol1 = aBeg[1];
    nCol2 = aEnd[1];
  }
  else
  {
    nCol1 = aEnd[1];
    nCol2 = aBeg[1];
  }

   nBegLine1 = AkelPad.SendMessage(hEditWnd, 187 /*EM_LINEINDEX*/, nLine1, 0);
   nBegLine2 = AkelPad.SendMessage(hEditWnd, 187 /*EM_LINEINDEX*/, nLine2, 0);
   nLenLine2 = AkelPad.SendMessage(hEditWnd, 193 /*EM_LINELENGTH*/, nBegLine2, 0);
  aLines    = AkelPad.GetTextRange(nBegLine1, nBegLine2 + nLenLine2, 1 /*"\r"*/).split("\r");
  nWidth    = nCol2 - nCol1;

  for (i = 0; i < aLines.length; ++i)
  {
    aLines[i] = aLines[i].substring(nCol1, nCol2);
    if (bFillSpaces)
      while (aLines[i].length < nWidth)
        aLines[i] += " ";
  }

  if (bReturnText)
  {
    if ((! nNewLine) || (nNewLine == 1))
      pNewLine = "\r";
    else if (nNewLine == 2)
      pNewLine = "\n";
    else
      pNewLine = "\r\n";

    return aLines.join(pNewLine);
  }
  else
    return aLines;
}

function ArrayTransp(aArr)
{
  var nLen1 = aArr.length;
  var nLen2 = aArr[0].length;
  var aArr2 = [];
  var i, n;

  aArr2.length = nLen2;

  for (n = 0; n < nLen2; ++n)
  {
    aArr2[n] = [];
    for (i = 0; i < nLen1; ++i)
    {
      aArr2[n].push(aArr[i][n]);
    }
  }
  return aArr2;
}

function ArraySort(aTxt)
{
  lpStrA = AkelPad.MemAlloc(nLastCol * _TSIZE);
  lpStrB = AkelPad.MemAlloc(nLastCol * _TSIZE);

  if (nNoSort == 0)
  {
    aTxt.sort(CompareValue);
    RemoveFromArray(aTxt);
  }
  else
    NoSort(aTxt);

  AkelPad.MemFree(lpStrA);
  AkelPad.MemFree(lpStrB);
}

function CompareValue(ValA, ValB)
{
  var nResult = 0;

  if (bKey1)
    if (ValA[0].length > ValB[0].length)
      nResult = bDescLen ? -1 : 1;
    else if (ValA[0].length < ValB[0].length)
      nResult = bDescLen ? 1 : -1;

  if ((bKey2) && (nResult == 0))
  {
    if (nMethod == 1)
    {
      if (bIgCase)
      {
        ValA[1] = ValA[1].toUpperCase();
        ValB[1] = ValB[1].toUpperCase();
      }
      if (ValA[1] > ValB[1])
        nResult = bDesc ? -1 : 1;
      else if (ValA[1] < ValB[1])
        nResult = bDesc ? 1 : -1;
    }
    else if (nMethod == 2)
    {
      AkelPad.MemCopy(lpStrA, ValA[1], _TSTR);
      AkelPad.MemCopy(lpStrB, ValB[1], _TSTR);
      nResult = oSys.Call("Kernel32::lstrcmp" + (bIgCase ? "i" : "") + _TCHAR, lpStrA, lpStrB);
      if (bDesc)
        nResult = -nResult;
    }
    else
    {
      var oRegExp = /(-?\d+\.?\d*)|(-?\.\d+)/;
 
      ValA[1] = oRegExp.exec(ValA[1]);
      ValB[1] = oRegExp.exec(ValB[1]);
      ValA[1] = ValA[1] ? parseFloat(ValA[1][0]) : 0;
      ValB[1] = ValB[1] ? parseFloat(ValB[1][0]) : 0;
      nResult = bDesc ? (ValB[1] - ValA[1]) : (ValA[1] - ValB[1]);
    }
  }

  return nResult;
}

function RemoveFromArray(aTxt)
{
  var i;

  if (nSortAnd == 1)
  {
    for (i = aTxt.length - 1; i > 0; --i)
    {
      if (CompareValue(aTxt[i], aTxt[i - 1]) == 0)
        aTxt.splice(i, 1);
    }
  }

  else if (nSortAnd == 2)
  {
    for (i = aTxt.length - 2; i > 0; --i)
    {
      if ((CompareValue(aTxt[i], aTxt[i + 1]) != 0) && (CompareValue(aTxt[i], aTxt[i - 1]) != 0))
        aTxt.splice(i, 1);
    }
    if ((aTxt.length > 1) && (CompareValue(aTxt[aTxt.length - 1], aTxt[aTxt.length - 2]) != 0))
      aTxt.splice(aTxt.length - 1, 1);
    if ((aTxt.length > 1) && (CompareValue(aTxt[0], aTxt[1]) != 0))
      aTxt.splice(0, 1);
    if (aTxt.length == 1)
      aTxt.splice(0, 1);
  }

  else if (nSortAnd == 3)
  {
    i = aTxt.length - 1;
    while (i > 0)
    {
      if (CompareValue(aTxt[i], aTxt[i - 1]) == 0)
      {
        aTxt.splice(i - 1, 2);
        i -= 2;
      }
      else
        --i;
    }
  }
}

function NoSort(aTxt)
{
  var i, n, bIsDup;

  if (nNoSort == 2)
  {
    for (n = 0; n < aTxt.length; ++n)
    {
      i = n + 1;
      while (i < aTxt.length)
      {
        if (CompareValue(aTxt[i], aTxt[n]) == 0)
          aTxt.splice(i, 1);
        else
          ++i;
      }
    }
  }

  else if (nNoSort == 3)
  {
    n = 0;
    while (n < aTxt.length)
    {
      bIsDup = false;
      for (i = 0; i < aTxt.length; ++i)
      {
        if ((CompareValue(aTxt[i], aTxt[n]) == 0) && (i != n))
        {
          bIsDup = true;
          break;
        }
      }
      if (bIsDup)
        ++n;
      else
        aTxt.splice(n, 1);
    }
  }

  else if (nNoSort == 4)
  {
    n = 0;
    while (n < aTxt.length)
    {
      bIsDup = false;
      i = n + 1;
      while (i < aTxt.length)
      {
        if (CompareValue(aTxt[i], aTxt[n]) == 0)
        {
          bIsDup = true;
          aTxt.splice(i, 1);
        }
        else
          ++i;
      }
      if (bIsDup)
        aTxt.splice(n, 1);
      else
        ++n;
    }
  }
}

function SortByPlugin()
{
  var sAscDesc = bDesc ? "Desc" : "Asc";

  if (nNoSort == 1)
    AkelPad.Call("Format::LineReverse");
  else if (nNoSort == 2)
    AkelPad.Call("Format::LineRemoveDuplicates", ! bIgCase);
  else if (nNoSort == 3)
    AkelPad.Call("Format::LineGetDuplicates", ! bIgCase);
  else if (nNoSort == 4)
    AkelPad.Call("Format::LineGetUnique", ! bIgCase);
  else if (nMethod == 1)
    AkelPad.Call("Format::LineSortStr" + sAscDesc, ! bIgCase);
  else if (nMethod == 3)
    AkelPad.Call("Format::LineSortInt" + sAscDesc, ! bIgCase);
}


Last edited by KDJ on Mon Apr 14, 2014 8:20 pm; edited 11 times in total
Back to top
View user's profile Send private message
Andrey_A_A



Joined: 03 Jun 2010
Posts: 535
Location: Сочи, Хоста

PostPosted: Mon Jan 17, 2011 10:39 pm    Post subject: Reply with quote

SwitchSplittedWindow.vbs

Code:
' SwitchSplittedWindow.vbs
'========================   Описание   =====================================
' Переключение между позициями окна в заданной очерёдностью
'========================  Параметры =====================================
'В параметрах вызова скрипта должен быть прописан один параметр:
' 1 - Переключение горизонтальное --> вертикальное --> четыре части
' 2 - Переключение вертикальное --> горизонтальное --> четыре части
' 3 - Переключение горизонтальное --> четыре части -> вертикальное
' 4 - Переключение вертикальное --> четыре части --> горизонтальное
' 5 - Переключение четыре части --> вертикальное --> горизонтальное
' 6 - Переключение четыре части -- > горизонтальное --> вертикальное
'
' Call("Scripts::Main", 1, "SwitchSplittedWindow.vbs", `"2"`)
'
' Автор:           Аверин Андрей & VladSh
' Версия:          1.4 (2011.01.06 - 18.11.2011)
' Mail:            Averin-And@yandex.ru
' Site:            http://tc-image.3dn.ru/forum/9-412-1196-16-1333816090
' Site:            http://akelpad.sourceforge.net/forum/viewtopic.php?p=11012#11012
'========================================================================
Set WSH = CreateObject("WScript.Shell")

If WScript.Arguments.Count < 1 Then
   Param = 1 'если порядок не задан в аргументах, то по умолчанию работает 1-й вариант: гор -> верт -> 4 части
Else
   Param = CInt(WScript.Arguments(0))
End If

Select Case Param
   Case 1 Call Switch(4214, 4213, 4212)
   Case 2 Call Switch(4213, 4214, 4212)
   Case 3 Call Switch(4214, 4212, 4213)
   Case 4 Call Switch(4213, 4212, 4214)
   Case 5 Call Switch(4212, 4213, 4214)
   Case 6 Call Switch(4212, 4214, 4213)
End Select

Sub Switch(n, m, k)
   Tree = "HKCU\Software\Akelsoft\AkelPad\Plugs\Scripts\SwitchSplittedWindow\"
   Name = GetHandleCurrent()
   If Name = 0 Then
      Call SplitWindow(n) : Call RegWrite(Tree, n)
   Else
      On Error Resume Next
      l = CInt(WSH.RegRead(Tree & Name))
      Select Case l
        Case 0 l = n
        Case n l = m
        Case m l = k
        Case k Call SplitWindow(k) : Call WSH.RegDelete(Tree & Name) : Call WsEnd
      End Select
      Call SplitWindow(l) : Call RegWrite(Tree, l) : Call WsEnd
   End If
End Sub

Function GetHandleCurrent() : GetHandleCurrent = AkelPad.SendMessage(AkelPad.GetEditWnd(), 3447, 0, 0) : End Function
Sub SplitWindow(n) : Call AkelPad.SendMessage(AkelPad.GetMainWnd(), 273, n, 0) : End Sub
Sub RegWrite(Tree, n) : Call WSH.RegWrite(Tree & GetHandleCurrent(), Cstr(n)) : End Sub
Sub WsEnd : Set WSH = Nothing : WScript.Quit : End Sub



А это иконка для скрипта:
SwitchSplittedWindow.b64

Code:
MIME-Version: 1.0
Content-Type: application/octet-stream; name="SwitchWindow.zip"
Content-Transfer-Encoding: base64
Content-Disposition: attachment; filename="SwitchWindow.zip"

UEsDBBQAAgAIAI2ZJj5r+EqoaQIAADYVAAAWAAAAQWtlbFBhZFRvb2xCYXJfNjMyLmljb+1YQU8T
QRR+VbCIhlQFtbWtDcEGEz0Y/wBXEyWevFStJzUxRgViJBpZCm1tJZj4D4BENCZeQI3BHrxw8KBW
arQV2Y3B7smLF4+fb3dbusXdSrfFEt3XfJk37823XyY7+zozRA7aRIEAcRughy6iIBG5XFr/YhPR
G/a7OcZDqIe0uGKCi2yzbUPZ5AlCI6DXt2qTvda4RvpE1UGvT1X8zPSrsdX6a+bZ+rb+f6xf6fu3
qm8J/9D8FRNIWDMa+f5tfVu/HvpW9x9m+otiGp8zKWQzL5GriFTJ/5BS9Y3GKc/JLsyVIacgM4cl
8e1v+tMnCVPFvZmuRpX1e3X9P+3vjhMmjmko+lPcPmI8Mah/L8KEp6ESZk8XWgVnClBiBcyGSijj
nCXM8NgZ9udvdOFVnwfPOPb61kE8P0cYDIcROx+CONy+oj9/yYFcxI/8+CHIST/ku53Ijx2AnPBB
HgsyujgW4FhQzcnJ/cgneDzn8wkv8nEPw43lWAfk+B4sRxkjHfj5+JT6vuVkQP3X+3bviLpu70Qm
8ON+54r+xwHCp+F9kMYPQ4r7IUXZj3ogRnZDGnVD5GeJwk7296pxacQNKeZjeLnv02KjPF7YxZx2
iEM7sHS7DYuDzfhyc1vB34KvQhvkSAu+R1uQue6EffLZGGZc32jzekKvpdxTuAp3FcV7ip6m+s8z
fbUZtcLMHlw+WrHu6vlG57gi3+y8Zqa/mm+2320U32j+ZvxK+Bv6ZvvIWua/3vxq11+teNe/He/7
tiJ9jWv4QCsW+lvZd3LOqeWvODjvRHbIq64cZX7TF7pRnzplkejQuL8AUEsBAhQAFAACAAgAjZkm
Pmv4SqhpAgAANhUAABYAAAAAAAAAAAAgAAAAAAAAAEFrZWxQYWRUb29sQmFyXzYzMi5pY29QSwUG
AAAAAAEAAQBEAAAAnQIAAAAA



Last edited by Andrey_A_A on Thu Sep 13, 2012 2:49 am; edited 5 times in total
Back to top
View user's profile Send private message Send e-mail Visit poster's website
VladSh



Joined: 29 Nov 2006
Posts: 2584
Location: Киев, Русь

PostPosted: Fri Jan 21, 2011 11:46 am    Post subject: Reply with quote

RegJump.js
Code:
///Opens the selected branch in the registry editor
///Открывает выделенную ветвь в редакторе реестра
// если выделения искомой ветви не произошло, значит её не существует
// http://akelpad.sourceforge.net/forum/viewtopic.php?p=11092#11092
// Version: 1.4 (2011.01.21) - 1.9 (2012.04.03) by VladSh
// Version: 1.3 by mozers™ (SciTE)
//
// Понимает записи вида:
//      HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control
//      [HKLM\SYSTEM\CurrentControlSet\Control]   /символы [] обрезаются/
//      HKLM\\SYSTEM\\CurrentControlSet\\Control
//   Предлагаемая комбинация клавиш:   Ctrl+Alt+J

var key = AkelPad.GetSelText();
if (!key)
{      //Если текст не выделен, то будем пытаться получить "ссылку" из текущей строки
   var hWndEdit = AkelPad.GetEditWnd();
   var nPosCurrent = AkelPad.GetSelStart();      //позиция курсора в файле
   
   var oLine = getLine(nPosCurrent);
   var nIndexCurrent = nPosCurrent - oLine.start + 1;      //позиция курсора в строке
   
   key = getKey(oLine.text, nIndexCurrent)      //предварительный поиск ключа, отталкиваясь от позиции курсора
   if (!key)
      key = getKey(oLine.text, -1);      //предварительный поиск ключа - во всей строке
}
else
{
   key = getKey(key, -1);      //предварительный поиск ключа - по выделенному тексту
   if (!key) WScript.Quit();
}
//Проверяем, есть ли что-то похожее на ветку реестра
var posStart = key.indexOf("HK");
if (posStart == -1) WScript.Quit();
key = key.substr(posStart);

var pSlash = "\\";
var procRegEdit = "regedit.exe";
var WshShell = new ActiveXObject("WScript.Shell");

var LastKeyPath = "HKCU\\Software\\Microsoft\\Windows\\CurrentVersion\\Applets\\Regedit\\";
var LastKeyName = LastKeyPath + "Lastkey";      //параметр отдельно от пути, т.к. с помощью Run выделение осуществляется только для каталога
key = key.replace(/^HKLM\\/, "HKEY_LOCAL_MACHINE\\");
key = key.replace(/^HKCR\\/, "HKEY_CLASSES_ROOT\\");
key = key.replace(/^HKCU\\/, "HKEY_CURRENT_USER\\");
key = key.replace(/\\\\/g, pSlash);
key = key.replace(/\[/g, "");      //обрезаем [] (для строки из *.reg-файла)
key = key.replace(/\]/g, "");
key = WshShell.RegRead(LastKeyName).match(/^[^\\]+/) + pSlash + key;

if (key.lastIndexOf(pSlash) == key.length - pSlash.length)
   key = key.substr(0, key.length - pSlash.length);      //обрезаем финальный слэш, если он есть, т.к. с ним не происходит выделения ветки

TaskKill(procRegEdit);      //для "обновления", т.к. иначе перехода на нужную ветку не производится

WshShell.RegWrite(LastKeyName, key, "REG_SZ");
WshShell.Run(procRegEdit, 1, false);


function getLine(nPos)
{
   var line = AkelPad.SendMessage(hWndEdit, 1078 /*EM_EXLINEFROMCHAR*/, 0, nPos);
   var index = AkelPad.SendMessage(hWndEdit, 187 /*EM_LINEINDEX*/, line, 0);
   var len = AkelPad.SendMessage(hWndEdit, 193 /*EM_LINELENGTH*/, index, 0);
   var text = AkelPad.GetTextRange(index, index + len);
   
   return {
      text: text,
      start: index,
      len: len
   };
}

///Поиск ключа по границам, иначе берём всю переданную строку, т.к. возможно текст выделен правильно, без ограничителей
function getKey(pText, nIndex)
{
   var key = getBlock(pText, nIndex, '[', ']');      //ищём внутри []
   if (!key)
   {
      key = getBlock(pText, nIndex, '"', '"');      //иначе ищём внутри ""
      if (!key)
         key = getBlock(pText, nIndex, "'", "'");      //иначе ищём внутри ''
         if (!key)
            key = pText;      //берём всю переданную строку
   }
   return key;
}

function getBlock(pText, nPos, pTextStart, pTextEnd)      //если в nPos передано -1, то искать во всей строке
{
   var pBlock = "";
   var nLbound;
   var nUbound;
   if (nPos != -1)
   {
      nLbound = nPos;
      nUbound = nPos;
   }
   else
   {
      nLbound = pTextStart.length + 1;
      nUbound = pText.length - pTextEnd.length - 1;
   }
   
   var posTextStart = pText.lastIndexOf(pTextStart, nUbound);               //Ищем вверх
   if (posTextStart != -1)
   {
      var posTextEnd = pText.indexOf(pTextEnd, nLbound);                     //Ищем вниз
      if (posTextEnd != -1)
      {
         posTextStart += 1;
         if (posTextStart < posTextEnd)
            pBlock = pText.substring(posTextStart, posTextEnd);
         else
            pBlock = pText.substring(posTextEnd + pTextStart.length, posTextStart - pTextEnd.length);
      }
   }
   return pBlock;
}

function TaskKill(process_name)
{
   var objWMIService = GetObject("winmgmts:\\\\.\\root\\CIMV2");
   var colProcessList = objWMIService.ExecQuery ('SELECT * FROM Win32_Process WHERE NAME = "' + process_name + '"');
   var enumItems = new Enumerator(colProcessList);
   for (; !enumItems.atEnd(); enumItems.moveNext())
      enumItems.item().Terminate();
}

Алгоритм:
1. Если есть выделение, то берётся чисто выделение; пробелы в конце не обрезаются, т.к. кроме пробелов там может быть любые символы...;
2. Если нет выделения, тогда:
- отталкиваемся от позиции курсора (считаем, что он установлен внутри [] или "");
- если ничего не найдено, то берём всю строку и берём текст внутри крайних [] или "";
3. Если в строке нет символов, в которые может быть заключён путь. то предполагаем, что это просто текстовый файл, поэтому берём строку с символов "HK" и пытаемся открыть; если этих символов - выходим, т.к. это не ветка реестра.

Из этого следует несколько вариантов работы скрипта (для пользователя):
- по выделению (путь должен быть чётко выделен);
- по позиции курсора внутри пути (самый частый и простой способ);
- из всей строки, в которой установлен курсор (в этом случае пользователь соглашается с тем, что текст между крайними [] или "" считается путём, т.е. корректно скрипт будет работать, если в текущей строке пара вышеуказанных символов встречается 1 раз); этот способ подходит для больших строк (трудно такое придумать чтобы курсором тяжело было попасть, но... пусть будет).

Благодарности: mozers™, KDJ.


Last edited by VladSh on Tue Apr 03, 2012 8:44 am; edited 10 times in total
Back to top
View user's profile Send private message Visit poster's website
Infocatcher



Joined: 06 Aug 2007
Posts: 1559

PostPosted: Fri Jan 21, 2011 5:04 pm    Post subject: Reply with quote

converter.js <download | mirror | development version>
  • Encode/decode HTML entities
  • Convert JavaScript escape sequences like "\u00a9" or "\xa9" («©» symbol)
  • Escape/unescape special RegExp symbols
  • Escape/unescape special strings symbols
  • Encode/decode Uniform Resource Identifiers (URIs)
  • Hexadecimal escape/unescape
  • Base64 encode/decode
  • Convert charset
Screenshots



Post size limit, here is packed file:
converter.uue
Code:
begin 644 converter.7z
M-WJ\KR<<``.HZG7P&D8```````!<`````````!=$&[D`[LE:?)>33YH2@TWR
M(;WKVJUXJJ*B"04_K@!::<9IE?2WH1?3?.EDNN)25?R\<$?`C_]1:(L(1:@%
MTR2Z=D`3:B<U.<R*S.?7PE>+76+]YM7@%S'@XR3J:19R!90=/691(=1`[NF5
MS*9.N+&]E8SIZ7DQL3G-3CBI_W_9E7*'H'ONWYOYD@(.Y.$[$=,;*T\O@=Z.
MXX!!VB@23Y[.>\(F52EF_09$BKEZUA0E'1(;&]^Z/E/XI<WY'>Y(.HYNLC2N
MY*N4>*RZ*W3E[GDTQ#EP+X!P]3W[<MEMV;O7`'_,1<E.U6?$F=74HI\A@RF%
M0E3Y0D969FC0*[&:1$/CS4Z=,XL,HR^WN$L]I&@:=M7K5JL]]3X=E:9=]*!/
ML6%>&?MX]J)FM9LZCYH#^<04.=Q%/4!W7GTD[^2EC1UY;TZ0S=KUQ#M+3Y1,
M>4P'@)2.S2PA'O87/?MVSM)1_Q0A16XI>`7@4JFQ;Q672)0.#Y=A(\$[`"$'
M),0XA)"%Z)S7[!@Q]H!'WVDYL5M-N2EMW/`0E?8W!SR.K)3+/`,+'D\@^K>'
M;PAEM/]_O,X?9&>$6"KM;*H).'6>(B76KV-WXV-@S@!\/84X!$JK*A#WOTC!
M@8GB%ZRD^=?QDMR/^RBRWZ14-O4-0@?V20U'%BE>"Q^7>M>&J-RB\A^CX:GO
M,%CHR9]",ELH!+"#0DA4RGMH)V,LV,/"&TE'QRDB0VAOD+!DG[?_"9:5ZES'
M`:1O-,Q7%.8*BK\.)*,3V0X^K+ZP:&=`E'[AH9.(0/VFBS.97L6+IH((#<LE
M.:J:9@0N8D,*@*B!MWS>R*+LD+N@L38OTF"!*DE4^9V9G(&[7)C@GX;8>T5&
M`INYII0P#Y(D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^3J:S"9QZM@N;X;
M7AE#W[`5G.Z>9C$W#O&RI7LT<A`F>-X0YLU_/JA,M.G/9]V.!3Z#D5730)3Z
MWOT"7D\'O+A<P#'Q[=S:8O>VA-N*E&\3]A43>GF_6FK'6-X3U<I5-<68'S4F
M+<F_AMPRF^G_`4>NV`V`(?MG2)-X```!!`8``0G`&D8`!PL!``$C`P0!!2``
M```0#,'T:0`("@%H(OA[```%`1$;`&,`;P!N`'8`90!R`'0`90!R`"X`:@!S
9````%`H!`,A,:R[\F,X!%08!`"``````````
`
end
sum -r/size 25669/18070

Save as text file with .uue extension, unpack with Total Commander or WinRAR. And unpack .7z with WinRAR or 7-Zip. Smile


Last edited by Infocatcher on Wed Aug 14, 2013 2:53 pm; edited 15 times in total
Back to top
View user's profile Send private message
Infocatcher



Joined: 06 Aug 2007
Posts: 1559

PostPosted: Fri Jan 21, 2011 5:24 pm    Post subject: Reply with quote

getHash.js <download | mirror | development version>
Calculates hash sum of text.
It can be very slow, be careful.

Screenshots



Post size limit, here is packed file:
getHash.uue
Code:
begin 644 getHash.7z
M-WJ\KR<<``/?F'1N?$<```````!8`````````#['WBH`[LE:?)>33YH2@TWR
M(;WKVJUXJJ*B"04_K@!::<9IE?2WH1?3?.EDNN)25?R\<$?`C_]1:(L(1:@%
MX)L(=D`3:B<U.<R*S.?7PE>+76+]YM7@%S'@XR3J:1:*SOES"IQ$OAE9Q*K3
MD/(L.D-L\-'VE5WTXYD'O#GY7Q91MGOX3<&BI3U3Z4P[9W>Q?T8R[ANKY=\&
M11IH5%YQCPC'4@SXY6RU;45\%H?0U`\`G&T-/!<)M![*#!N!U.I]!<*"[JDX
M$;[RO_&/=P76>:]A6YO)O[*2D6DPQB4?\X1%7![!BYW6%5BPOX\DF4L?SE+8
MLGHS3Z>N)=<0^YXW.RO5H&[5A8>>ZQ?A%Q5B'59UCY:"J[E)M\F/?L&D.2"+
M(+^L;S#*@BP'FO!G,.PHVTN`L>4I$'/6&+GAW#(]`*S\F[+T5B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01&E7
M_7KX3_B!2&AZR;6X8;M:LP`!!`8``0G`?$<`!PL!``$C`P0!!2`````0#,&_
M.P`("@&'3Q;/```%`1$7`&<`90!T`$@`80!S`&@`+@!J`',````4"@$``%PZ
/W/T%S@$5!@$`(```````
`
end
sum -r/size 42305/18420

Save as text file with .uue extension, unpack with Total Commander or WinRAR. And unpack .7z with WinRAR or 7-Zip. Smile


Last edited by Infocatcher on Sun Feb 10, 2013 6:29 pm; edited 12 times in total
Back to top
View user's profile Send private message
KDJ



Joined: 06 Mar 2010
Posts: 1259
Location: Poland

PostPosted: Mon Jan 24, 2011 7:45 pm    Post subject: Reply with quote

Sorts lists in lines by using Format plugin.

SortList.js

Code:
// SortList.js - ver. 2013-09-26 (x86/x64)
//
// Sort list by using Format plugin.
//
// Usage:
// Call("Scripts::Main", 1, "SortList.js")
//
// Note:
// In each line, sorts separately.
// If you do not specify a separator, it will be sorted single characters.
// Shortcut keys in dialog box:
// Enter - Sort
// Esc   - Close
// Shift+Alt+Right (Left, Down, Up, End, Home, PgDn, PgUp) - move dialog box.

if (AkelPad.GetLangId(0 /*LANGID_FULL*/) == 0x0415) //Polish
{
  var sTxtCaption  = "Sortowanie list w wierszach";
  var sTxtSep      = "Separator:";
  var sTxtTab      = "\\t = Tabulacja";
  var sTxtSortMet  = "Metoda sortowania";
  var sTxtDesc     = "&Malejąco";
  var sTxtIgCase   = "&Ignoruj wlk. liter";
  var sTxtString   = "&String";
  var sTxtNum      = "&Numerycznie";
  var sTxtNoSort   = "Nie sortuj, ale";
  var sTxtReverse  = "&Odwróć kolejność elementów";
  var sTxtRemoDup  = "&Usuń duplikaty elementów";
  var sTxtExtrDup  = "&Zachowaj tylko powielone elementy";
  var sTxtExtrUni  = "Zac&howaj tylko unikalne elementy";
  var sTxtCopyToCB = "Wynik kopiuj do schowka, nie zmieniaj &tekstu";
  var sTxtSort     = "Sortuj";
  var sTxtUndo     = "&Cofnij";
  var sTxtRedo     = "&Powtórz";
  var sTxtNoSep    = "Zaznaczony tekst nie zawiera separatora.";
}
else
{
  var sTxtCaption  = "Sort lists in lines";
  var sTxtSep      = "Separator:";
  var sTxtTab      = "\\t = Tabulation";
  var sTxtSortMet  = "Sort method";
  var sTxtDesc     = "&Descending";
  var sTxtIgCase   = "&Ignore case";
  var sTxtString   = "&String";
  var sTxtNum      = "&Numerically";
  var sTxtNoSort   = "No sort, but";
  var sTxtReverse  = "Reverse &order of elements";
  var sTxtRemoDup  = "Re&move duplicate elements";
  var sTxtExtrDup  = "E&xtract duplicate elements";
  var sTxtExtrUni  = "Extra&ct unique elements";
  var sTxtCopyToCB = "Resul&t copy to clipboard, do not replace text";
  var sTxtSort     = "Sort";
  var sTxtUndo     = "&Undo";
  var sTxtRedo     = "&Redo";
  var sTxtNoSep    = "Selected text not contain separator.";
}

var DT_DWORD    = 3;
var BM_SETCHECK = 241;

var oSys       = AkelPad.SystemFunction();
var hMainWnd   = AkelPad.GetMainWnd();
var hEditWnd   = AkelPad.GetEditWnd();
var hGuiFont   = oSys.Call("Gdi32::GetStockObject", 17 /*DEFAULT_GUI_FONT*/);
var hInstDLL   = AkelPad.GetInstanceDll();
var sClassName = "AkelPad::Scripts::" + WScript.ScriptName + "::" + hInstDLL;
var sSep       = ";";
var bTab       = 1;
var bDesc      = 0;
var bIgCase    = 1;
var nMethod    = 1;
var nNoSort    = 0;
var bCopyToCB  = 0;
var nUndoLimit = 0;
var nRedoLimit = 0;
var hWndDlg;
var lpBuffer;
var bIsReturn;
var hFocus;
var nWndPosX;
var nWndPosY;

ReadWriteIni(0);

var aWnd       = [];
var IDGROUP1   = 1000;
var IDSTATSEP  = 1001;
var IDSEP      = 1002;
var IDTAB      = 1003;
var IDGROUP2   = 1004;
var IDDESC     = 1005;
var IDIGCASE   = 1006;
var IDGROUP3   = 1007;
var IDSTRING   = 1008;
var IDNUM      = 1009;
var IDGROUP4   = 1010;
var IDREVERSE  = 1011;
var IDREMODUP  = 1012;
var IDEXTRDUP  = 1013;
var IDEXTRUNI  = 1014;
var IDCOPYTOCB = 1015;
var IDSORT     = 1016;
var IDUNDO     = 1017;
var IDREDO     = 1018;

var CLASS   = 0;
var WND     = 1;
var EXSTYLE = 2;
var STYLE   = 3;
var X       = 4;
var Y       = 5;
var W       = 6;
var H       = 7;
var TXT     = 8;

//0x50000000 - WS_VISIBLE|WS_CHILD
//0x50000007 - WS_VISIBLE|WS_CHILD|BS_GROUPBOX
//0x50000009 - WS_VISIBLE|WS_CHILD|BS_AUTORADIOBUTTON
//0x50010000 - WS_VISIBLE|WS_CHILD|WS_TABSTOP
//0x50010003 - WS_VISIBLE|WS_CHILD|WS_TABSTOP|BS_AUTOCHECKBOX
//0x50010080 - WS_VISIBLE|WS_CHILD|WS_TABSTOP|ES_AUTOHSCROLL
//Windows              CLASS, WND, EXSTYLE,      STYLE,   X,   Y,   W,   H, TXT
aWnd[IDGROUP1  ] = ["BUTTON",   0,       0, 0x50000007,  10,  10, 170,  75, ""];
aWnd[IDSTATSEP ] = ["STATIC",   0,       0, 0x50000000,  20,  30,  60,  13, sTxtSep];
aWnd[IDSEP     ] = ["EDIT",     0,   0x200, 0x50010080,  80,  30,  90,  20, sSep];
aWnd[IDTAB     ] = ["BUTTON",   0,       0, 0x50010003,  80,  60,  90,  16, sTxtTab];
aWnd[IDGROUP2  ] = ["BUTTON",   0,       0, 0x50000007,  10,  95, 260,  65, sTxtSortMet];
aWnd[IDDESC    ] = ["BUTTON",   0,       0, 0x50010003,  40, 115,  90,  16, sTxtDesc];
aWnd[IDIGCASE  ] = ["BUTTON",   0,       0, 0x50010003,  40, 135,  90,  16, sTxtIgCase];
aWnd[IDGROUP3  ] = ["BUTTON",   0,       0, 0x50000007, 150,  95, 120,  65, ""];
aWnd[IDSTRING  ] = ["BUTTON",   0,       0, 0x50000009, 175, 115,  90,  16, sTxtString];
aWnd[IDNUM     ] = ["BUTTON",   0,       0, 0x50000009, 175, 135,  90,  16, sTxtNum];
aWnd[IDGROUP4  ] = ["BUTTON",   0,       0, 0x50000007,  10, 170, 260, 105, sTxtNoSort];
aWnd[IDREVERSE ] = ["BUTTON",   0,       0, 0x50010003,  60, 190, 200,  16, sTxtReverse];
aWnd[IDREMODUP ] = ["BUTTON",   0,       0, 0x50010003,  60, 210, 200,  16, sTxtRemoDup];
aWnd[IDEXTRDUP ] = ["BUTTON",   0,       0, 0x50010003,  60, 230, 200,  16, sTxtExtrDup];
aWnd[IDEXTRUNI ] = ["BUTTON",   0,       0, 0x50010003,  60, 250, 200,  16, sTxtExtrUni];
aWnd[IDCOPYTOCB] = ["BUTTON",   0,       0, 0x50010003,  20, 285, 240,  16, sTxtCopyToCB];
aWnd[IDSORT    ] = ["BUTTON",   0,       0, 0x50010000, 190,  14,  80,  23, sTxtSort];
aWnd[IDUNDO    ] = ["BUTTON",   0,       0, 0x50010000, 190,  39,  80,  23, sTxtUndo];
aWnd[IDREDO    ] = ["BUTTON",   0,       0, 0x50010000, 190,  64,  80,  23, sTxtRedo];

if (hEditWnd)
{
  AkelPad.SendMessage(hEditWnd, 3128 /*AEM_UPDATESEL*/, 0 /*AESELT_COLUMNOFF*/, 0);
  if (AkelPad.GetSelStart() == AkelPad.GetSelEnd())
    AkelPad.SetSel(0, -1);

  if (AkelPad.WindowRegisterClass(sClassName))
  {
    if (lpBuffer = AkelPad.MemAlloc(256 * _TSIZE))
    {
      hWndDlg = oSys.Call("User32::CreateWindowEx" + _TCHAR,
                  0,               //dwExStyle
                  sClassName,      //lpClassName
                  sTxtCaption,     //lpWindowName
                  0x90CA0000,      //WS_VISIBLE|WS_POPUP|WS_CAPTION|WS_SYSMENU|WS_MINIMIZEBOX
                  0,               //x
                  0,               //y
                  285,             //nWidth
                  340,             //nHeight
                  hMainWnd,        //hWndParent
                  0,               //ID
                  hInstDLL,        //hInstance
                  DialogCallback); //Script function callback. To use it class must be registered by WindowRegisterClass.
      if (hWndDlg)
      {
        //Disable main window, to make dialog modal
        oSys.Call("User32::EnableWindow", hMainWnd, false);

        //Message loop
        AkelPad.WindowGetMessage();
      }
      AkelPad.MemFree(lpBuffer);
    }
    AkelPad.WindowUnregisterClass(sClassName);
  }
}

function DialogCallback(hWnd, uMsg, wParam, lParam)
{
  var i, nLowParam;

  if (uMsg == 1) //WM_CREATE
  {
    for (i = 1000; i < aWnd.length; ++i)
    {
      aWnd[i][WND] = oSys.Call("User32::CreateWindowEx" + _TCHAR,
                       aWnd[i][EXSTYLE], //dwExStyle
                       aWnd[i][CLASS],   //lpClassName
                       0,                //lpWindowName
                       aWnd[i][STYLE],   //dwStyle
                       aWnd[i][X],       //x
                       aWnd[i][Y],       //y
                       aWnd[i][W],       //nWidth
                       aWnd[i][H],       //nHeight
                       hWnd,             //hWndParent
                       i,                //ID
                       hInstDLL,         //hInstance
                       0);               //lpParam
      SetWindowFontAndText(aWnd[i][WND], hGuiFont, aWnd[i][TXT]);
    }

    //Set limit edit text
    AkelPad.SendMessage(aWnd[IDSEP][WND], 197 /*EM_LIMITTEXT*/, 20, 0);

    CheckButtons();
    CheckUndoRedo();

    //Set window position
    if ((nWndPosX == undefined) || (nWndPosY == undefined))
      MoveWindow(hMainWnd, hWnd, "RT");
    else
      MoveWindow(hMainWnd, hWnd, [nWndPosX, nWndPosY]);
  }

  else if (uMsg == 7) //WM_SETFOCUS
  {
    oSys.Call("User32::SetFocus", aWnd[IDSEP][WND]);
    AkelPad.SendMessage(aWnd[IDSEP][WND], 177 /*EM_SETSEL*/, 0, -1);
  }

  else if (uMsg == 256) //WM_KEYDOWN
  {
    if (wParam == 27) //VK_ESCAPE
      oSys.Call("User32::PostMessage" + _TCHAR, hWndDlg, 16 /*WM_CLOSE*/, 0, 0);
    else if (wParam == 13) //VK_RETURN
    {
      if (! bIsReturn)
      {
        hFocus = oSys.Call("User32::GetFocus");
        if ((hFocus != aWnd[IDSORT][WND]) && (hFocus != aWnd[IDUNDO][WND]) && (hFocus != aWnd[IDREDO][WND]))
          oSys.Call("User32::PostMessage" + _TCHAR, hWnd, 273 /*WM_COMMAND*/, IDSORT, 0);
      }
    }
  }

  else if (uMsg == 257) //WM_KEYUP
    bIsReturn = 0;

  else if ((uMsg == 260) /*WM_SYSKEYDOWN*/ &&
           (oSys.Call("User32::GetAsyncKeyState", 0xA0 /*VK_LSHIFT*/)))
  {
    if (wParam == 0x27) //VK_RIGHT
      MoveWindow(hMainWnd, hWnd, "R");
    else if (wParam == 0x25) //VK_LEFT
      MoveWindow(hMainWnd, hWnd, "L");
    else if (wParam == 0x28) //VK_DOWN
      MoveWindow(hMainWnd, hWnd, "D");
    else if (wParam == 0x26) //VK_UP
      MoveWindow(hMainWnd, hWnd, "U");
    else if (wParam == 0x23) //VK_END
      MoveWindow(hMainWnd, hWnd, "E");
    else if (wParam == 0x24) //VK_HOME
      MoveWindow(hMainWnd, hWnd, "H");
    else if (wParam == 0x22) //VK_NEXT
      MoveWindow(hMainWnd, hWnd, "B");
    else if (wParam == 0x21) //VK_PRIOR
      MoveWindow(hMainWnd, hWnd, "T");
  }

  else if (uMsg == 273) //WM_COMMAND
  {
    nLowParam = LoWord(wParam);

    if ((nLowParam >= IDTAB) && (nLowParam <= IDCOPYTOCB))
    {
      CheckButtons(nLowParam);
    }

    else if (nLowParam == IDSORT)
    {
      if (SortList())
        CheckUndoRedo(nLowParam);
    }

    else if (nLowParam == IDUNDO)
    {
      bIsReturn = 1;
      CheckUndoRedo(nLowParam);
    }

    else if (nLowParam == IDREDO)
    {
      bIsReturn = 1;
      CheckUndoRedo(nLowParam);
    }
  }

  else if (uMsg == 16) //WM_CLOSE
  {
    ReadWriteIni(1);

    //Enable main window
    oSys.Call("User32::EnableWindow", hMainWnd, true);
    //Destroy dialog
    oSys.Call("User32::DestroyWindow", hWnd);
  }

  else if (uMsg == 2) //WM_DESTROY
  {
    //Exit message loop
    oSys.Call("User32::PostQuitMessage", 0);
  }

  else
    SetDefID(hWnd);

  return 0;
}

function SetWindowFontAndText(hWnd, hFont, sText)
{
  AkelPad.SendMessage(hWnd, 48 /*WM_SETFONT*/, hFont, true);
  oSys.Call("User32::SetWindowText" + _TCHAR, hWnd, sText);
}

function MoveWindow(hWndParent, hWnd, vAction)
{
  var aRectParent;
  var aRect;
  var nX;
  var nY;

  if (! hWndParent)
    hWndParent=oSys.Call("User32::GetDesktopWindow");

  aRectParent = GetWindowPos(hWndParent);
  aRect       = GetWindowPos(hWnd);

  nX = aRect.left;
  nY = aRect.top;

  if (vAction == "R") //Move right
    nX = aRect.left + ((aRect.left < aRectParent.right - 50) ? 20 : 0);
  else if (vAction == "L") //Move left
    nX = aRect.left - ((aRect.right > aRectParent.left + 50) ? 20 : 0);
  else if (vAction == "D") //Move down
    nY = aRect.top + ((aRect.top < aRectParent.bottom - 50) ? 20 : 0);
  else if (vAction == "U") //Move up
    nY = aRect.top - ((aRect.bottom > aRectParent.top + 50) ? 20 : 0);
  else if (vAction == "E") //Move end (right)
    nX = aRect.left + (aRectParent.right - aRect.right);
  else if (vAction == "H") //Move home (left)
    nX = aRect.left + (aRectParent.left - aRect.left);
  else if (vAction == "B") //Move bottom
    nY = aRect.top + (aRectParent.bottom - aRect.bottom);
  else if (vAction == "T") //Move top
    nY = aRect.top + (aRectParent.top - aRect.top);
  else if (vAction == "C") //Center window
  {
    nX = aRectParent.left + ((aRectParent.right  - aRectParent.left) / 2 - (aRect.right  - aRect.left) / 2);
    nY = aRectParent.top  + ((aRectParent.bottom - aRectParent.top)  / 2 - (aRect.bottom - aRect.top)  / 2);
  }
  else if (vAction == "LT") //Move left top
  {
    nX = aRectParent.left;
    nY = aRectParent.top;
  }
  else if (vAction == "RT") //Move right top
  {
    nX = aRect.left + (aRectParent.right - aRect.right);
    nY = aRectParent.top;
  }
  else if (vAction == "LB") //Move left bottom
  {
    nX = aRectParent.left;
    nY = aRect.top + (aRectParent.bottom - aRect.bottom);
  }
  else if (vAction == "RB") //Move right bottom
  {
    nX = aRect.left + (aRectParent.right - aRect.right);
    nY = aRect.top + (aRectParent.bottom - aRect.bottom);
  }
  else
  {
    nX = vAction[0];
    nY = vAction[1];
  }

  oSys.Call("User32::SetWindowPos", hWnd, 0, nX, nY, 0, 0, 0x15 /*SWP_NOZORDER|SWP_NOACTIVATE|SWP_NOSIZE*/);
}

function GetWindowPos(hWnd)
{
  var lpRect = AkelPad.MemAlloc(16) //sizeof(RECT);
  var aRect  = [];

  oSys.Call("User32::GetWindowRect", hWnd, lpRect);

  aRect.left   = AkelPad.MemRead(lpRect,     DT_DWORD);
  aRect.top    = AkelPad.MemRead(lpRect + 4, DT_DWORD);
  aRect.right  = AkelPad.MemRead(lpRect + 8, DT_DWORD);
  aRect.bottom = AkelPad.MemRead(lpRect +12, DT_DWORD);
  AkelPad.MemFree(lpRect);

  return aRect;
}

function LoWord(nParam)
{
  return (nParam & 0xFFFF);
}

function SetDefID(hWnd)
{
  var nID    = 1000;
  var hFocus = oSys.Call("User32::GetFocus");

  while ((nID < aWnd.length) && (hFocus != aWnd[nID][WND]))
    ++nID;

  if ((nID != IDUNDO) && (nID != IDREDO))
    nID = IDSORT;

  oSys.Call("User32::DefDlgProc" + _TCHAR, hWnd, 1025 /*DM_SETDEFID*/, nID, 0);
}

function ReadWriteIni(bWrite)
{
  var oFSO     = new ActiveXObject("Scripting.FileSystemObject");
  var sIniName = WScript.ScriptFullName.substring(0, WScript.ScriptFullName.lastIndexOf(".")) + ".ini";
  var aRect;
  var oFile;
  var sIniTxt;

  if (bWrite)
  {
    aRect = GetWindowPos(hWndDlg);

    oSys.Call("User32::GetWindowText" + _TCHAR, aWnd[IDSEP][WND], lpBuffer, 256);
    sSep = AkelPad.MemRead(lpBuffer, _TSTR);

    sIniTxt = 'nWndPosX='  + aRect.left + ';\r\n' +
              'nWndPosY='  + aRect.top  + ';\r\n' +
              'sSep="'     + sSep.replace(/[\\"]/g, "\\$&") + '";\r\n' +
              'bTab='      + bTab + ';\r\n' +
              'bDesc='     + bDesc + ';\r\n' +
              'bIgCase='   + bIgCase + ';\r\n' +
              'nMethod='   + nMethod + ';\r\n' +
              'nNoSort='   + nNoSort + ';\r\n' +
              'bCopyToCB=' + bCopyToCB + ';'

    oFile = oFSO.OpenTextFile(sIniName, 2, true, 0);
    oFile.Write(sIniTxt);
    oFile.Close();
  }

  else if (oFSO.FileExists(sIniName))
  {
    try
    {
      eval(AkelPad.ReadFile(sIniName));
    }
    catch (oError)
    {
    }
  }
}

function CheckButtons(nButton)
{
  if (nButton == IDTAB)
    bTab = ! bTab;
  else if (nButton == IDDESC)
    bDesc = ! bDesc;
  else if (nButton == IDIGCASE)
    bIgCase = ! bIgCase;
  else if ((nButton == IDSTRING) || (nButton == IDNUM))
    nMethod = nButton - IDSTRING + 1;
  else if ((nButton == IDREVERSE) || (nButton == IDREMODUP) ||
           (nButton == IDEXTRDUP) || (nButton == IDEXTRUNI))
  {
    if (nNoSort == nButton - IDREVERSE + 1)
      nNoSort = 0;
    else
      nNoSort = nButton - IDREVERSE + 1;
  }
  else if (nButton == IDCOPYTOCB)
    bCopyToCB = ! bCopyToCB;

  if (nNoSort > 1)
    nMethod = 1;

  AkelPad.SendMessage(aWnd[IDTAB][WND],      BM_SETCHECK, bTab,           0);
  AkelPad.SendMessage(aWnd[IDDESC][WND],     BM_SETCHECK, bDesc,          0);
  AkelPad.SendMessage(aWnd[IDIGCASE][WND],   BM_SETCHECK, bIgCase,        0);
  AkelPad.SendMessage(aWnd[IDSTRING][WND],   BM_SETCHECK, (nMethod == 1), 0);
  AkelPad.SendMessage(aWnd[IDNUM][WND],      BM_SETCHECK, (nMethod == 2), 0);
  AkelPad.SendMessage(aWnd[IDREVERSE][WND],  BM_SETCHECK, (nNoSort == 1), 0);
  AkelPad.SendMessage(aWnd[IDREMODUP][WND],  BM_SETCHECK, (nNoSort == 2), 0);
  AkelPad.SendMessage(aWnd[IDEXTRDUP][WND],  BM_SETCHECK, (nNoSort == 3), 0);
  AkelPad.SendMessage(aWnd[IDEXTRUNI][WND],  BM_SETCHECK, (nNoSort == 4), 0);
  AkelPad.SendMessage(aWnd[IDCOPYTOCB][WND], BM_SETCHECK, bCopyToCB,      0);

  oSys.Call("User32::EnableWindow", aWnd[IDDESC][WND],   (nNoSort == 0));
  oSys.Call("User32::EnableWindow", aWnd[IDIGCASE][WND], (nNoSort != 1));
  oSys.Call("User32::EnableWindow", aWnd[IDSTRING][WND], (nNoSort != 1));
  oSys.Call("User32::EnableWindow", aWnd[IDNUM][WND],    (nNoSort == 0));
}

function CheckUndoRedo(nButton)
{
  var nBegSel  = AkelPad.GetSelStart();
  var sTxtUndo = aWnd[IDUNDO][TXT];
  var sTxtRedo = aWnd[IDREDO][TXT];

  if (nButton == IDSORT)
  {
    if (nUndoLimit < AkelPad.SendMessage(hEditWnd, 3084 /*AEM_GETUNDOLIMIT*/, 0, 0))
      ++nUndoLimit;
    nRedoLimit = 0;
  }
  else if ((nButton == IDUNDO) && (nUndoLimit))
  {
    --nUndoLimit;
    ++nRedoLimit;
    AkelPad.SendMessage(hEditWnd, 3077 /*AEM_UNDO*/, 0, 0);
  }
  else if ((nButton == IDREDO) && (nRedoLimit))
  {
    ++nUndoLimit;
    --nRedoLimit;
    AkelPad.SendMessage(hEditWnd, 3078 /*AEM_REDO*/, 0, 0);
    AkelPad.SetSel(nBegSel, AkelPad.GetSelEnd());
  }

  if (nUndoLimit)
    sTxtUndo += " (" + nUndoLimit + ")";
  if (nRedoLimit)
    sTxtRedo += " (" + nRedoLimit + ")";

  if (((oSys.Call("User32::GetFocus") == aWnd[IDUNDO][WND]) && (nUndoLimit == 0)) ||
      ((oSys.Call("User32::GetFocus") == aWnd[IDREDO][WND]) && (nRedoLimit == 0)))
    oSys.Call("User32::SetFocus", aWnd[IDSEP][WND]);

  SetWindowFontAndText(aWnd[IDUNDO][WND], hGuiFont, sTxtUndo);
  SetWindowFontAndText(aWnd[IDREDO][WND], hGuiFont, sTxtRedo);

  oSys.Call("User32::EnableWindow", aWnd[IDUNDO][WND], nUndoLimit);
  oSys.Call("User32::EnableWindow", aWnd[IDREDO][WND], nRedoLimit);
}

function SortList()
{
  var nBegSel  = AkelPad.GetSelStart();
  var nEndSel  = AkelPad.GetSelEnd();
  var sText    = AkelPad.GetSelText();
  var nLine1   = AkelPad.SendMessage(hEditWnd, 1078 /*EM_EXLINEFROMCHAR*/, 0, nBegSel);
  var nLine2   = AkelPad.SendMessage(hEditWnd, 1078 /*EM_EXLINEFROMCHAR*/, 0, nEndSel);
  var nBegLen  = TextLen();
  var nBegLine;
  var nEndLine;
  var bSepEnd;
  var rSep;
  var rSep_g;
  var rSepEnd;
  var i;

  oSys.Call("User32::GetWindowText" + _TCHAR, aWnd[IDSEP][WND], lpBuffer, 256);
  sSep = AkelPad.MemRead(lpBuffer, _TSTR);

  if (bTab) sSep = sSep.replace(/\\t/g, "\t");

  rSep    = new RegExp(escapeRegExp(sSep));
  rSep_g  = new RegExp(escapeRegExp(sSep), "g");
  rSepEnd = new RegExp(escapeRegExp(sSep) + "$");

  if (! rSep.test(sText))
  {
    AkelPad.MessageBox(hWndDlg, sTxtNoSep, sTxtCaption, 48 /*MB_ICONEXCLAMATION*/);
    return 0;
  }

  SetRedraw(hEditWnd, false);
  AkelPad.SendMessage(hEditWnd, 3080 /*AEM_STOPGROUPTYPING*/, 0, 0);
  AkelPad.SendMessage(hEditWnd, 3081 /*AEM_BEGINUNDOACTION*/, 0, 0);
  AkelPad.ReplaceSel(sText, 1);

  for (i = nLine1; i <= nLine2; ++i)
  {
    if (nLine1 < nLine2)
    {
       nBegLine = AkelPad.SendMessage(hEditWnd, 187 /*EM_LINEINDEX*/, i, 0);
       nEndLine = AkelPad.SendMessage(hEditWnd, 187 /*EM_LINEINDEX*/, i, 0) +
                    AkelPad.SendMessage(hEditWnd, 193 /*EM_LINELENGTH*/, nBegLine, 0);
      if (i == nLine1)
        AkelPad.SetSel(nBegSel, nEndLine);
      else if (i == nLine2)
        AkelPad.SetSel(nBegLine, nEndSel - nBegLen + TextLen());
      else
        AkelPad.SetSel(nBegLine, nEndLine);

      sText = AkelPad.GetSelText();
    }

    if (rSep.test(sText))
    {
      bSepEnd = rSepEnd.test(sText);
      sText   = sText.replace(rSep_g, "\r");
      AkelPad.ReplaceSel("\r" + sText + "\r", 1);
      AkelPad.SetSel(AkelPad.GetSelStart() + 1, AkelPad.GetSelEnd() - 1);
      SortByPlugin();
      sText = AkelPad.GetTextRange(AkelPad.GetSelStart(), AkelPad.GetSelEnd() - 1 + bSepEnd).replace(/\r/g, sSep);
      AkelPad.SetSel(AkelPad.GetSelStart() - 1, AkelPad.GetSelEnd() + bSepEnd);
      AkelPad.ReplaceSel(sText, 1);
    }
  }

  AkelPad.SetSel(nBegSel, AkelPad.GetSelEnd());
  AkelPad.SendMessage(hEditWnd, 3082 /*AEM_ENDUNDOACTION*/, 0, 0);
  AkelPad.SendMessage(hEditWnd, 3080 /*AEM_STOPGROUPTYPING*/, 0, 0);

  if (bCopyToCB)
  {
    AkelPad.SetClipboardText(AkelPad.GetSelText());
    AkelPad.SendMessage(hEditWnd, 3077 /*AEM_UNDO*/, 0, 0);
  }

  SetRedraw(hEditWnd, true);
  return ! bCopyToCB;
}

function SortByPlugin()
{
  var sAscDesc = bDesc ? "Desc" : "Asc";

  if (nNoSort == 1)
    AkelPad.Call("Format::LineReverse");
  else if (nNoSort == 2)
    AkelPad.Call("Format::LineRemoveDuplicates", ! bIgCase);
  else if (nNoSort == 3)
    AkelPad.Call("Format::LineGetDuplicates", ! bIgCase);
  else if (nNoSort == 4)
    AkelPad.Call("Format::LineGetUnique", ! bIgCase);
  else if (nMethod == 1)
    AkelPad.Call("Format::LineSortStr" + sAscDesc, ! bIgCase);
  else if (nMethod == 2)
    AkelPad.Call("Format::LineSortInt" + sAscDesc, ! bIgCase);
}

function escapeRegExp(sStr)
{
  return sStr.replace(/[\\\/.^$+*?|()\[\]{}]/g, "\\$&");
}

function SetRedraw(hWnd, bRedraw)
{
  var oSys = AkelPad.SystemFunction();
  AkelPad.SendMessage(hWnd, 11 /*WM_SETREDRAW*/, bRedraw, 0);
  bRedraw && oSys.Call("User32::InvalidateRect", hWnd, 0, true);
}

function TextLen()
{
  var nOffset = -1;
  var lpIndex;

  if (lpIndex = AkelPad.MemAlloc(_X64 ? 24 : 12 /*sizeof(AECHARINDEX)*/))
  {
    AkelPad.SendMessage(hEditWnd, 3130 /*AEM_GETINDEX*/, 2 /*AEGI_LASTCHAR*/, lpIndex);
    nOffset = AkelPad.SendMessage(hEditWnd, 3136 /*AEM_INDEXTORICHOFFSET*/, 0, lpIndex);
    AkelPad.MemFree(lpIndex);
  }
  return nOffset;
}


Last edited by KDJ on Sat Sep 28, 2013 3:30 pm; edited 4 times in total
Back to top
View user's profile Send private message
Infocatcher



Joined: 06 Aug 2007
Posts: 1559

PostPosted: Sun Jan 30, 2011 9:37 pm    Post subject: Reply with quote

AESCrypt.js
Code:
// http://akelpad.sourceforge.net/forum/viewtopic.php?p=11212#11212
// http://infocatcher.ucoz.net/js/akelpad_scripts/AESCrypt.js

// (c) Infocatcher 2010-2011
// version 0.2.7 - 2011-12-20

//===================
// AES-256 encrypt/decrypt
// Based on script from http://www.movable-type.co.uk/scripts/aes.html

// Arguments:
//   -mode=0             - (default) ask user about direction (encrypt or decrypt)
//        =1             - encrypt
//        =2             - decrypt
//   -maxLineWidth=75    - allow split output to lines with fixed width
//   -showPassword=true  - force show or hide password
//   -saveOptions=true   - allow store last used password state

// Usage:
//   Call("Scripts::Main", 1, "AESCrypt.js", "-mode=1")     - encrypt
//   Call("Scripts::Main", 1, "AESCrypt.js", "-mode=2")     - decrypt
//   Call("Scripts::Main", 1, "AESCrypt.js", "-mode=0 -maxLineWidth=0 -showPassword=true -saveOptions=false")
//===================

function _localize(s) {
   var strings = {
      "Nothing to encrypt!": {
         ru: "Нечего зашифровывать!"
      },
      "Nothing to decrypt!": {
         ru: "Нечего расшифровывать!"
      },
      "Direction": {
         ru: "Направление"
      },
      "Encrypt": {
         ru: "Зашифровать"
      },
      "Decrypt": {
         ru: "Расшифровать"
      },
      "Password": {
         ru: "Пароль"
      },
      "&Encrypt": {
         ru: "&Зашифровать"
      },
      "&Decrypt": {
         ru: "&Расшифровать"
      },
      "Impossible to decrypt: invalid format!": {
         ru: "Невозможно расшифровать: некорректный формат!"
      },
      "Enter &password:": {
         ru: "Введите &пароль:"
      },
      "Reenter p&assword:": {
         ru: "Повторите п&ароль:"
      },
      "&Show password": {
         ru: "По&казывать пароль"
      },
      "OK": {
         ru: "ОК"
      },
      "Cancel": {
         ru: "Отмена"
      },
      "Passwords do not match!": {
         ru: "Пароли не совпадают!"
      }
   };
   var lng;
   switch(AkelPad.GetLangId(1 /*LANGID_PRIMARY*/)) {
      case 0x19: lng = "ru"; break;
      default:   lng = "en";
   }
   _localize = function(s) {
      return strings[s] && strings[s][lng] || s;
   };
   return _localize(s);
}

var MODE_USER_SELECT = 0;
var MODE_ENCRYPT     = 1;
var MODE_DECRYPT     = 2;

// Read arguments:
// getArg(argName, defaultValue)
var mode         = getArg("mode", 0);
var maxLineWidth = getArg("maxLineWidth", 75);
var showPassword = getArg("showPassword");
var saveOptions  = getArg("saveOptions", true);

var decrypt = mode == MODE_DECRYPT;


/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -  */
/*  AES implementation in JavaScript (c) Chris Veness 2005-2010                                   */
/*   - see http://csrc.nist.gov/publications/PubsFIPS.html#197                                    */
/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -  */

var Aes = {};  // Aes namespace

/**
 * AES Cipher function: encrypt 'input' state with Rijndael algorithm
 *   applies Nr rounds (10/12/14) using key schedule w for 'add round key' stage
 *
 * @param {Number[]} input 16-byte (128-bit) input state array
 * @param {Number[][]} w   Key schedule as 2D byte-array (Nr+1 x Nb bytes)
 * @returns {Number[]}     Encrypted output state array
 */
Aes.cipher = function(input, w) {    // main Cipher function [§5.1]
  var Nb = 4;               // block size (in words): no of columns in state (fixed at 4 for AES)
  var Nr = w.length/Nb - 1; // no of rounds: 10/12/14 for 128/192/256-bit keys

  var state = [[],[],[],[]];  // initialise 4xNb byte-array 'state' with input [§3.4]
  for (var i=0; i<4*Nb; i++) state[i%4][Math.floor(i/4)] = input[i];

  state = Aes.addRoundKey(state, w, 0, Nb);

  for (var round=1; round<Nr; round++) {
    state = Aes.subBytes(state, Nb);
    state = Aes.shiftRows(state, Nb);
    state = Aes.mixColumns(state, Nb);
    state = Aes.addRoundKey(state, w, round, Nb);
  }

  state = Aes.subBytes(state, Nb);
  state = Aes.shiftRows(state, Nb);
  state = Aes.addRoundKey(state, w, Nr, Nb);

  var output = new Array(4*Nb);  // convert state to 1-d array before returning [§3.4]
  for (var i=0; i<4*Nb; i++) output[i] = state[i%4][Math.floor(i/4)];
  return output;
}

/**
 * Perform Key Expansion to generate a Key Schedule
 *
 * @param {Number[]} key Key as 16/24/32-byte array
 * @returns {Number[][]} Expanded key schedule as 2D byte-array (Nr+1 x Nb bytes)
 */
Aes.keyExpansion = function(key) {  // generate Key Schedule (byte-array Nr+1 x Nb) from Key [§5.2]
  var Nb = 4;            // block size (in words): no of columns in state (fixed at 4 for AES)
  var Nk = key.length/4  // key length (in words): 4/6/8 for 128/192/256-bit keys
  var Nr = Nk + 6;       // no of rounds: 10/12/14 for 128/192/256-bit keys

  var w = new Array(Nb*(Nr+1));
  var temp = new Array(4);

  for (var i=0; i<Nk; i++) {
    var r = [key[4*i], key[4*i+1], key[4*i+2], key[4*i+3]];
    w[i] = r;
  }

  for (var i=Nk; i<(Nb*(Nr+1)); i++) {
    w[i] = new Array(4);
    for (var t=0; t<4; t++) temp[t] = w[i-1][t];
    if (i % Nk == 0) {
      temp = Aes.subWord(Aes.rotWord(temp));
      for (var t=0; t<4; t++) temp[t] ^= Aes.rCon[i/Nk][t];
    } else if (Nk > 6 && i%Nk == 4) {
      temp = Aes.subWord(temp);
    }
    for (var t=0; t<4; t++) w[i][t] = w[i-Nk][t] ^ temp[t];
  }

  return w;
}

/*
 * ---- remaining routines are private, not called externally ----
 */

Aes.subBytes = function(s, Nb) {    // apply SBox to state S [§5.1.1]
  for (var r=0; r<4; r++) {
    for (var c=0; c<Nb; c++) s[r][c] = Aes.sBox[s[r][c]];
  }
  return s;
}

Aes.shiftRows = function(s, Nb) {    // shift row r of state S left by r bytes [§5.1.2]
  var t = new Array(4);
  for (var r=1; r<4; r++) {
    for (var c=0; c<4; c++) t[c] = s[r][(c+r)%Nb];  // shift into temp copy
    for (var c=0; c<4; c++) s[r][c] = t[c];         // and copy back
  }          // note that this will work for Nb=4,5,6, but not 7,8 (always 4 for AES):
  return s;  // see asmaes.sourceforge.net/rijndael/rijndaelImplementation.pdf
}

Aes.mixColumns = function(s, Nb) {   // combine bytes of each col of state S [§5.1.3]
  for (var c=0; c<4; c++) {
    var a = new Array(4);  // 'a' is a copy of the current column from 's'
    var b = new Array(4);  // 'b' is a•{02} in GF(2^8)
    for (var i=0; i<4; i++) {
      a[i] = s[i][c];
      b[i] = s[i][c]&0x80 ? s[i][c]<<1 ^ 0x011b : s[i][c]<<1;

    }
    // a[n] ^ b[n] is a•{03} in GF(2^8)
    s[0][c] = b[0] ^ a[1] ^ b[1] ^ a[2] ^ a[3]; // 2*a0 + 3*a1 + a2 + a3
    s[1][c] = a[0] ^ b[1] ^ a[2] ^ b[2] ^ a[3]; // a0 * 2*a1 + 3*a2 + a3
    s[2][c] = a[0] ^ a[1] ^ b[2] ^ a[3] ^ b[3]; // a0 + a1 + 2*a2 + 3*a3
    s[3][c] = a[0] ^ b[0] ^ a[1] ^ a[2] ^ b[3]; // 3*a0 + a1 + a2 + 2*a3
  }
  return s;
}

Aes.addRoundKey = function(state, w, rnd, Nb) {  // xor Round Key into state S [§5.1.4]
  for (var r=0; r<4; r++) {
    for (var c=0; c<Nb; c++) state[r][c] ^= w[rnd*4+c][r];
  }
  return state;
}

Aes.subWord = function(w) {    // apply SBox to 4-byte word w
  for (var i=0; i<4; i++) w[i] = Aes.sBox[w[i]];
  return w;
}

Aes.rotWord = function(w) {    // rotate 4-byte word w left by one byte
  var tmp = w[0];
  for (var i=0; i<3; i++) w[i] = w[i+1];
  w[3] = tmp;
  return w;
}

// sBox is pre-computed multiplicative inverse in GF(2^8) used in subBytes and keyExpansion [§5.1.1]
Aes.sBox =  [0x63,0x7c,0x77,0x7b,0xf2,0x6b,0x6f,0xc5,0x30,0x01,0x67,0x2b,0xfe,0xd7,0xab,0x76,
             0xca,0x82,0xc9,0x7d,0xfa,0x59,0x47,0xf0,0xad,0xd4,0xa2,0xaf,0x9c,0xa4,0x72,0xc0,
             0xb7,0xfd,0x93,0x26,0x36,0x3f,0xf7,0xcc,0x34,0xa5,0xe5,0xf1,0x71,0xd8,0x31,0x15,
             0x04,0xc7,0x23,0xc3,0x18,0x96,0x05,0x9a,0x07,0x12,0x80,0xe2,0xeb,0x27,0xb2,0x75,
             0x09,0x83,0x2c,0x1a,0x1b,0x6e,0x5a,0xa0,0x52,0x3b,0xd6,0xb3,0x29,0xe3,0x2f,0x84,
             0x53,0xd1,0x00,0xed,0x20,0xfc,0xb1,0x5b,0x6a,0xcb,0xbe,0x39,0x4a,0x4c,0x58,0xcf,
             0xd0,0xef,0xaa,0xfb,0x43,0x4d,0x33,0x85,0x45,0xf9,0x02,0x7f,0x50,0x3c,0x9f,0xa8,
             0x51,0xa3,0x40,0x8f,0x92,0x9d,0x38,0xf5,0xbc,0xb6,0xda,0x21,0x10,0xff,0xf3,0xd2,
             0xcd,0x0c,0x13,0xec,0x5f,0x97,0x44,0x17,0xc4,0xa7,0x7e,0x3d,0x64,0x5d,0x19,0x73,
             0x60,0x81,0x4f,0xdc,0x22,0x2a,0x90,0x88,0x46,0xee,0xb8,0x14,0xde,0x5e,0x0b,0xdb,
             0xe0,0x32,0x3a,0x0a,0x49,0x06,0x24,0x5c,0xc2,0xd3,0xac,0x62,0x91,0x95,0xe4,0x79,
             0xe7,0xc8,0x37,0x6d,0x8d,0xd5,0x4e,0xa9,0x6c,0x56,0xf4,0xea,0x65,0x7a,0xae,0x08,
             0xba,0x78,0x25,0x2e,0x1c,0xa6,0xb4,0xc6,0xe8,0xdd,0x74,0x1f,0x4b,0xbd,0x8b,0x8a,
             0x70,0x3e,0xb5,0x66,0x48,0x03,0xf6,0x0e,0x61,0x35,0x57,0xb9,0x86,0xc1,0x1d,0x9e,
             0xe1,0xf8,0x98,0x11,0x69,0xd9,0x8e,0x94,0x9b,0x1e,0x87,0xe9,0xce,0x55,0x28,0xdf,
             0x8c,0xa1,0x89,0x0d,0xbf,0xe6,0x42,0x68,0x41,0x99,0x2d,0x0f,0xb0,0x54,0xbb,0x16];

// rCon is Round Constant used for the Key Expansion [1st col is 2^(r-1) in GF(2^8)] [§5.2]
Aes.rCon = [ [0x00, 0x00, 0x00, 0x00],
             [0x01, 0x00, 0x00, 0x00],
             [0x02, 0x00, 0x00, 0x00],
             [0x04, 0x00, 0x00, 0x00],
             [0x08, 0x00, 0x00, 0x00],
             [0x10, 0x00, 0x00, 0x00],
             [0x20, 0x00, 0x00, 0x00],
             [0x40, 0x00, 0x00, 0x00],
             [0x80, 0x00, 0x00, 0x00],
             [0x1b, 0x00, 0x00, 0x00],
             [0x36, 0x00, 0x00, 0x00] ];


/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -  */
/*  AES Counter-mode implementation in JavaScript (c) Chris Veness 2005-2009                      */
/*   - see http://csrc.nist.gov/publications/nistpubs/800-38a/sp800-38a.pdf                       */
/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -  */

Aes.Ctr = {};  // Aes.Ctr namespace: a subclass or extension of Aes

/**
 * Encrypt a text using AES encryption in Counter mode of operation
 *
 * Unicode multi-byte character safe
 *
 * @param {String} plaintext Source text to be encrypted
 * @param {String} password  The password to use to generate a key
 * @param {Number} nBits     Number of bits to be used in the key (128, 192, or 256)
 * @returns {string}         Encrypted text
 */
Aes.Ctr.encrypt = function(plaintext, password, nBits) {
  var blockSize = 16;  // block size fixed at 16 bytes / 128 bits (Nb=4) for AES
  if (!(nBits==128 || nBits==192 || nBits==256)) return '';  // standard allows 128/192/256 bit keys
  plaintext = Utf8.encode(plaintext);
  password = Utf8.encode(password);
  //var t = new Date();  // timer

  // use AES itself to encrypt password to get cipher key (using plain password as source for key
  // expansion) - gives us well encrypted key
  var nBytes = nBits/8;  // no bytes in key
  var pwBytes = new Array(nBytes);
  for (var i=0; i<nBytes; i++) {
    pwBytes[i] = isNaN(password.charCodeAt(i)) ? 0 : password.charCodeAt(i);
  }
  var key = Aes.cipher(pwBytes, Aes.keyExpansion(pwBytes));  // gives us 16-byte key
  key = key.concat(key.slice(0, nBytes-16));  // expand key to 16/24/32 bytes long

  // initialise counter block (NIST SP800-38A §B.2): millisecond time-stamp for nonce in 1st 8 bytes,
  // block counter in 2nd 8 bytes
  var counterBlock = new Array(blockSize);
  var nonce = (new Date()).getTime();  // timestamp: milliseconds since 1-Jan-1970
  var nonceSec = Math.floor(nonce/1000);
  var nonceMs = nonce%1000;
  // encode nonce with seconds in 1st 4 bytes, and (repeated) ms part filling 2nd 4 bytes
  for (var i=0; i<4; i++) counterBlock[i] = (nonceSec >>> i*8) & 0xff;
  for (var i=0; i<4; i++) counterBlock[i+4] = nonceMs & 0xff;
  // and convert it to a string to go on the front of the ciphertext
  var ctrTxt = '';
  for (var i=0; i<8; i++) ctrTxt += String.fromCharCode(counterBlock[i]);

  // generate key schedule - an expansion of the key into distinct Key Rounds for each round
  var keySchedule = Aes.keyExpansion(key);

  var blockCount = Math.ceil(plaintext.length/blockSize);
  var ciphertxt = new Array(blockCount);  // ciphertext as array of strings

  for (var b=0; b<blockCount; b++) {
    // set counter (block #) in last 8 bytes of counter block (leaving nonce in 1st 8 bytes)
    // done in two stages for 32-bit ops: using two words allows us to go past 2^32 blocks (68GB)
    for (var c=0; c<4; c++) counterBlock[15-c] = (b >>> c*8) & 0xff;
    for (var c=0; c<4; c++) counterBlock[15-c-4] = (b/0x100000000 >>> c*8)

    var cipherCntr = Aes.cipher(counterBlock, keySchedule);  // -- encrypt counter block --

    // block size is reduced on final block
    var blockLength = b<blockCount-1 ? blockSize : (plaintext.length-1)%blockSize+1;
    var cipherChar = new Array(blockLength);

    for (var i=0; i<blockLength; i++) {  // -- xor plaintext with ciphered counter char-by-char --
      cipherChar[i] = cipherCntr[i] ^ plaintext.charCodeAt(b*blockSize+i);
      cipherChar[i] = String.fromCharCode(cipherChar[i]);
    }
    ciphertxt[b] = cipherChar.join('');
  }

  // Array.join is more efficient than repeated string concatenation in IE
  var ciphertext = ctrTxt + ciphertxt.join('');
  ciphertext = Base64.encode(ciphertext);  // encode in base64

  //alert((new Date()) - t);
  return ciphertext;
}

/**
 * Decrypt a text encrypted by AES in counter mode of operation
 *
 * @param {String} ciphertext Source text to be encrypted
 * @param {String} password   The password to use to generate a key
 * @param {Number} nBits      Number of bits to be used in the key (128, 192, or 256)
 * @returns {String}          Decrypted text
 */
Aes.Ctr.decrypt = function(ciphertext, password, nBits) {
  var blockSize = 16;  // block size fixed at 16 bytes / 128 bits (Nb=4) for AES
  if (!(nBits==128 || nBits==192 || nBits==256)) return '';  // standard allows 128/192/256 bit keys
  ciphertext = Base64.decode(ciphertext);
  password = Utf8.encode(password);
  //var t = new Date();  // timer

  // use AES to encrypt password (mirroring encrypt routine)
  var nBytes = nBits/8;  // no bytes in key
  var pwBytes = new Array(nBytes);
  for (var i=0; i<nBytes; i++) {
    pwBytes[i] = isNaN(password.charCodeAt(i)) ? 0 : password.charCodeAt(i);
  }
  var key = Aes.cipher(pwBytes, Aes.keyExpansion(pwBytes));
  key = key.concat(key.slice(0, nBytes-16));  // expand key to 16/24/32 bytes long

  // recover nonce from 1st 8 bytes of ciphertext
  var counterBlock = new Array(8);
  ctrTxt = ciphertext.slice(0, 8);
  for (var i=0; i<8; i++) counterBlock[i] = ctrTxt.charCodeAt(i);

  // generate key schedule
  var keySchedule = Aes.keyExpansion(key);

  // separate ciphertext into blocks (skipping past initial 8 bytes)
  var nBlocks = Math.ceil((ciphertext.length-8) / blockSize);
  var ct = new Array(nBlocks);
  for (var b=0; b<nBlocks; b++) ct[b] = ciphertext.slice(8+b*blockSize, 8+b*blockSize+blockSize);
  ciphertext = ct;  // ciphertext is now array of block-length strings

  // plaintext will get generated block-by-block into array of block-length strings
  var plaintxt = new Array(ciphertext.length);

  for (var b=0; b<nBlocks; b++) {
    // set counter (block #) in last 8 bytes of counter block (leaving nonce in 1st 8 bytes)
    for (var c=0; c<4; c++) counterBlock[15-c] = ((b) >>> c*8) & 0xff;
    for (var c=0; c<4; c++) counterBlock[15-c-4] = (((b+1)/0x100000000-1) >>> c*8) & 0xff;

    var cipherCntr = Aes.cipher(counterBlock, keySchedule);  // encrypt counter block

    var plaintxtByte = new Array(ciphertext[b].length);
    for (var i=0; i<ciphertext[b].length; i++) {
      // -- xor plaintxt with ciphered counter byte-by-byte --
      plaintxtByte[i] = cipherCntr[i] ^ ciphertext[b].charCodeAt(i);
      plaintxtByte[i] = String.fromCharCode(plaintxtByte[i]);
    }
    plaintxt[b] = plaintxtByte.join('');
  }

  // join array of blocks into single plaintext string
  var plaintext = plaintxt.join('');
  plaintext = Utf8.decode(plaintext);  // decode from UTF8 back to Unicode multi-byte chars

  //alert((new Date()) - t);
  return plaintext;
}


/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -  */
/*  Base64 class: Base 64 encoding / decoding (c) Chris Veness 2002-2010                          */
/*    note: depends on Utf8 class                                                                 */
/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -  */

var Base64 = {};  // Base64 namespace

Base64.code = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";

/**
 * Encode string into Base64, as defined by RFC 4648 [http://tools.ietf.org/html/rfc4648]
 * (instance method extending String object). As per RFC 4648, no newlines are added.
 *
 * @param {String} str The string to be encoded as base-64
 * @param {Boolean} [utf8encode=false] Flag to indicate whether str is Unicode string to be encoded
 *   to UTF8 before conversion to base64; otherwise string is assumed to be 8-bit characters
 * @returns {String} Base64-encoded string
 */
Base64.encode = function(str, utf8encode) {  // http://tools.ietf.org/html/rfc4648
  utf8encode =  (typeof utf8encode == 'undefined') ? false : utf8encode;
  var o1, o2, o3, bits, h1, h2, h3, h4, e=[], pad = '', c, plain, coded;
  var b64 = Base64.code;

  plain = utf8encode ? str.encodeUTF8() : str;

  c = plain.length % 3;  // pad string to length of multiple of 3
  if (c > 0) { while (c++ < 3) { pad += '='; plain += '\0'; } }
  // note: doing padding here saves us doing special-case packing for trailing 1 or 2 chars

  for (c=0; c<plain.length; c+=3) {  // pack three octets into four hexets
    o1 = plain.charCodeAt(c);
    o2 = plain.charCodeAt(c+1);
    o3 = plain.charCodeAt(c+2);

    bits = o1<<16 | o2<<8 | o3;

    h1 = bits>>18 & 0x3f;
    h2 = bits>>12 & 0x3f;
    h3 = bits>>6 & 0x3f;
    h4 = bits & 0x3f;

    // use hextets to index into code string
    e[c/3] = b64.charAt(h1) + b64.charAt(h2) + b64.charAt(h3) + b64.charAt(h4);
  }
  coded = e.join('');  // join() is far faster than repeated string concatenation in IE

  // replace 'A's from padded nulls with '='s
  coded = coded.slice(0, coded.length-pad.length) + pad;

  return coded;
}

/**
 * Decode string from Base64, as defined by RFC 4648 [http://tools.ietf.org/html/rfc4648]
 * (instance method extending String object). As per RFC 4648, newlines are not catered for.
 *
 * @param {String} str The string to be decoded from base-64
 * @param {Boolean} [utf8decode=false] Flag to indicate whether str is Unicode string to be decoded
 *   from UTF8 after conversion from base64
 * @returns {String} decoded string
 */
Base64.decode = function(str, utf8decode) {
  utf8decode =  (typeof utf8decode == 'undefined') ? false : utf8decode;
  var o1, o2, o3, h1, h2, h3, h4, bits, d=[], plain, coded;
  var b64 = Base64.code;

  coded = utf8decode ? str.decodeUTF8() : str;


  for (var c=0; c<coded.length; c+=4) {  // unpack four hexets into three octets
    h1 = b64.indexOf(coded.charAt(c));
    h2 = b64.indexOf(coded.charAt(c+1));
    h3 = b64.indexOf(coded.charAt(c+2));
    h4 = b64.indexOf(coded.charAt(c+3));

    bits = h1<<18 | h2<<12 | h3<<6 | h4;

    o1 = bits>>>16 & 0xff;
    o2 = bits>>>8 & 0xff;
    o3 = bits & 0xff;

    d[c/4] = String.fromCharCode(o1, o2, o3);
    // check for padding
    if (h4 == 0x40) d[c/4] = String.fromCharCode(o1, o2);
    if (h3 == 0x40) d[c/4] = String.fromCharCode(o1);
  }
  plain = d.join('');  // join() is far faster than repeated string concatenation in IE

  return utf8decode ? plain.decodeUTF8() : plain;
}


/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -  */
/*  Utf8 class: encode / decode between multi-byte Unicode characters and UTF-8 multiple          */
/*              single-byte character encoding (c) Chris Veness 2002-2010                         */
/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -  */

var Utf8 = {};  // Utf8 namespace

/**
 * Encode multi-byte Unicode string into utf-8 multiple single-byte characters
 * (BMP / basic multilingual plane only)
 *
 * Chars in range U+0080 - U+07FF are encoded in 2 chars, U+0800 - U+FFFF in 3 chars
 *
 * @param {String} strUni Unicode string to be encoded as UTF-8
 * @returns {String} encoded string
 */
Utf8.encode = function(strUni) {
  // use regular expressions & String.replace callback function for better efficiency
  // than procedural approaches
  var strUtf = strUni.replace(
      /[\u0080-\u07ff]/g,  // U+0080 - U+07FF => 2 bytes 110yyyyy, 10zzzzzz
      function(c) {
        var cc = c.charCodeAt(0);
        return String.fromCharCode(0xc0 | cc>>6, 0x80 | cc&0x3f); }
    );
  strUtf = strUtf.replace(
      /[\u0800-\uffff]/g,  // U+0800 - U+FFFF => 3 bytes 1110xxxx, 10yyyyyy, 10zzzzzz
      function(c) {
        var cc = c.charCodeAt(0);
        return String.fromCharCode(0xe0 | cc>>12, 0x80 | cc>>6&0x3F, 0x80 | cc&0x3f); }
    );
  return strUtf;
}

/**
 * Decode utf-8 encoded string back into multi-byte Unicode characters
 *
 * @param {String} strUtf UTF-8 string to be decoded back to Unicode
 * @returns {String} decoded string
 */
Utf8.decode = function(strUtf) {
  // note: decode 3-byte chars first as decoded 2-byte strings could appear to be 3-byte char!
  var strUni = strUtf.replace(
      /[\u00e0-\u00ef][\u0080-\u00bf][\u0080-\u00bf]/g,  // 3-byte chars
      function(c) {  // (note parentheses for precence)
        var cc = ((c.charCodeAt(0)&0x0f)<<12) | ((c.charCodeAt(1)&0x3f)<<6) | ( c.charCodeAt(2)&0x3f);
        return String.fromCharCode(cc); }
    );
  strUni = strUni.replace(
      /[\u00c0-\u00df][\u0080-\u00bf]/g,                 // 2-byte chars
      function(c) {  // (note parentheses for precence)
        var cc = (c.charCodeAt(0)&0x1f)<<6 | c.charCodeAt(1)&0x3f;
        return String.fromCharCode(cc); }
    );
  return strUni;
}

/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -  */


var hMainWnd = AkelPad.GetMainWnd();
var oSys = AkelPad.SystemFunction();
var hWndEdit = AkelPad.GetEditWnd();

if(hMainWnd && !AkelPad.GetEditReadOnly(hWndEdit))
   encryptOrDecrypt();

function encryptOrDecrypt(pass) {
   var text = AkelPad.GetSelText();
   var selectAll = false;
   if(!text) {
      text = getAllText();
      if(!text) {
         var msg = _localize("Nothing to " + (decrypt ? "decrypt" : "encrypt") + "!");
         AkelPad.MessageBox(hMainWnd, msg, WScript.ScriptName, 48 /*MB_ICONEXCLAMATION*/);
         return;
      }
      selectAll = true;
   }

   if(mode == MODE_USER_SELECT) {
      var dirObj = { value: isBase64(text) };
      var pass = passwordPrompt(WScript.ScriptName, _localize("Password"), true, dirObj);
      if(!pass) // Cancel
         return;
      decrypt = dirObj.value;
   }

   if(decrypt) {
      //if(maxLineWidth > 0)
      text = text.replace(/[\n\r]+/g, "");
      if(!isBase64(text)) {
         AkelPad.MessageBox(
            hMainWnd,
            _localize("Impossible to decrypt: invalid format!"),
            WScript.ScriptName,
            16 /*MB_ICONERROR*/
         );
         return;
      }
   }

   if(!pass)
      pass = passwordPrompt(WScript.ScriptName, _localize(decrypt ? "Decrypt" : "Encrypt"), true);
   if(!pass) // Cancel
      return;

   var res = Aes.Ctr[decrypt ? "decrypt" : "encrypt"](text, pass, 256);
   if(!decrypt && maxLineWidth > 0)
      res = res.replace(new RegExp(".{" + maxLineWidth + "}", "g"), "$&\n");

   insertNoScroll(res, selectAll);
}
function isBase64(str) {
   str = str.replace(/[\n\r]+/g, "");
   return str.length % 4 == 0 && !/[^a-zA-Z0-9+\/]/.test(str.replace(/=+$/, ""));
}

function passwordPrompt(caption, label, modal, direction) {
   var hInstanceDLL = AkelPad.GetInstanceDll();
   var dialogClass = "AkelPad::Scripts::" + WScript.ScriptName + "::" + oSys.Call("kernel32::GetCurrentProcessId");

   // Note: "modal" argument is always true now and following should not happens
   var hWndDialog = oSys.Call("user32::FindWindowEx" + _TCHAR, 0, 0, dialogClass, 0);
   if(hWndDialog) {
      if(oSys.Call("user32::IsIconic", hWndDialog))
         oSys.Call("user32::ShowWindow", hWndDialog, 9 /*SW_RESTORE*/);
      AkelPad.SendMessage(hWndDialog, 7 /*WM_SETFOCUS*/, 0, 0);
      return null;
   }

   if(
      !AkelPad.WindowRegisterClass(dialogClass)
      && ( // Previous script instance crashed
         !AkelPad.WindowUnregisterClass(dialogClass)
         || !AkelPad.WindowRegisterClass(dialogClass)
      )
   )
      return null;

   var pass;
   var lpBuffer = AkelPad.MemAlloc(256 * _TSIZE);
   if(!lpBuffer)
      return null;

   var IDC_STATIC      = -1;
   var IDC_ENCRYPT     = 1001;
   var IDC_DECRYPT     = 1002;
   var IDC_PASS        = 1003;
   var IDC_PASS2       = 1004;
   var IDC_PASS2_LABEL = 1005;
   var IDC_SHOWPASS    = 1006;
   var IDC_OK          = 1007;
   var IDC_CANCEL      = 1008;

   var hWndGroupMode, hWndEncrypt, hWndDecrypt;
   var hWndGroup, hWndPassLabel, hWndPass, hWndPass2Label, hWndPass2, hWndShowPass;
   var hWndOK, hWndCancel;

   var addY = direction ? 54 : 0;
   var p2h = direction || !decrypt ? 0 : 52;

   var scale = new Scale(0, hMainWnd);
   var sizeNonClientX = oSys.Call("user32::GetSystemMetrics", 7 /*SM_CXFIXEDFRAME*/)*2;
   var sizeNonClientY = oSys.Call("user32::GetSystemMetrics", 8 /*SM_CYFIXEDFRAME*/)*2
      + oSys.Call("user32::GetSystemMetrics", 4 /*SM_CYCAPTION*/);

   // Create dialog
   hWndDialog = oSys.Call(
      "user32::CreateWindowEx" + _TCHAR,
      0,                                          //dwExStyle
      dialogClass,                                //lpClassName
      0,                                          //lpWindowName
      0x90CA0000,                                 //WS_VISIBLE|WS_POPUP|WS_CAPTION|WS_SYSMENU|WS_MINIMIZEBOX
      scale.x(0),                                 //x
      scale.y(0),                                 //y
      scale.x(252) + sizeNonClientX,              //nWidth
      scale.y(214 + addY - p2h) + sizeNonClientY, //nHeight
      hMainWnd,                                   //hWndParent
      0,                                          //ID
      hInstanceDLL,                               //hInstance
      dialogCallback                              //Script function callback. To use it class must be registered by WindowRegisterClass.
   );
   if(!hWndDialog)
      return null;

   function dialogCallback(hWnd, uMsg, wParam, lParam) {
      switch(uMsg) {
         case 1: //WM_CREATE
            function setWindowFontAndText(hWnd, hFont, pText) {
               AkelPad.SendMessage(hWnd, 48 /*WM_SETFONT*/, hFont, true);
               oSys.Call("user32::SetWindowText" + _TCHAR, hWnd, pText.substr(0, 255));
            }

            var hGuiFont = oSys.Call("gdi32::GetStockObject", 17 /*DEFAULT_GUI_FONT*/);

            // Dialog caption
            oSys.Call("user32::SetWindowText" + _TCHAR, hWnd, caption);

            if(direction) {
               // GroupBox mode
               hWndGroupMode = createWindowEx(
                  0,            //dwExStyle
                  "BUTTON",     //lpClassName
                  0,            //lpWindowName
                  0x50000007,   //WS_VISIBLE|WS_CHILD|BS_GROUPBOX
                  14,           //x
                  13,           //y
                  224,          //nWidth
                  44,           //nHeight
                  hWnd,         //hWndParent
                  IDC_STATIC,   //ID
                  hInstanceDLL, //hInstance
                  0             //lpParam
               );
               setWindowFontAndText(hWndGroupMode, hGuiFont, _localize("Direction"));

               // Radiobutton encrypt
               hWndEncrypt = createWindowEx(
                  0,            //dwExStyle
                  "BUTTON",     //lpClassName
                  0,            //lpWindowName
                  0x50000009,   //WS_VISIBLE|WS_CHILD|BS_AUTORADIOBUTTON
                  26,           //x
                  33,           //y
                  96,           //nWidth
                  16,           //nHeight
                  hWnd,         //hWndParent
                  IDC_ENCRYPT,  //ID
                  hInstanceDLL, //hInstance
                  0             //lpParam
               );
               setWindowFontAndText(hWndEncrypt, hGuiFont, _localize("&Encrypt"));
               checked(hWndEncrypt, !direction.value);

               // Radiobutton decrypt
               hWndDecrypt = createWindowEx(
                  0,            //dwExStyle
                  "BUTTON",     //lpClassName
                  0,            //lpWindowName
                  0x50000009,   //WS_VISIBLE|WS_CHILD|BS_AUTORADIOBUTTON
                  128,          //x
                  33,           //y
                  96,           //nWidth
                  16,           //nHeight
                  hWnd,         //hWndParent
                  IDC_DECRYPT,  //ID
                  hInstanceDLL, //hInstance
                  0             //lpParam
               );
               setWindowFontAndText(hWndDecrypt, hGuiFont, _localize("&Decrypt"));
               //checked(hWndDecrypt, mode == MODE_DECRYPT);
               checked(hWndDecrypt, direction.value);
            }

            // GroupBox
            hWndGroup = createWindowEx(
               0,            //dwExStyle
               "BUTTON",     //lpClassName
               0,            //lpWindowName
               0x50000007,   //WS_VISIBLE|WS_CHILD|BS_GROUPBOX
               14,           //x
               13 + addY,    //y
               224,          //nWidth
               152 - p2h,    //nHeight
               hWnd,         //hWndParent
               IDC_STATIC,   //ID
               hInstanceDLL, //hInstance
               0             //lpParam
            );
            setWindowFontAndText(hWndGroup, hGuiFont, label);

            // Static window: password label
            hWndPassLabel = createWindowEx(
               0,            //dwExStyle
               "STATIC",     //lpClassName
               0,            //lpWindowName
               0x50000000,   //WS_VISIBLE|WS_CHILD
               32,           //x
               35 + addY,    //y
               177,          //nWidth
               13,           //nHeight
               hWnd,         //hWndParent
               IDC_STATIC,   //ID
               hInstanceDLL, //hInstance
               0             //lpParam
            );
            setWindowFontAndText(hWndPassLabel, hGuiFont, _localize("Enter &password:"));

            // Edit window: password
            hWndPass = createWindowEx(
               0x200,        //WS_EX_CLIENTEDGE
               "EDIT",       //lpClassName
               0,            //lpWindowName
               0x500100A0,   //WS_VISIBLE|WS_CHILD|WS_TABSTOP|ES_AUTOHSCROLL|ES_PASSWORD
               29,           //x
               53 + addY,    //y
               195,          //nWidth
               23,           //nHeight
               hWnd,         //hWndParent
               IDC_PASS,     //ID
               hInstanceDLL, //hInstance
               0             //lpParam
            );
            setWindowFontAndText(hWndPass, hGuiFont, "");

            if(direction || !decrypt) {
               // Static window: password 2 label
               hWndPass2Label = createWindowEx(
                  0,               //dwExStyle
                  "STATIC",        //lpClassName
                  0,               //lpWindowName
                  0x50000000,      //WS_VISIBLE|WS_CHILD
                  32,              //x
                  86 + addY,       //y
                  177,             //nWidth
                  13,              //nHeight
                  hWnd,            //hWndParent
                  IDC_PASS2_LABEL, //ID
                  hInstanceDLL,    //hInstance
                  0                //lpParam
               );
               setWindowFontAndText(hWndPass2Label, hGuiFont, _localize("Reenter p&assword:"));

               // Edit window: password 2
               hWndPass2 = createWindowEx(
                  0x200,        //WS_EX_CLIENTEDGE
                  "EDIT",       //lpClassName
                  0,            //lpWindowName
                  0x500100A0,   //WS_VISIBLE|WS_CHILD|WS_TABSTOP|ES_AUTOHSCROLL|ES_PASSWORD
                  29,           //x
                  104 + addY,   //y
                  195,          //nWidth
                  23,           //nHeight
                  hWnd,         //hWndParent
                  IDC_PASS2,    //ID
                  hInstanceDLL, //hInstance
                  0             //lpParam
               );
               setWindowFontAndText(hWndPass2, hGuiFont, "");
            }

            // Checkbox: show password
            hWndShowPass = createWindowEx(
               0,                //dwExStyle
               "BUTTON",         //lpClassName
               0,                //lpWindowName
               0x50010003,       //WS_VISIBLE|WS_CHILD|WS_TABSTOP|BS_AUTOCHECKBOX
               32,               //x
               138 + addY - p2h, //y
               177,              //nWidth
               16,               //nHeight
               hWnd,             //hWndParent
               IDC_SHOWPASS,     //ID
               hInstanceDLL,     //hInstance
               0                 //lpParam
            );
            setWindowFontAndText(hWndShowPass, hGuiFont, _localize("&Show password"));
            var sp = showPassword === undefined
               ? saveOptions
                  ? pref("showPassword", 1 /*PO_DWORD*/) == 1
                  : false
               : showPassword;
            checked(hWndShowPass, sp);
            setShowPass(sp, direction ? !direction.value : !decrypt);

            // OK button window
            hWndOK = createWindowEx(
               0,                //dwExStyle
               "BUTTON",         //lpClassName
               0,                //lpWindowName
               0x50010001,       //WS_VISIBLE|WS_CHILD|WS_TABSTOP|BS_DEFPUSHBUTTON
               13,               //x
               178 + addY - p2h, //y
               107,              //nWidth
               23,               //nHeight
               hWnd,             //hWndParent
               IDC_OK,           //ID
               hInstanceDLL,     //hInstance
               0                 //lpParam
            );
            setWindowFontAndText(hWndOK, hGuiFont, _localize("OK"));

            // Cancel button window
            hWndCancel = createWindowEx(
               0,                //dwExStyle
               "BUTTON",         //lpClassName
               0,                //lpWindowName
               0x50010000,       //WS_VISIBLE|WS_CHILD|WS_TABSTOP
               132,              //x
               178 + addY - p2h, //y
               107,              //nWidth
               23,               //nHeight
               hWnd,             //hWndParent
               IDC_CANCEL,       //ID
               hInstanceDLL,     //hInstance
               0                 //lpParam
            );
            setWindowFontAndText(hWndCancel, hGuiFont, _localize("Cancel"));

            oSys.Call("user32::PostMessage" + _TCHAR, hWnd, 273 /*WM_COMMAND*/, IDC_PASS, 0);

            //centerWindow(hMainWnd, hWnd);
            centerWindow(null, hWnd);
         break;
         case 7: //WM_SETFOCUS
            var hWndFocus = hWndPass;
            if(direction) {
               if(checked(hWndEncrypt))      hWndFocus = hWndEncrypt;
               else if(checked(hWndDecrypt)) hWndFocus = hWndDecrypt;
            }
            oSys.Call("user32::SetFocus", hWndFocus);
         break;
         case 256: //WM_KEYDOWN
            if(wParam == 27) //VK_ESCAPE
               oSys.Call("user32::PostMessage" + _TCHAR, hWnd, 273 /*WM_COMMAND*/, IDC_CANCEL, 0);
            else if(wParam == 13) //VK_RETURN
               oSys.Call("user32::PostMessage" + _TCHAR, hWnd, 273 /*WM_COMMAND*/, IDC_OK, 0);
         break;
         case 273: //WM_COMMAND
            switch(wParam & 0xffff) {
               case IDC_OK:
                  oSys.Call("user32::GetWindowText" + _TCHAR, hWndPass, lpBuffer, 256);
                  var pass1 = AkelPad.MemRead(lpBuffer, _TSTR);
                  if(!pass1)
                     break;
                  var showPass = checked(hWndShowPass);
                  var enc = direction ? checked(hWndEncrypt) : !decrypt;
                  if(!showPass && enc) {
                     oSys.Call("user32::GetWindowText" + _TCHAR, hWndPass2, lpBuffer, 256);
                     var pass2 = AkelPad.MemRead(lpBuffer, _TSTR);
                     if(pass1 != pass2) {
                        AkelPad.MessageBox(
                           hWnd,
                           _localize("Passwords do not match!"),
                           WScript.ScriptName,
                           16 /*MB_ICONERROR*/
                        );
                        break;
                     }
                  }
                  if(direction && !readRadiosState())
                     break;
                  saveOptions && pref("showPassword", 1 /*PO_DWORD*/, Number(showPass));
                  pass = pass1;
                  closeDialog();
               break;
               case IDC_CANCEL:
                  closeDialog();
               break;
               case IDC_SHOWPASS:
               case IDC_ENCRYPT:
               case IDC_DECRYPT:
                  setShowPass(checked(hWndShowPass), direction ? checked(hWndEncrypt) : !decrypt);
               break;
               case IDC_PASS:
               case IDC_PASS2:
                  var hasPass = oSys.Call("user32::GetWindowTextLength" + _TCHAR, hWndPass) > 0;
                  enabled(hWndOK,    hasPass);
                  enabled(hWndPass2, hasPass);
            }
         break;
         case 16: //WM_CLOSE
            modal && enabled(hMainWnd, true); // Enable main window
            oSys.Call("user32::DestroyWindow", hWnd); // Destroy dialog
         break;
         case 2: //WM_DESTROY
            oSys.Call("user32::PostQuitMessage", 0); // Exit message loop
      }
      return 0;
   }
   function centerWindow(hWndParent, hWnd) {
      var lpRect = AkelPad.MemAlloc(16); //sizeof(RECT)
      if(!lpRect)
         return;
      if(!hWndParent)
         hWndParent = oSys.Call("user32::GetDesktopWindow");
      oSys.Call("user32::GetWindowRect", hWndParent, lpRect);
      var rcWndParent = parseRect(lpRect);
      oSys.Call("user32::GetWindowRect", hWnd, lpRect);
      var rcWnd = parseRect(lpRect);
      var x = rcWndParent.left + ((rcWndParent.right  - rcWndParent.left) / 2 - (rcWnd.right  - rcWnd.left) / 2);
      var y = rcWndParent.top  + ((rcWndParent.bottom - rcWndParent.top)  / 2 - (rcWnd.bottom - rcWnd.top)  / 2);
      oSys.Call("user32::SetWindowPos", hWnd, 0, x, y, 0, 0, 0x15 /*SWP_NOZORDER|SWP_NOACTIVATE|SWP_NOSIZE*/);
      AkelPad.MemFree(lpRect);
   }
   function parseRect(lpRect) {
      return {
         left:   AkelPad.MemRead(lpRect,      3 /*DT_DWORD*/),
         top:    AkelPad.MemRead(lpRect +  4, 3 /*DT_DWORD*/),
         right:  AkelPad.MemRead(lpRect +  8, 3 /*DT_DWORD*/),
         bottom: AkelPad.MemRead(lpRect + 12, 3 /*DT_DWORD*/)
      };
   }
   function readRadiosState() {
      if(checked(hWndEncrypt))
         direction.value = false;
      else if(checked(hWndDecrypt))
         direction.value = true;
      else
         return false;
      return true;
   }
   function checked(hWnd, val) {
      return arguments.length == 1
         ? AkelPad.SendMessage(hWnd, 240 /*BM_GETCHECK*/, 0, 0)
         : AkelPad.SendMessage(hWnd, 241 /*BM_SETCHECK*/, val ? 1 /*BST_CHECKED*/ : 0, 0);
   }
   function enabled(hWnd, val) {
      oSys.Call("user32::EnableWindow", hWnd, val);
   }
   function showWindow(hWnd, val) {
      oSys.Call("user32::ShowWindow", hWnd, val);
   }
   function closeDialog() {
      oSys.Call("user32::PostMessage" + _TCHAR, hWndDialog, 16 /*WM_CLOSE*/, 0, 0);
   }
   function setShowPass(showPass, showSecondField) {
      showSecondField = !showPass && showSecondField;
      hWndPass2Label && showWindow(hWndPass2Label, showSecondField);
      hWndPass2      && showWindow(hWndPass2,      showSecondField);
      if(!setShowPass.passChar)
         setShowPass.passChar = AkelPad.SendMessage(hWndPass, 0x00D2/*EM_GETPASSWORDCHAR*/, 0, 0) || 0x002A;
      var passChar = showPass ? 0 : setShowPass.passChar;
      AkelPad.SendMessage(hWndPass, 0x00CC/*EM_SETPASSWORDCHAR*/, passChar, 0);
      oSys.Call("user32::InvalidateRect", hWndPass, 0, 1/*TRUE*/);
   }

   function Scale(hDC, hWnd) {
      var hNewDC = hDC || oSys.Call("user32::GetDC", hWnd);
      if(hNewDC) {
         this._x = oSys.Call("gdi32::GetDeviceCaps", hNewDC, 88 /*LOGPIXELSX*/);
         this._y = oSys.Call("gdi32::GetDeviceCaps", hNewDC, 90 /*LOGPIXELSY*/);

         //Align to 16 pixel
         this._x += this._x % 16;
         this._y += this._y % 16;

         !hDC && oSys.Call("user32::ReleaseDC", hWnd, hNewDC);

         this.x = function(x) {
            return oSys.Call("kernel32::MulDiv", x, this._x, 96);
         };
         this.y = function(y) {
            return oSys.Call("kernel32::MulDiv", y, this._y, 96);
         };
      }
      else {
         this.x = this.y = function(n) {
            return n;
         };
      }
   }
   function createWindowEx(
      dwExStyle, lpClassName, lpWindowName, dwStyle,
      x, y, w, h,
      hWndParent, id, hInstance, callback
   ) {
      return oSys.Call(
         "user32::CreateWindowEx" + _TCHAR,
         dwExStyle,
         lpClassName,
         lpWindowName,
         dwStyle,
         scale.x(x),
         scale.y(y),
         scale.x(w),
         scale.y(h),
         hWndParent,
         id,
         hInstance,
         callback || 0
      );
   }

   modal && enabled(hMainWnd, false); // Disable main window, to make dialog modal

   AkelPad.ScriptNoMutex(); // Allow other scripts running
   AkelPad.WindowGetMessage(); // Message loop

   AkelPad.MemFree(lpBuffer);
   AkelPad.WindowUnregisterClass(dialogClass);
   return pass;
}

function getAllText() {
   if(typeof AkelPad.GetTextRange != "undefined")
      return AkelPad.GetTextRange(0, -1);
   var lpPoint = AkelPad.MemAlloc(8 /*sizeof(POINT)*/);
   if(!lpPoint)
      return "";
   setRedraw(hWndEdit, false);
   AkelPad.SendMessage(hWndEdit, 1245 /*EM_GETSCROLLPOS*/, 0, lpPoint);

   var columnSel = AkelPad.SendMessage(hWndEdit, 3127 /*AEM_GETCOLUMNSEL*/, 0, 0);
   var ss = AkelPad.GetSelStart();
   var se = AkelPad.GetSelEnd();

   AkelPad.SetSel(0, -1);
   var str = AkelPad.GetSelText();

   AkelPad.SetSel(ss, se);
   columnSel && AkelPad.SendMessage(hWndEdit, 3128 /*AEM_UPDATESEL*/, 0x1 /*AESELT_COLUMNON*/, 0);

   AkelPad.SendMessage(hWndEdit, 1246 /*EM_SETSCROLLPOS*/, 0, lpPoint);
   AkelPad.MemFree(lpPoint);
   setRedraw(hWndEdit, true);
   return str;
}
function insertNoScroll(str, selectAll) {
   var lpPoint = AkelPad.MemAlloc(8 /*sizeof(POINT)*/);
   if(!lpPoint)
      return;
   setRedraw(hWndEdit, false);
   AkelPad.SendMessage(hWndEdit, 1245 /*EM_GETSCROLLPOS*/, 0, lpPoint);

   selectAll && AkelPad.SetSel(0, -1);
   //var ss = AkelPad.GetSelStart();
   AkelPad.ReplaceSel(str, true);
   //if(ss != AkelPad.GetSelStart())
   //   AkelPad.SetSel(ss, ss + str.length);

   AkelPad.SendMessage(hWndEdit, 1246 /*EM_SETSCROLLPOS*/, 0, lpPoint);
   setRedraw(hWndEdit, true);
   AkelPad.MemFree(lpPoint);
}
function setRedraw(hWnd, bRedraw) {
   AkelPad.SendMessage(hWnd, 11 /*WM_SETREDRAW*/, bRedraw, 0);
   bRedraw && oSys.Call("user32::InvalidateRect", hWnd, 0, true);
}
function pref(name, type, val) {
   var oSet = AkelPad.ScriptSettings();
   if(arguments.length == 3) {
      if(!oSet.Begin(WScript.ScriptBaseName, 0x2 /*POB_SAVE*/))
         return false;
      var ok = oSet.Write(name, type, val);
      oSet.End();
      return ok;
   }
   if(!oSet.Begin(WScript.ScriptBaseName, 0x1 /*POB_READ*/))
      return undefined;
   var ret = oSet.Read(name, type || 1 /*PO_DWORD*/);
   oSet.End();
   return ret;
}
function getArg(argName, defaultVal) {
   var args = {};
   for(var i = 0, argsCount = WScript.Arguments.length; i < argsCount; i++)
      if(/^[-\/](\w+)(=(.+))?$/i.test(WScript.Arguments(i)))
         args[RegExp.$1.toLowerCase()] = RegExp.$3 ? eval(RegExp.$3) : true;
   getArg = function(argName, defaultVal) {
      argName = argName.toLowerCase();
      return typeof args[argName] == "undefined" // argName in args
         ? defaultVal
         : args[argName];
   };
   return getArg(argName, defaultVal);
}
<download> (see crypt.js)
Encrypt/decrypt text using AES-256.
It can be very slow, be careful.


Last edited by Infocatcher on Fri May 11, 2012 6:04 pm; edited 4 times in total
Back to top
View user's profile Send private message
Infocatcher



Joined: 06 Aug 2007
Posts: 1559

PostPosted: Sun Jan 30, 2011 11:05 pm    Post subject: Reply with quote

insertTag.js
Code:
// http://akelpad.sourceforge.net/forum/viewtopic.php?p=11213#11213
// http://infocatcher.ucoz.net/js/akelpad_scripts/insertTag.js
// https://github.com/Infocatcher/AkelPad_scripts/blob/master/insertTag.js

// (c) Infocatcher 2009-2012, 2014
// version 0.2.5 - 2014-03-30

//===================
// Simplify tags insertion.
// By default ask user for tag and insert
// <tag>{selected_text}</tag>

// Arguments:
//   -bbcode=0                            - Use <tag>
//          =1                            - Use [tag]
//          =-1                           - Autodetection
//   -xmlExts="[sx]html?|mht(ml)?|xml"    - Mask for file extension or Coder plugin alias (for -bbcode=-1)
//   -clip=true                           - Use text from clipboard instead of selected text
//   -selectMode=0                        - Select all inserted text: [<tag>text</tag>]
//              =1                        - Select text inside tags:  <tag>[text]</tag>
//   -tag="div"                           - Don't ask tag
//   -template="<a href=\"%%|\">%%S</a>"  - Use template (and ignore all other arguments)
//   -saveLastTag=0                       - don't save last used tag
//               =1                       - save only typed (default)
//               =2                       - always save

// Special variables in templates:
//   %|  - selection start or end
//   %S  - selected text
//   %C  - clipboard text
//   %SC - selected text or clipboard text
//   %CS - clipboard text or selected text

// Usage:
//   Call("Scripts::Main", 1, "insertTag.js")
//   Call("Scripts::Main", 1, "insertTag.js", `-bbcode=1 -tag="quote"`)
//   Call("Scripts::Main", 1, "insertTag.js", `'-template="<a href=\"%%C\">%%|%%S%%|</a>"'`)
//===================

function _localize(s) {
   var strings = {
      "Tag or template:": {
         ru: "Тэг или шаблон:"
      }
   };
   var lng = "en";
   switch(AkelPad.GetLangId(1 /*LANGID_PRIMARY*/)) {
      case 0x19: lng = "ru";
   }
   _localize = function(s) {
      return strings[s] && strings[s][lng] || s;
   };
   return _localize(s);
}

// Read arguments:
// getArg(argName, defaultValue)
var useBBCode    = getArg("bbcode", -1);
var xmlExts      = getArg("xmlExts", "[xs]?html?|mht(ml)?|hta|asp|jsm?|css|xml|axl|dxl|fb2|kml|manifest|msc|ndl|rdf|rss|svg|user|wsdl|xaml|xmp|xsd|xslt?|xul|resx|v[cbd]proj|csproj|wx[ils]|wixobj|wixout|wixlib|wixpdb|wixmsp|wixmst");
var useClipboard = getArg("clip", false);
var selectMode   = getArg("selectMode", 0);
var tag          = getArg("tag"); // Override tag prompt
var template     = getArg("template"); // Use template and ignore all arguments except -bbcode=-1 (and -xmlExts)
var saveLastTag  = getArg("saveLastTag", 1);


var hMainWnd = AkelPad.GetMainWnd();
var hWndEdit = AkelPad.GetEditWnd();
var oSys = AkelPad.SystemFunction();

if(hMainWnd && !AkelPad.GetEditReadOnly(hWndEdit))
   insertTag();

function insertTag() {
   var txt, ss, se;
   if(template) {
      // Example: <a href="%C">%|%S%|</a>
      if(useBBCode == -1) {
         template = detectBBCode()
            ? template.replace(/</g, "[").replace(/>/g, "]")
            : template.replace(/\[/g, "<").replace(/\]/g, ">");
      }

      var rnd = function() {
         return Math.random().toString(36).substr(2) + Math.random().toString(36).substr(2);
      };
      var posMarker = rnd();
      var percent   = rnd();

      var sel  = /%C?S/.test(template) && AkelPad.GetSelText();
      var clip = /%S?C/.test(template) && AkelPad.GetClipboardText();

      txt = template
         .replace(/%%/g, percent)
         .replace(/%\|/g, posMarker)
         .replace(/%SC/g, sel || clip)
         .replace(/%CS/g, clip || sel)
         .replace(/%S/g, sel)
         .replace(/%C/g, clip)
         .replace(new RegExp(percent, "g"), "%");

      var posMarkerRe = new RegExp(posMarker);
      if(posMarkerRe.test(txt)) {
         ss = se = AkelPad.GetSelStart() + RegExp.leftContext.length;
         txt = RegExp.leftContext + RegExp.rightContext;
      }
      if(posMarkerRe.test(txt)) {
         se = AkelPad.GetSelStart() + RegExp.leftContext.length;
         txt = RegExp.leftContext + RegExp.rightContext;
      }
   }
   else {
      txt = useClipboard
         ? AkelPad.GetClipboardText()
         : AkelPad.GetSelText();
      var hasTxt = !!txt;

      if(!tag) {
         var tagTyped = true;
         tag = AkelPad.InputBox(
            hMainWnd,
            WScript.ScriptName,
            _localize("Tag or template:"),
            saveLastTag && pref("lastTag", 3 /*PO_STRING*/) || ""
         );
      }
      if(!tag)
         return;
      if(saveLastTag && (tagTyped || saveLastTag == 2))
         pref("lastTag", 3 /*PO_STRING*/, tag);

      if(tagTyped && /%[%|SC]/.test(tag)) {
         template = tag;
         insertTag();
         return;
      }

      if(tagTyped) {
         var first = tag.charAt(0);
         if(first == "<" || first == "[") {
            useBBCode = first == "[";
            tag = tag.substr(1);
         }
      }

      if(useBBCode == -1)
         useBBCode = detectBBCode();

      var attrs = /^([^\s=]+)([\s=].*)$/.test(tag) ? RegExp.$2 : "";
      if(attrs)
         tag = RegExp.$1;

      var sTag = (useBBCode ? "["  : "<")  + tag + attrs + (useBBCode ? "]" : ">");
      var eTag = (useBBCode ? "[/" : "</") + tag         + (useBBCode ? "]" : ">");
      txt = sTag + txt + eTag;

      if(!hasTxt || selectMode == 1) {
         var _ss = AkelPad.GetSelStart();
         ss = _ss + sTag.length;
         se = _ss + txt.length - eTag.length;
      }
   }
   insertNoScroll(txt, ss, se);
}
function detectBBCode() {
   var file = AkelPad.GetEditFile(0);
   if(!file)
      file = getCoderAlias();
   else if(/\.[^.]*$/.test(file))
      file = RegExp.lastMatch;
   return !new RegExp("\\.(" + xmlExts + ")$", "i").test(file);
}
function getCoderAlias() {
   // http://akelpad.sourceforge.net/forum/viewtopic.php?p=19363#19363
   var hWndEdit = AkelPad.GetEditWnd();
   var hDocEdit = AkelPad.GetEditDoc();
   var pAlias = "";
   if(hWndEdit && hDocEdit) {
      var lpAlias = AkelPad.MemAlloc(256 * 2 /*sizeof(wchar_t)*/);
      if(lpAlias) {
         AkelPad.CallW("Coder::Settings", 18 /*DLLA_CODER_GETALIAS*/, hWndEdit, hDocEdit, lpAlias, 0);
         pAlias = AkelPad.MemRead(lpAlias, 1 /*DT_UNICODE*/);
         AkelPad.MemFree(lpAlias);
      }
   }
   return pAlias;
}

function insertNoScroll(str, ss, se) {
   var nFirstLine = saveLineScroll(hWndEdit);

   //var ss = AkelPad.GetSelStart();
   AkelPad.ReplaceSel(str, true);
   //if(ss != AkelPad.GetSelStart())
   //   AkelPad.SetSel(ss, ss + str.length);

   if(ss != undefined || se != undefined) {
      if(ss == undefined) ss = AkelPad.GetSelStart();
      if(se == undefined) se = AkelPad.GetSelEnd();
      AkelPad.SetSel(ss, se);
   }

   restoreLineScroll(hWndEdit, nFirstLine);
}
// From Instructor's SearchReplace.js
function saveLineScroll(hWnd)
{
   AkelPad.SendMessage(hWnd, 11 /*WM_SETREDRAW*/, false, 0);
   return AkelPad.SendMessage(hWnd, 3129 /*AEM_GETLINENUMBER*/, 4 /*AEGL_FIRSTVISIBLELINE*/, 0);
}
function restoreLineScroll(hWnd, nBeforeLine)
{
   if (AkelPad.SendMessage(hWnd, 3129 /*AEM_GETLINENUMBER*/, 4 /*AEGL_FIRSTVISIBLELINE*/, 0) != nBeforeLine)
   {
      var lpScrollPos;
      var nPosY=AkelPad.SendMessage(hWnd, 3198 /*AEM_VPOSFROMLINE*/, 0 /*AECT_GLOBAL*/, nBeforeLine);

      if (lpScrollPos=AkelPad.MemAlloc(_X64?16:8 /*sizeof(POINT64)*/))
      {
         AkelPad.MemCopy(lpScrollPos + 0 /*offsetof(POINT64, x)*/, -1, 2 /*DT_QWORD*/);
         AkelPad.MemCopy(lpScrollPos + (_X64?8:4) /*offsetof(POINT64, y)*/, nPosY, 2 /*DT_QWORD*/);
         AkelPad.SendMessage(hWnd, 3180 /*AEM_SETSCROLLPOS*/, 0, lpScrollPos);
         AkelPad.MemFree(lpScrollPos);
      }
   }
   AkelPad.SendMessage(hWnd, 3377 /*AEM_UPDATECARET*/, 0, 0);
   AkelPad.SendMessage(hWnd, 11 /*WM_SETREDRAW*/, true, 0);
   oSys.Call("user32::InvalidateRect", hWnd, 0, true);
}

function getArg(argName, defaultVal) {
   var args = {};
   for(var i = 0, argsCount = WScript.Arguments.length; i < argsCount; i++)
      if(/^[-\/](\w+)(=(.+))?$/i.test(WScript.Arguments(i)))
         args[RegExp.$1.toLowerCase()] = RegExp.$3 ? eval(RegExp.$3) : true;
   getArg = function(argName, defaultVal) {
      argName = argName.toLowerCase();
      return typeof args[argName] == "undefined" // argName in args
         ? defaultVal
         : args[argName];
   };
   return getArg(argName, defaultVal);
}
function pref(name, type, val) {
   var oSet = AkelPad.ScriptSettings();
   if(arguments.length == 3) {
      if(!oSet.Begin(WScript.ScriptBaseName, 0x2 /*POB_SAVE*/))
         return false;
      var ok = oSet.Write(name, type, val);
      oSet.End();
      return ok;
   }
   if(!oSet.Begin(WScript.ScriptBaseName, 0x1 /*POB_READ*/))
      return undefined;
   var ret = oSet.Read(name, type || 1 /*PO_DWORD*/);
   oSet.End();
   return ret;
}
<download | mirror | development version>
Simplify tags insertion.
By default ask user for tag and insert
<tag>{selected_text}</tag>


Last edited by Infocatcher on Sun Mar 30, 2014 5:05 pm; edited 5 times in total
Back to top
View user's profile Send private message
Infocatcher



Joined: 06 Aug 2007
Posts: 1559

PostPosted: Tue Feb 01, 2011 6:43 pm    Post subject: Reply with quote

replaceDiacriticLetters.js
Code:
// http://akelpad.sourceforge.net/forum/viewtopic.php?p=11240#11240

// (c) Infocatcher 2008, 2011-2012
// version 0.1.2 - 2012-12-11

var map = {
   "à": "a",
   "À": "A",
   "á": "a",
   "Á": "A",
   "â": "a",
   "Â": "A",
   "ã": "a",
   "Ã": "A",
   "ä": "a",
   "Ä": "A",
   "å": "a",
   "Å": "A",
   "æ": "ae",
   "Æ": "AE",
   "ç": "c",
   "Ç": "C",
   "È": "E",
   "è": "e",
   "é": "e",
   "É": "E",
   "ê": "e",
   "Ê": "E",
   "ë": "e",
   "Ë": "E",
   "Ì": "I",
   "ì": "i",
   "í": "i",
   "Í": "I",
   "î": "i",
   "Î": "I",
   "Ï": "I",
   "ï": "i",
   "Ð": "D",
   "ð": "d",
   "ñ": "n",
   "Ñ": "N",
   "Ò": "O",
   "ò": "o",
   "Ó": "O",
   "Ó": "O",
   "ó": "o",
   "ó": "o",
   "ô": "o",
   "Ô": "O",
   "Õ": "O",
   "õ": "o",
   "ö": "o",
   "Ö": "O",
   "ù": "u",
   "Ù": "U",
   "Ú": "U",
   "ú": "u",
   "û": "u",
   "Û": "U",
   "ü": "u",
   "Ü": "U",
   "ý": "y",
   "Ý": "Y",
   "ÿ": "y",
   "Ÿ": "Y",
   "ā": "a",
   "Ā": "A",
   "ă": "a",
   "Ă": "A",
   "Ą": "A",
   "Ą": "A",
   "ą": "a",
   "ą": "a",
   "Ć": "C",
   "ć": "c",
   "Ć": "C",
   "ć": "c",
   "ĉ": "c",
   "Ĉ": "C",
   "Ċ": "C",
   "ċ": "c",
   "č": "c",
   "Č": "C",
   "ď": "d",
   "Ď": "D",
   "Đ": "D",
   "đ": "d",
   "Ē": "E",
   "ē": "e",
   "ĕ": "e",
   "Ĕ": "E",
   "ė": "e",
   "Ė": "E",
   "ę": "e",
   "Ę": "E",
   "Ę": "E",
   "ę": "e",
   "Ě": "E",
   "ě": "e",
   "ĝ": "g",
   "Ĝ": "G",
   "ğ": "g",
   "Ğ": "G",
   "ġ": "g",
   "Ġ": "G",
   "ģ": "g",
   "Ģ": "G",
   "Ĥ": "H",
   "ĥ": "h",
   "ħ": "h",
   "Ħ": "H",
   "ĩ": "i",
   "Ĩ": "I",
   "ī": "i",
   "Ī": "I",
   "Ĭ": "I",
   "ĭ": "i",
   "Į": "I",
   "į": "i",
   "İ": "I",
   "ı": "i",
   "ij": "ij",
   "IJ": "IJ",
   "ĵ": "j",
   "Ĵ": "J",
   "ķ": "k",
   "Ķ": "K",
   "ĸ": "k",
   "ĺ": "l",
   "Ĺ": "L",
   "Ļ": "L",
   "ļ": "l",
   "Ľ": "L",
   "ľ": "l",
   "Ŀ": "L",
   "ŀ": "l",
   "Ł": "L",
   "ł": "l",
   "Ł": "L",
   "ł": "l",
   "ń": "n",
   "Ń": "N",
   "ń": "n",
   "Ń": "N",
   "ņ": "n",
   "Ņ": "N",
   "ň": "n",
   "Ň": "N",
   "ʼn": "n",
   "Ō": "O",
   "ō": "o",
   "Ŏ": "O",
   "ŏ": "o",
   "ő": "o",
   "Ő": "O",
   "œ": "oe",
   "Œ": "OE",
   "Ŕ": "R",
   "ŕ": "r",
   "ŗ": "r",
   "Ŗ": "R",
   "ř": "r",
   "Ř": "R",
   "Ś": "S",
   "ś": "s",
   "ś": "s",
   "Ś": "S",
   "ŝ": "s",
   "Ŝ": "S",
   "ş": "s",
   "Ş": "S",
   "š": "s",
   "Š": "S",
   "Ţ": "T",
   "ţ": "t",
   "ť": "t",
   "Ť": "T",
   "ŧ": "t",
   "Ŧ": "T",
   "ũ": "u",
   "Ũ": "U",
   "Ū": "U",
   "ū": "u",
   "ŭ": "u",
   "Ŭ": "U",
   "ů": "u",
   "Ů": "U",
   "Ű": "U",
   "ű": "u",
   "Ų": "U",
   "ų": "u",
   "ŵ": "w",
   "Ŵ": "W",
   "ŷ": "Y",
   "Ŷ": "Y",
   "Ź": "Z",
   "Ź": "Z",
   "ź": "z",
   "ź": "z",
   "ż": "z",
   "Ż": "Z",
   "Ż": "Z",
   "ż": "z",
   "ž": "z",
   "Ž": "Z",
   "ƀ": "b",
   "ƈ": "c",
   "Ƈ": "C",
   "ƒ": "f",
   "Ƒ": "F",
   "Ƙ": "K",
   "ƙ": "k",
   "ơ": "o",
   "Ơ": "O",
   "ƥ": "p",
   "Ƥ": "P",
   "ƫ": "t",
   "ƭ": "t",
   "Ƭ": "T",
   "Ư": "U",
   "ư": "u",
   "Ƶ": "Z",
   "ƶ": "z",
   "DŽ": "DZ",
   "Dž": "Dz",
   "dž": "dz",
   "Lj": "Lj",
   "LJ": "LJ",
   "lj": "lj",
   "Nj": "Nj",
   "nj": "nj",
   "NJ": "NJ",
   "ǎ": "a",
   "Ǎ": "A",
   "ǐ": "i",
   "Ǐ": "I",
   "Ǒ": "O",
   "ǒ": "o",
   "Ǔ": "U",
   "ǔ": "u",
   "ǖ": "u",
   "Ǖ": "U",
   "ǘ": "u",
   "Ǘ": "U",
   "Ǚ": "U",
   "ǚ": "u",
   "Ǜ": "U",
   "ǜ": "u",
   "ǝ": "e",
   "ǟ": "a",
   "Ǟ": "A",
   "ǡ": "a",
   "Ǡ": "A",
   "ǣ": "ae",
   "Ǣ": "AE",
   "ǥ": "g",
   "Ǥ": "G",
   "ǧ": "g",
   "Ǧ": "G",
   "ǩ": "k",
   "Ǩ": "K",
   "ǫ": "o",
   "Ǫ": "O",
   "ǭ": "o",
   "Ǭ": "O",
   "Ǯ": "Z",
   "ǰ": "J",
   "ǯ": "z",
   "DZ": "DZ",
   "Dz": "Dz",
   "dz": "dz",
   "Ǵ": "G",
   "ǵ": "g",
   "Ǻ": "A",
   "ǻ": "a",
   "Ǽ": "AE",
   "ǽ": "ae",
   "Ǿ": "O",
   "ǿ": "o",
   "Ȁ": "A",
   "ȁ": "a",
   "Ȃ": "A",
   "ȃ": "a",
   "Ȅ": "E",
   "ȅ": "e",
   "Ȇ": "E",
   "ȇ": "e",
   "ȉ": "i",
   "Ȉ": "I",
   "Ȋ": "I",
   "ȋ": "i",
   "Ȍ": "O",
   "ȍ": "o",
   "ȏ": "o",
   "Ȏ": "O",
   "Ȑ": "R",
   "ȑ": "r",
   "Ȓ": "R",
   "ȓ": "r",
   "ȕ": "u",
   "Ȕ": "U",
   "ȗ": "u",
   "Ȗ": "U",
   "ɐ": "a",
   "ɑ": "a",
   "ɒ": "a",
   "Ɓ": "B",
   "Ɖ": "D",
   "ɖ": "d",
   "Ɗ": "D",
   "ɗ": "d",
   "ɛ": "e",
   "Ɠ": "G",
   "Ʀ": "R",
   "Ʈ": "T",
   "ʤ": "dz",
   "ʣ": "dz",
   "ʥ": "dz",
   "ʦ": "ts",
   "ʧ": "tf",
   "ΐ": "i",
   "Ά": "A",
   "Έ": "E",
   "Ή": "H",
   "Ί": "I",
   "ϊ": "i",
   "ϋ": "u",
   "Ό": "O",
   "ό": "o",
   "ύ": "u",
   "Ύ": "Y",
   "і": "i",
   "ї": "i",
   "ј": "j",
   "ќ": "k",
   "ў": "y",
   "ӑ": "a",
   "Ӑ": "A",
   "Ӓ": "A",
   "ӓ": "a",
   "ӕ": "ae",
   "Ӕ": "AE",
   "Ӗ": "E",
   "ӗ": "e"
};

function replaceLetters(str) {
   for(var s in map)
      str = str.replace(new RegExp(s, "g"), map[s]);
   return str;
}

var hMainWnd = AkelPad.GetMainWnd();
var hWndEdit = AkelPad.GetEditWnd();
var oSys = AkelPad.SystemFunction();

if(hMainWnd && !AkelPad.GetEditReadOnly(hWndEdit)) {
   var text = AkelPad.GetSelText();
   if(!text) {
      var selectAll = true;
      text = AkelPad.GetTextRange(0, -1);
   }
   var res = replaceLetters(text);
   if(res != text)
      insertNoScroll(res, selectAll);
}

function insertNoScroll(str, selectAll) {
   var lpPoint = AkelPad.MemAlloc(8 /*sizeof(POINT)*/);
   if(!lpPoint)
      return;
   setRedraw(hWndEdit, false);
   AkelPad.SendMessage(hWndEdit, 1245 /*EM_GETSCROLLPOS*/, 0, lpPoint);

   selectAll && AkelPad.SetSel(0, -1);
   //var ss = AkelPad.GetSelStart();
   AkelPad.ReplaceSel(str, true);
   //if(ss != AkelPad.GetSelStart())
   //   AkelPad.SetSel(ss, ss + str.length);

   AkelPad.SendMessage(hWndEdit, 1246 /*EM_SETSCROLLPOS*/, 0, lpPoint);
   setRedraw(hWndEdit, true);
   AkelPad.MemFree(lpPoint);
}
function setRedraw(hWnd, bRedraw) {
   AkelPad.SendMessage(hWnd, 11 /*WM_SETREDRAW*/, bRedraw, 0);
   bRedraw && oSys.Call("user32::InvalidateRect", hWnd, 0, true);
}
<download>
Updated version of old script.


Last edited by Infocatcher on Tue Dec 11, 2012 5:14 pm; edited 1 time in total
Back to top
View user's profile Send private message
Infocatcher



Joined: 06 Aug 2007
Posts: 1559

PostPosted: Wed Feb 02, 2011 12:11 am    Post subject: Reply with quote

jsBeautifier.js <download | mirror | development version>
JavaScript unpacker and beautifier, based on code from http://jsbeautifier.org/.
Additionally can unpack HTML with scripts and styles inside.

File is too big and can't be placed here.
Alternative download: Infocatcher.zip (all in one).


Last edited by Infocatcher on Sun Mar 30, 2014 5:03 pm; edited 47 times in total
Back to top
View user's profile Send private message
Andrey_A_A



Joined: 03 Jun 2010
Posts: 535
Location: Сочи, Хоста

PostPosted: Wed Feb 02, 2011 2:16 pm    Post subject: Reply with quote

OpenFileNameFromBuffer.vbs

Code:
' OpenFileNameFromBuffer.vbs
'========================   Описание   =====================================
' Открыть файл, имя/путь которого, находится в выделении или в буфере обмена
' - можно скопировать/выделить кнопку/пункт меню AkelPad, Total Commander ...
' - можно скопировать/выделить пути с абсолютными именами
' - можно скопировать/выделить строку со всяким "лишним мусором" в котором есть имя/путь для открытия
' (если ни в выделении, ни в буфере ничего нет ничего подходящего - поиск имени производится во всей строке...)
'====================  Как работает скрипт  ================================
' из выделенной/отправленной в буфер строки извлекается имя/путь скрипта/файла
' и далее имя проверяется в указанных папках и открывается в AkelPad
' (если такого нет в папках - выдаётся сообщение
'=======================  Дополнение =======================================
' Вы можете удалить/внести свои условия/адреса поиска в скрипте
' используется Functions.vbs, который следует положить ...AkelFiles\Plugs\Scripts\Include\
'=========================    Пример    ====================================
' -"Открыть выделенное имя/путь файла или из буфера" Call("Scripts::Main", 1, "OpenFileNameFromBuffer.vbs")

' используется Functions.vbs, который следует положить в ...AkelFiles\Plugs\Scripts\Include\

' Автор:           Аверин Андрей
' Версия:          1.8 (10.10.2010 - 19.08.2012)
' Mail:            Averin-And@yandex.ru
' Site:            http://tc-image.3dn.ru/forum/9-391-1166-16-1333732766
' Site:            http://akelpad.sourceforge.net/forum/viewtopic.php?p=11255#11255
'===========================================================================
Count = 1 : Call TestingPath

Sub TestingPath
  With AkelPad Text = .GetSelText()
    If Count = 0 Then : Text = ClearNameOrPath(GetLine) : Count = 2 : End If
    If Len(Text) = 0 And Count = 1 Then : Text = .GetClipboardText() : Count = 0 : End If
    If Len(Text) = 0 Then MsBoxErr
    nSelStart = .GetSelStart()
    If InStr(Text, vbNewLine) > 0 Then : sText = Split(Text, vbNewLine) : pText = sText(0) : Else : pText = Text : End If
    Call .Include("Functions.vbs")
  End With
  If CreateObject("Scripting.FileSystemObject").FileExists(pText) Then OpenFF(pText)
  If pText = "TOTALCMD#BAR#DATA" Then pText = sText(1) ' если выделена в буфер кнопка Total Commander
  pText = ClearNameOrPath(pText)
  If Len(pText) = 0 Then Call MsBoxErr
  If InStr(UCase(pText), "AU3") = 0 Then pText = ClearEndLine(pText, "0123456789")
  pText = ReplaceSymPath(pText)

  If Instr(pText, "\") > 0 And Instr(pText, ".") > 0 Then
    If Left(pText, 1) = "%" Then pText = GetPath(pText) ' если путь содержит переменные окружения
    If CreateObject("Scripting.FileSystemObject").FileExists(pText) Then
      OpenFF(pText)
    Else
      If Instr(pText, ".") = InstrRev(pText, ".") Then OpenFF(RunPath(pText)) : Call MsBoxErr
    End If
  Else
    If Instr(pText, ".") = InstrRev(pText, ".") Then OpenFF(RunPath(pText)) : Call MsBoxErr
  End If
End Sub

Sub OpenFF(Name) : Call AkelPad.OpenFile(Name) : Wscript.Quit : End Sub

' функция проверки нахождения имени файла в указанных папках
' удалите ненужные и вставьте свои папки
Function RunPath(FName)
  With AkelPad
    P0 = .GetAkelDir(0) & "\" : P1 = .GetAkelDir(1) & "\" : P2 = .GetAkelDir(2) & "\"
    P4 = .GetAkelDir(4) & "\" : P5 = .GetAkelDir(5) & "\" : P6 = .GetAkelDir(6) & "\"
  End With
  TC =  GetPath("%COMMANDER_PATH%") & "\" : TCF = TC & "Files\" : TU =  TC & "Utilities\"
  TCFL = TCF & "Lists\" : TCC = TC & "Scripts\" : TCB = TC & "Bar\"
  PT = P4 & "Templates\" : TM = TC & "0\" : TS = TM & "Script_Site\"
  WD = GetPath("%WINDIR%") & "\"
  APath = Array(P0, P0 & "Help", P1 & "List", P2, P4, P4 & "AkelMenu", P4 & "AutoComplete",_
          P4 & "AkelMenu", P4 & "Coder", P4 & "Sessions", P4 & "SpellCheck", P4 & "Templates",_
          PT & "AkelPad", PT & "Asp", PT & "Asp.net", PT & "Assemblers", PT & "Batch",_
          PT & "C-Language", PT & "Css", PT & "Html", PT & "Pascal", PT & "Xml", P5,_
          P5 & "Include", P5 & "Include\win32", P5 & "Params", P5 & "Params\ShowMenuEx",_
          P5 & "Params\ShowMenuAlt", P5 & "ShowMenu", P5 & "win32lib", P6, TC, TC & "Language",_
          TC & "Keys", TCB, TCB & "Bars", TCB & "Bars_Plus", TCB & "Filter", TCF & "ExtProgram", _
          TCB & "Font", TCB & "Rename", TCB & "Search", TCB & "Select", TCB & "Start_Menu", _
          TCF, TCF & "Bat", TCF & "Comands", TCF & "Ncl", TCF & "Tab", TCF & "HTML",_
          TCF & "Help\TCInfo",  TCFL & "Collection", TCFL & "CreateMenu", TCFL & "Lst", _
          TCFL & "MarkerList", TCFL & "MusicList", TCFL & "PathList", TCFL & "Play", _
          TCFL & "ProgramList", TCFL & "ReportList", TCFL & "StatisticFile", _
          TCC & "AddIcons", TCC & "Attributes", TCC & "Buffer", TCC & "Copy", TCC & "CreateBar", _
          TCC & "CreateLists", TCC & "CreateRegistration", TCC & "FileEditing", TCC & "Filters", _
          TCC & "Folders", TCC & "ImageWSH", TCC & "Include", TCC & "Keyboard", TCC & "Link", _
          TCC & "Marker", TCC & "Miscellanea", TCC & "Move", TCC & "Panel", TCC & "Plus", _
          TCC & "ReNames", TCC & "Run", TCC & "Searches", TCC & "SysScript", TCC & "NetWork", _
          TCC & "TextWork", TCC & "Un-Packing", WD, WD & "system32", "c:\MyFiles",_
          TS & "N_V", TS & "S", TS & "V", TU & "Inet\WGet", P1 & "Regs")
  p = 0
  For ii = 0 To Ubound(APath)
    PF = Trim(APath(ii) & "\" & FName)
    If CreateObject("Scripting.FileSystemObject").FileExists(PF) Then : RunPath = PF : p = 1 : Exit For : End If
  Next
  If p = 0 Then MsBoxErr
End Function

Sub MsBoxErr
  If Count = 1 Then
    Call AkelPad.SetSel(nSelStart, nSelStart) : Call TestingPath
  Else
    If Count = 0 Then
      Call TestingPath
    Else
      MsgBox "Ни в выделении ни в буфере обмена" & vbNewLine &_
      "Нет корректного ИМЕНИ / ПУТИ файла для открытия" & vbNewLine &_
      "или такого файла нет в папках, указанных в скрипте" & vbNewLine &_
      "- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -" & vbNewLine &_
      "Выделите или скопируйте чего-нибудь подходящее" & vbNewLine &_
      "И повторите попытку " , vbApplicationModal & vbExclamation,_
      "Открытие файла, путь/имя которого скопирован или выделен" : Wscript.Quit
    End If
  End If
End Sub




используется: Functions.vbs


Last edited by Andrey_A_A on Thu Sep 13, 2012 2:43 am; edited 2 times in total
Back to top
View user's profile Send private message Send e-mail Visit poster's website
Andrey_A_A



Joined: 03 Jun 2010
Posts: 535
Location: Сочи, Хоста

PostPosted: Wed Feb 02, 2011 3:47 pm    Post subject: Reply with quote

DublicateFile.vbs

Code:
' DublicateFile.vbs
'========================   Описание   =====================================
' Создание дубликата файла в той же папке и его открытие с добавлением счетчика _N
'
' Call("Scripts::Main", 1, "DublicateFile.vbs")
' предлагаемая горячая клавиша Alt + F5

' Автор:           Аверин Андрей
' Версия:          1.3 (22.11.2010 - 01.05.2012)
' Mail:            Averin-And@yandex.ru
' Site:            http://tc-image.3dn.ru/forum/9-354-1087-16-1333507842
' Site:            http://akelpad.sourceforge.net/forum/viewtopic.php?p=11259#11259
'===========================================================================
File = AkelPad.GetEditFile(0)
If AkelPad.GetEditWnd() = 0 Or Len(File) = 0 Then WScript.Quit
With CreateObject("Scripting.FileSystemObject")
  Path  = .GetParentFolderName(File) & "\"
  Name = .GetBaseName(File)
  Ext = "." & .GetExtensionName(File)
  FPath = Path  & Name & Ext
  Do While .FileExists(FPath)
      i = i + 1 : FPath = Path & Name & "_" & (i Mod 10) & Ext
  Loop
  If .FileExists(File) Then .CopyFile File, FPath
  AkelPad.OpenFile(FPath)
End With



Иконка к скрипту:
DublicateFile.b64

Code:
MIME-Version: 1.0
Content-Type: application/octet-stream; name="DublicateFile.zip"
Content-Transfer-Encoding: base64
Content-Disposition: attachment; filename="DublicateFile.zip"

UEsDBBQAAgAIAOA8KDLXCLAV6QgAADYVAAARAAAARHVibGljYXRlRmlsZS5pY2+tmH9QVNcVx8/L
7rBhN0sWAoURiqLVIVUrkY2MFCMWGAiUJdCFsIWilQEKhYDNKijFoNURKqMDFgYcGCggVBmojlol
/oqpdbSahNFqGyuOVqfJHwmtqTbMSD393vfuAlrEDvBmPnPfj/vu99xz7zv33Eek0As0Zw6hnEO/
sRAtICKLRbv+iZ7oY5wH4x6qUCRp98VRaaEZOhqLiJrWE+11ajSD6k3Prl9bQdSOOq2SNtCO+hu+
O75WyLmHL/4/6lEFPEz0kMcYAed54toNlUTM/4t4Z5PHVHpvzfx6iGgQ79+S/B0cnVhfuYH7X4H7
4AH4Wup3NE3V+1bHfegPoI2rkk/BgQn0q1s0PWHfZ+BLqX+DpzP61ozPhzR/Cy6Ay2D/E20upYYF
mo3CtpvgNrgHHoG63dPST78H/eNo56TkLGh5sk9Luq4SXcG9j1grr0sbzvF0Z7/VcQv6fWjnoOQI
2DPabkB0WyzRCVyflrb9AVwCd8CWn05bP+1T6HegrS6JGPsaVd/usTcI3+d/NJsOs+YnYcM1UHB0
Jr5+q+Ma9BulzwWtoBnsFGMr50KXLIUNNSNEjvSZij7W9IEhTadR0iTZK3HZ1caan3qlXWt3zoR+
SMpl6G+TPq+R/d4FauU8qJXUSb+0yzES86Hk+nT1s2uGhij8In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gMDI+959Vlbkfazl7Y71wy5NxM0/mE5VqDP/WZO/n
t4X2xyDuJiHmGbJCXsK66H3gTO/bak4AW5QN9LvJ3i/oWNofA38lIW/1yVn8zfzj3a/oougdW72O
9flqjvX7yd4v6Vl2KrlD4VTEQgdy/0TsU1LEmoCYbMe6oc+hH036fveKHfH1bqds9eb+xHpTf0Kd
qT+6Wnl/WTnt886k7z/PfycR8UbWgB8DRIERnVYGvEbkh/JFERl0IqCB954C9/4LUEsBAhQAFAAC
AAgA4DwoMtcIsBXpCAAANhUAABEAAAAAAAAAAAAgAAAAAAAAAER1YmxpY2F0ZUZpbGUuaWNvUEsF
BgAAAAABAAEAPwAAABgJAAAAAA==



Last edited by Andrey_A_A on Thu Sep 13, 2012 2:45 am; edited 2 times in total
Back to top
View user's profile Send private message Send e-mail Visit poster's website
VladSh



Joined: 29 Nov 2006
Posts: 2584
Location: Киев, Русь

PostPosted: Thu Feb 03, 2011 7:37 am    Post subject: Reply with quote

SmartBackspace.js

Code:
///Deleting block of whitespaces; for other characters - a usual deleting (1 symbol)
/// Удаляет пробелы блоками (количество пробелов в блоке берётся из настроек программы);
/// для других символов - обычное удаление (посимвольно)
// http://akelpad.sourceforge.net/forum/viewtopic.php?p=11267#11267
// Version: 2.0 (2011.01.21) - 2.2 (2011.01.26) by VladSh
// Version: 1.0 by lexa
// Предлагаемая комбинация клавиш:   Shift+Alt+Backspace

var nPosCurrent = AkelPad.GetSelStart();
if (!nPosCurrent) WScript.Quit();

if (nPosCurrent == AkelPad.GetSelEnd())
{
   var hWndEdit = AkelPad.GetEditWnd();
   var oLine = getBlockLeft(nPosCurrent);
   
   var nTabStop = AkelPad.SendMessage(AkelPad.GetEditWnd(), 3239 /*AEM_GETTABSTOP*/, 0, 0);      //количество пробелов (из настроек)
   var pSpaces = repeat(" ", nTabStop);
   
   var posCursorNew = oLine.len - nTabStop;
   var pPartDel = oLine.text.substr(posCursorNew);      //предполагаемая удаляемая часть
   if (pPartDel != pSpaces)
      posCursorNew = oLine.len - 1;
   var pPartRemain = oLine.text.substr(0, posCursorNew);
   
   var bNoSelEOL = false;
   if (!oLine.start)
   {
      var fNoSelEOL = "SmartSel::NoSelEOL";
      var bNoSelEOL = AkelPad.IsPluginRunning(fNoSelEOL);
      if (bNoSelEOL) AkelPad.Call(fNoSelEOL);      //Turn OFF
   }
   
   setRedraw(hWndEdit, false);
   AkelPad.SetSel(nPosCurrent - oLine.text.length, nPosCurrent);
   AkelPad.ReplaceSel(pPartRemain);
   setRedraw(hWndEdit, true);
   
   if (bNoSelEOL) AkelPad.Call(fNoSelEOL);      //Turn ON
}
else
   AkelPad.ReplaceSel("");


function repeat(pText, nCount)
{
   return (new Array(nCount + 1)).join(pText);
}

function getBlockLeft(nPos)
{
   var line = AkelPad.SendMessage(hWndEdit, 1078 /*EM_EXLINEFROMCHAR*/, 0, nPos);
   var index = AkelPad.SendMessage(hWndEdit, 187 /*EM_LINEINDEX*/, line, 0);
   if (index == nPos && index != 0)
   {
      var line = AkelPad.SendMessage(hWndEdit, 1078 /*EM_EXLINEFROMCHAR*/, 0, nPos - 1);
      var index = AkelPad.SendMessage(hWndEdit, 187 /*EM_LINEINDEX*/, line, 0);
   }
   var text = AkelPad.GetTextRange(index, nPos);
   
   return {
      text: text,
      start: index,
      len: text.length
   };
}

function setRedraw(hWnd, bRedraw)
{
   var oSys = AkelPad.SystemFunction();
   AkelPad.SendMessage(hWnd, 11 /*WM_SETREDRAW*/, bRedraw, 0);
   bRedraw && oSys.Call("user32::InvalidateRect", hWnd, 0, true);
}



ParagraphRemove.js

Code:
///Удаление параграфа по Ctrl+Alt+Y
// http://akelpad.sourceforge.net/forum/viewtopic.php?p=11267#11267
// Version: 1.2 (2011.12.12)

if (! AkelPad.Include("selCompleteLine.js")) WScript.Quit();
selCompleteLine(AkelPad.GetSelStart(), AkelPad.GetSelEnd());

AkelPad.Command(4197);

N.B. Скрипт использует selCompleteLine.js.


Last edited by VladSh on Tue Sep 11, 2012 3:45 pm; edited 9 times in total
Back to top
View user's profile Send private message Visit poster's website
VladSh



Joined: 29 Nov 2006
Posts: 2584
Location: Киев, Русь

PostPosted: Fri Feb 04, 2011 4:48 pm    Post subject: Reply with quote

XMLGetAttrValues.js

Code:
///Receiving appointed attributes of each line of XML-file
///Вытягивание определённых атрибутов из каждой строки файла с XML-структурой
// http://akelpad.sourceforge.net/forum/viewtopic.php?p=11340#11340
// Version: 1.6 (2012.12.18)
//
// Параметры:
//    sep - разделитель для разбора идентификаторов и надписей в param-файле (подробнее см. параметр pParsepProcSep в ShowMenuEx.js)

if (! AkelPad.Include("ShowMenuEx.js")) WScript.Quit();
if (! AkelPad.Include("ProcessRowText.js")) WScript.Quit();

var arrAttr = getSelectedMenuItem(POS_CURSOR, AkelPad.GetArgValue("sep", ""), 0).split(", ");

//создаём структуру искомых тэгов, перечень которых берём из файла параметров
var structAttr = {};
for (var i = 0, l = arrAttr.length; i < l; i++)
   structAttr[arrAttr[i]] = 1;

var pContent = AkelPad.GetTextRange(0, -1);

//вызываем основную функцию обработчика всего файла
var pContent = processRowText(pContent, "\r");

AkelPad.Call("Log::Output", 5, pContent + "\r", -1, 1);


//функция обработки отдельной строки
function processString(rowXML) {
   var pResult = "";
   var aRES = getAttributesValues(rowXML);
   if (aRES != null)
      pResult = aRES.join(", ");
   return pResult
}

function getAttributesValues(sXML) {
   var aXML = sXML.split('"');
   
   var sATTR = "";
   var aRES = [];
   var r = 0;
   
   for (var n = 0; n <= aXML.length; n++) {
      sATTR = aXML[n].replace(/ /g, "");
      sATTR = sATTR.replace(/=/g, "");
      sATTR = sATTR.replace(/</g, "");
      
      if (structAttr[sATTR] == 1) {
         aRES[r] = aXML[n + 1];
         r += 1;
      }
      n += 1;
   }
   
   if (r > 0) return aRES
}

function addToResult(arrOutput, vResult) {
   if (vResult) arrOutput[arrOutput.length] = vResult;
}

NB: Скрипт использует:
- ShowMenuEx.js (для вывода меню наименований атрибутов);
- ProcessRowText.js (для обработки всех строк файла в цикле).

Атрибуты для отбора в файле параметров указываются через ", ", например строка:
Code:
model, posX, posY
Пример XML можно взять здесь.

Благодарности: Infocatcher


Last edited by VladSh on Tue Dec 18, 2012 2:11 pm; edited 6 times in total
Back to top
View user's profile Send private message Visit poster's website
Infocatcher



Joined: 06 Aug 2007
Posts: 1559

PostPosted: Fri Feb 04, 2011 7:29 pm    Post subject: Reply with quote

openRelativeFile.js
Code:
// http://akelpad.sourceforge.net/forum/viewtopic.php?p=11346#11346
// http://infocatcher.ucoz.net/js/akelpad_scripts/openRelativeFile.js

// (c) Infocatcher 2011
// version 0.1.6 - 2011-02-18

//===================
// Tries to open file with relative path
// System association is used for opening binary files
// Supports Mozilla's chrome.manifest files (https://developer.mozilla.org/en/chrome_registration)

// Usage:
//   Call("Scripts::Main", 1, "openRelativeFile.js")
//===================

//== Settings begin
// You can use openRelativeFile-options.js file for override settings

//var paths = ["%ProgramFiles%\\Something"];
var paths = [];

var delimitersStart = {
   '"': true,
   "'": true,
   "<": true,
   "[": true,
   "(": true,
   ">": true,
   "=": true
};
var delimitersEnd = {
   '"': true,
   "'": true,
   ">": true,
   "]": true,
   ")": true,
   "<": true
};
var delimitersSpaces = {
   " ": true,
   "\t": true,
   "\n": true,
   "\r": true,
   "\0": true
};
var delimitersStop = {
   "\n": true,
   "\r": true,
   "\0": true
};

var maxLength = 2000;
//== Settings end

var optionsPath = WScript.ScriptFullName.replace(/(\.[^.]+)?$/, "-options$&");
if(new ActiveXObject("Scripting.FileSystemObject").FileExists(optionsPath))
   eval(AkelPad.ReadFile(optionsPath));

var hMainWnd=AkelPad.GetMainWnd();
var fso = new ActiveXObject("Scripting.FileSystemObject");
var wsh = new ActiveXObject("WScript.Shell");

if(hMainWnd)
   openRelativeFile();

function openRelativeFile() {
   var pathStart, pathEnd;

   var ss = AkelPad.GetSelStart();
   var se = AkelPad.GetSelEnd();

   if(ss != se)
      ss++, se--;

   var startsWithSpace = false;
   var cnt = 0;
   for(;;) {
      var chr = AkelPad.GetTextRange(--ss, ss + 1);
      if(chr in delimitersSpaces && pathStart == undefined) {
         startsWithSpace = true;
         pathStart = ss + 1;
      }
      else if(chr in delimitersStart) {
         startsWithSpace = false;
         pathStart = ss + 1;
         break;
      }
      if(chr in delimitersStop)
         break;
      if(ss == 0) // Start of file
         break;
      if(++cnt > maxLength)
         break;
   }
   if(pathStart == undefined)
      return false;

   for(;;) {
      var chr = AkelPad.GetTextRange(se, ++se);
      if(!chr) // End of file
         break;
      if(chr in delimitersSpaces && pathEnd == undefined) {
         pathEnd = se - 1;
         if(startsWithSpace)
            break;
      }
      else if(chr in delimitersEnd) {
         pathEnd = se - 1;
         break;
      }
      if(chr in delimitersStop)
         break;
      if(++cnt > maxLength)
         break;
   }
   if(pathEnd == undefined)
      return false;

   var relPath = AkelPad.GetTextRange(pathStart, pathEnd)
      .replace(/#.*$/, "")
      .replace(/\?.*$/, "");
   try {
      relPath = decodeURIComponent(relPath);
   }
   catch(e) {
   }

   var path;

   var curPath = AkelPad.GetEditFile(0);
   var curDir = fso.GetParentFolderName(curPath);
   var tmp = curDir + "\\" + relPath;
   if(fso.FileExists(tmp))
      path = tmp;
   else {
      if(/^(chrome|resource):\/\//.test(relPath)) {
         tmp = parseChromePath(curDir, relPath);
         if(tmp)
            path = tmp;
      }
      if(!path && /^\w+:\//.test(relPath)) {
         var tokens = relPath.replace(/^\w+:/, "").split(/[\\\/]+/);
         for(;;) {
            tmp = getFile(curDir, tokens.concat());
            if(tmp) {
               path = tmp;
               break;
            }
            var newDir = curDir.replace(/[\\\/]+[^\\\/]+$/, "");
            if(!newDir || newDir == curDir)
               break;
            curDir = newDir;
         }
      }
      if(!path) {
         for(var i = 0, l = paths.length; i < l; i++) {
            tmp = wsh.ExpandEnvironmentStrings(paths[i]) + "\\" + relPath;
            if(fso.FileExists(tmp)) {
               path = tmp;
               break;
            }
         }
      }
   }
   if(!path)
      return false;

   AkelPad.SetSel(pathStart, pathEnd);
   if(isFileBinary(path)) // Use system association for binary files
      wsh.Exec('rundll32.exe shell32.dll,ShellExec_RunDLL "' + path + '"');
   else
      AkelPad.OpenFile(path);

   return true;
}
function parseChromePath(curDir, chromePath) {
   if(/^(resource):\/+([^\/]+)(\/.*)?/.test(chromePath)) {
      var protocol = RegExp.$1;
      var domain   = RegExp.$2;
      var path     = RegExp.$3;
   }
   else if(/^(\w+):\/+([^\/]+)\/([^\/]+)(\/.*)?/.test(chromePath)) {
      var protocol = RegExp.$1;
      var domain   = RegExp.$2;
      var type     = RegExp.$3;
      var path     = RegExp.$4;
   }
   else
      return false;

   for(;;) { // See https://developer.mozilla.org/en/chrome_registration
      var tmp = curDir + "\\chrome.manifest";
      if(fso.FileExists(tmp)) {
         var manifest = AkelPad.ReadFile(tmp);
         break;
      }
      var newDir = curDir.replace(/[\\\/]+[^\\\/]+$/, "");
      if(!newDir || newDir == curDir)
         return false;
      curDir = newDir;
   }
   if(!manifest)
      return false;

   var pattern;
   switch(protocol) {
      case "chrome":
         switch(type) {
            case "content":
               // content extensionname chrome/content/
               pattern = new RegExp("(^|[\\n\\r])content[ \\t]+" + escapeRegExp(domain) + "[ \\t]+(\\S+)");
            break;
            case "skin":
               // skin extensionname classic/1.0 chrome/skin/
               pattern = new RegExp("(^|[\\n\\r])skin[ \\t]+" + escapeRegExp(domain) + "[ \\t]+\\S+[ \\t]+(\\S+)");
            break;
            case "locale":
               // locale extensionname en-US chrome/locale/en-US/
               pattern = new RegExp("(^|[\\n\\r])locale[ \\t]+" + escapeRegExp(domain) + "[ \\t]+\\S+[ \\t]+(\\S+)");
         }
      break;
      case "resource":
         // resource extensionname resource/
         pattern = new RegExp("(^|[\\n\\r])resource[ \\t]+" + escapeRegExp(domain) + "[ \\t]+(\\S+)");
   }

   if(!pattern)
      return false;

   tmp = getManifestInfo(pattern, manifest, curDir, path);
   if(tmp)
      return tmp;

   // https://developer.mozilla.org/en/chrome_registration#manifest
   var lines = manifest.split(/[\n\r]+/);
   for(var i = 0, l = lines.length; i < l; i++) {
      var line = lines[i];
      if(!/^manifest[ \t]+(\S+)/.test(line))
         continue;
      var manifestPath = curDir + "\\" + RegExp.$1;
      if(!fso.FileExists(manifestPath))
         continue;
      manifest = AkelPad.ReadFile(manifestPath);
      tmp = getManifestInfo(pattern, manifest, fso.GetParentFolderName(manifestPath), path);
      if(tmp)
         return tmp;
   }

   return false;
}
function getManifestInfo(pattern, manifest, curDir, path) {
   if(!pattern.test(manifest))
      return false;
   var fullPath = curDir + "\\" + unwrapChromePath(RegExp.$2) + path;
   if(fso.FileExists(fullPath))
      return fullPath;
   return false;
}
function unwrapChromePath(path) {
   if(/^jar:/.test(path))
      path = path.substr(4).replace(/[^\/]+!\//, "");
   return path;
}
function escapeRegExp(str) {
   return str.replace(/[\\\/.^$+*?|()\[\]{}]/g, "\\$&");
}
function getFile(curDir, tokens) {
   var parts = [];
   for(;;) {
      parts.unshift(tokens.pop());
      tmp = curDir + "\\" + parts.join("\\");
      if(fso.FileExists(tmp))
         return tmp;
      if(!tokens.length)
         break;
   }
   return null;
}
function isFileBinary(pFile) {
   // Thanks to Instructor
   // http://akelpad.sourceforge.net/forum/viewtopic.php?p=11344#11344
   var lpDetectCodepage;
   var bResult=false;

   if (lpDetectCodepage=AkelPad.MemAlloc(_X64?24:20 /*sizeof(DETECTCODEPAGEW)*/))
   {
      AkelPad.MemCopy(lpDetectCodepage /*offsetof(DETECTCODEPAGEW, pFile)*/, AkelPad.MemStrPtr(pFile), 2 /*DT_QWORD*/);
      AkelPad.MemCopy(lpDetectCodepage + (_X64?8:4) /*offsetof(DETECTCODEPAGEW, dwBytesToCheck)*/, 1024, 3 /*DT_DWORD*/);
      AkelPad.MemCopy(lpDetectCodepage + (_X64?12:8) /*offsetof(DETECTCODEPAGEW, dwFlags)*/, 0x11 /*ADT_BINARY_ERROR|ADT_NOMESSAGES*/, 3 /*DT_DWORD*/);
      if (AkelPad.SendMessage(hMainWnd, 1177 /*AKD_DETECTCODEPAGEW*/, 0, lpDetectCodepage) == -4 /*EDT_BINARY*/)
         bResult=true;

      AkelPad.MemFree(lpDetectCodepage);
   }
   return bResult;
}
<download>
Tries to open file with relative path.
System association is used for opening binary files.
Supports Mozilla's chrome.manifest files.

Thanks to Instructor for IsFileBinary() example.


Last edited by Infocatcher on Sat Apr 09, 2011 7:22 pm; edited 1 time in total
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    AkelPad Forum Index -> Plugins All times are GMT
Goto page Previous  1, 2, 3 ... 8, 9, 10 ... 16, 17, 18  Next
Page 9 of 18

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


SourceForge.net Logo Powered by phpBB © 2001, 2005 phpBB Group