*****************************************************************
***                 Scripts AkelPad plugin v9.9               ***
*****************************************************************

2011 Shengalts Aleksander aka Instructor (Shengalts@mail.ru)


*** Description ***

Scripts plugin is based on the Windows Scripting Host (WSH) engine,
so you can use various Windows Component Object Model (COM)
objects. For example, you can perform regular expression searches
using the RegExp object, manipulate files using the FileSystemObject
object, create a short-cut, manipulate the Windows Registry using
the WshShell object, or work with networking functions using the
WshNetwork object. Additionally, you can create and execute a
script that utilizes an external application that supports Automation
(such as Word and Excel). Plugin code is based on Jeff Glatt's "COM in C".


*** Included scripts ***

SearchReplace.js      -search/replace using regular expressions.
SpellCheck.js         -spell check using Microsoft Word.
LinesFilter.js        -filter lines using regular expressions.
Calculator.js         -text calculator.
EvalCmd.js            -evaluates an expression passed through command line.
InsertDate.js         -insert time and date in specified format.
InsertFile.js         -insert contents of a file.
RenameFile.js         -rename current editing file.
Keyboard.js           -convert keyboard layout or transliterate text.
ColumnCounter.js      -column selection counter.
Test.js               -test script on JScript.
Test.vbs              -test script on VBScript.


*** Functions ***

Scripts::Main
Main dialog.


*** External call ***

Call("Scripts::Main", 1, "SCRIPT", "ARGUMENTS")
  Parameters:
    1
      Execute script. If "", then last processed script used.
    "SCRIPT"
      Script file.
    "ARGUMENTS"
      Argumets (default is "").
  Examples:
    Call("Scripts::Main", 1, "InsertDate.js")
    Call("Scripts::Main", 1, "InsertDate.js", `"dd MMMM yyyy"`)

Call("Scripts::Main", 2, "SCRIPT", "ARGUMENTS")
  Same as previous, but wait for script completion.

Call("Scripts::Main", 3, "SCRIPT")
  Parameters:
    3
      Open script for editing.
    "SCRIPT"
      Script file. If "", then last processed script used.


*** Methods list ***

AkelPad.GetMainWnd
AkelPad.GetAkelDir
AkelPad.GetInstanceExe
AkelPad.GetInstanceDll
AkelPad.GetLangId
AkelPad.IsOldWindows
AkelPad.IsOldRichEdit
AkelPad.IsOldComctl32
AkelPad.IsAkelEdit
AkelPad.IsMDI
AkelPad.GetEditWnd
AkelPad.GetEditFile
AkelPad.GetEditCodePage
AkelPad.GetEditBOM
AkelPad.GetEditNewLine
AkelPad.GetEditModified
AkelPad.GetEditReadOnly
AkelPad.SendMessage
AkelPad.MessageBox
AkelPad.InputBox
AkelPad.GetSelStart
AkelPad.GetSelEnd
AkelPad.SetSel
AkelPad.GetSelText
AkelPad.GetTextRange
AkelPad.ReplaceSel
AkelPad.TextFind
AkelPad.TextReplace
AkelPad.GetClipboardText
AkelPad.SetClipboardText
AkelPad.IsPluginRunning
AkelPad.Call
AkelPad.CallEx
AkelPad.Exec
AkelPad.Command
AkelPad.Font
AkelPad.Recode
AkelPad.Include
AkelPad.IsInclude
AkelPad.OpenFile
AkelPad.ReadFile
AkelPad.SaveFile
AkelPad.SystemFunction
AkelPad.SystemFunction().AddParameter
AkelPad.SystemFunction().Call
AkelPad.SystemFunction().GetLastError
AkelPad.SystemFunction().RegisterCallback
AkelPad.SystemFunction().UnregisterCallback
AkelPad.MemAlloc
AkelPad.MemCopy
AkelPad.MemRead
AkelPad.MemStrPtr
AkelPad.MemFree
AkelPad.Debug
AkelPad.VarType
AkelPad.GetArgLine
AkelPad.GetArgValue
AkelPad.ScriptSettings
AkelPad.ScriptSettings().Begin
AkelPad.ScriptSettings().Read
AkelPad.ScriptSettings().Write
AkelPad.ScriptSettings().Delete
AkelPad.ScriptSettings().End
AkelPad.WindowRegisterClass
AkelPad.WindowUnregisterClass
AkelPad.WindowGetMessage
AkelPad.WindowSubClass
AkelPad.WindowUnsubClass
AkelPad.ThreadHook
AkelPad.ThreadUnhook
AkelPad.ScriptNoMutex
_TCHAR
_TSTR
_TSIZE
_X64


*** Methods description ***

AkelPad.GetMainWnd
__________________

Get main window handle.

  GetMainWnd();

Return Value
  Number. Main window handle.

Example:
  var hMainWnd=AkelPad.GetMainWnd();


AkelPad.GetAkelDir
__________________

Get AkelPad directory or its subdirectory.

  GetAkelDir([nSubDir]);

Arguments
  nSubDir
    0  //ADTYPE_ROOT       root AkelPad's folder (by default).
    1  //ADTYPE_AKELFILES  "[AkelPad]\AkelFiles".
    2  //ADTYPE_DOCS       "[AkelPad]\AkelFiles\Docs".
    3  //ADTYPE_LANGS      "[AkelPad]\AkelFiles\Langs".
    4  //ADTYPE_PLUGS      "[AkelPad]\AkelFiles\Plugs".
    5  //ADTYPE_SCRIPTS    "[AkelPad]\AkelFiles\Plugs\Scripts".
    6  //ADTYPE_INCLUDE    "[AkelPad]\AkelFiles\Plugs\Scripts\Include".

Return Value
  String. AkelPad directory or its subdirectory.

Example:
  var pAkelDir=AkelPad.GetAkelDir();


AkelPad.GetInstanceExe
______________________

Get EXE instance handle.

  GetInstanceExe();

Return Value
  Number. EXE instance handle.

Example:
  var hInstance=AkelPad.GetInstanceExe();


AkelPad.GetInstanceDll
______________________

Get DLL instance handle.

  GetInstanceDll();

Return Value
  Number. DLL instance handle.

Example:
  var hInstance=AkelPad.GetInstanceDll();


AkelPad.GetLangId
_________________

Get AkelPad language ID.

  GetLangId([nType]);

Arguments
  nType
    0  //LANGID_FULL     full language identifier. This value is a combination of a primary language identifier and a sublanguage identifier (by default).
    1  //LANGID_PRIMARY  primary language identifier.
    2  //LANGID_SUB      sublanguage identifier.

Return Value
  Number. AkelPad language ID.

Example:
  var nLangID=AkelPad.GetLangId(1 /*LANGID_PRIMARY*/);

  if (nLangID == 0x19) //LANG_RUSSIAN
    WScript.Echo("Russian");
  else
    WScript.Echo("Other");


AkelPad.IsOldWindows
____________________

Is non-Unicode Windows.

  IsOldWindows();

Return Value
  true   non-Unicode (Windows 95/98/Me).
  false  Unicode (Windows NT/2000/XP).

Example:
  var bOldWindows=AkelPad.IsOldWindows();


AkelPad.IsOldRichEdit
_____________________

Is riched20.dll lower then 5.30 (v3.0).

  IsOldRichEdit();

Return Value
  true   riched20.dll lower then 5.30 (v2.0).
  false  riched20.dll not lower then 5.30 (v3.0, v4.0).

Example:
  var bOldRichEdit=AkelPad.IsOldRichEdit();


AkelPad.IsOldComctl32
_____________________

Is comctl32.dll lower then 4.71.

  IsOldComctl32();

Return Value
  true   comctl32.dll lower then 4.71.
  false  comctl32.dll not lower then 4.71.

Example:
  var bOldComctl32=AkelPad.IsOldComctl32();


AkelPad.IsAkelEdit
__________________

Is AkelEdit control used.

  IsAkelEdit();

Return Value
  true   AkelEdit control used (AkelPad v4.x.x or higher).
  false  RichEdit control used (AkelPad v3.x.x).

Example:
  var bAkelEdit=AkelPad.IsAkelEdit();


AkelPad.IsMDI
_____________

Is AkelPad in MDI mode.

  IsMDI();

Return Value
  0  //WMD_SDI   Single document interface (SDI).
  1  //WMD_MDI   Multiple document interface (MDI).
  2  //WMD_PMDI  Pseudo-Multiple document interface (PMDI).

Example:
  var nMDI=AkelPad.IsMDI();


AkelPad.GetEditWnd
__________________

Get active edit window handle.

  GetEditWnd();

Return Value
  Number. Active edit window handle.

Example:
  var hEditWnd=AkelPad.GetEditWnd();


AkelPad.GetEditFile
___________________

Get file name.

  GetEditFile(hHandle);

Arguments
  hHandle
    Edit window handle. If zero then active edit window handle is used.

Return Value
  String. File name.

Example:
  var pEditFile=AkelPad.GetEditFile(0);


AkelPad.GetEditCodePage
_______________________

Get file code page.

  GetEditCodePage(hHandle);

Arguments
  hHandle
    Edit window handle. If zero then active edit window handle is used.

Return Value
  Number. Code page.

Example:
  var nCodePage=AkelPad.GetEditCodePage(0);


AkelPad.GetEditBOM
__________________

Get file BOM.

  GetEditBOM(hHandle);

Arguments
  hHandle
    Edit window handle. If zero then active edit window handle is used.

Return Value
  true   file has BOM.
  false  file hasn't BOM.

Example:
  var bBOM=AkelPad.GetEditBOM(0);


AkelPad.GetEditNewLine
______________________

Get file new line format.

  GetEditNewLine(hHandle);

Arguments
  hHandle
    Edit window handle. If zero then active edit window handle is used.

Return Value
  1  DOS/Windows (0Dh, 0Ah)
  2  Unix (0Ah)
  3  Mac (0Dh)

Example:
  var nNewLine=AkelPad.GetEditNewLine(0);


AkelPad.GetEditModified
_______________________

Get file modified flag.

  GetEditModified(hHandle);

Arguments
  hHandle
    Edit window handle. If zero then active edit window handle is used.

Return Value
  true   contents of edit control have been modified.
  false  contents of edit control haven't been modified.

Example:
  var bModified=AkelPad.GetEditModified(0);


AkelPad.GetEditReadOnly
_______________________

Get edit control's read only mode.

  GetEditReadOnly(hHandle);

Arguments
  hHandle
    Edit window handle. If zero then active edit window handle is used.

Return Value
  true   read only mode.
  false  edit mode.

Example:
  var bReadOnly=AkelPad.GetEditReadOnly(0);


AkelPad.SendMessage
___________________

Send message.

  SendMessage(hHandle, nMessage, wParam, lParam);

Arguments
  hHandle
    Handle to the window whose window procedure will receive the message.
  nMessage
    Specifies the message to be sent.
  wParam
    Specifies additional message-specific information.
  lParam
    Specifies additional message-specific information.

Return Value
  Number. Result of the message processing; it depends on the message sent.

Example:
  var hMainWnd=AkelPad.GetMainWnd();
  AkelPad.SendMessage(hMainWnd, 273 /*WM_COMMAND*/, 4101 /*IDM_FILE_NEW*/, 0);


AkelPad.MessageBox
__________________

Show message.

  MessageBox(hHandle, pText, pCaption, nType);

Arguments
  hHandle
    Handle to the owner window of the message box to be created. If this parameter is zero, the message box has no owner window.
  pText
    Message to be displayed.
  pCaption
    Dialog box title.
  nType
    Specifies the contents and behavior of the dialog box. See MSDN.

Return Value
  Number. Return value is the button's ID pressed. See MSDN.

Example:
  var hMainWnd=AkelPad.GetMainWnd();
  AkelPad.MessageBox(hMainWnd, "MyText", "MyCaption", 64 /*MB_ICONINFORMATION*/);


AkelPad.InputBox
________________

Input dialog box.

  InputBox(hHandle, pCaption, pLabel, pEdit);

Arguments
  hHandle
    Handle to the owner window of the message box to be created.
  pCaption
    Dialog box title.
  pLabel
    Edit box label.
  pEdit
    Edit box text.

Return Value
  String. Edit box text. Cancel button returns undefined.

Example:
  var hMainWnd=AkelPad.GetMainWnd();
  var pText=AkelPad.InputBox(hMainWnd, "MyCaption", "MyLabel", "MyText");


AkelPad.GetSelStart
___________________

Get selection first char index.

  GetSelStart();

Return Value
  Number. Selection first char index.

Example:
  var nSelStart=AkelPad.GetSelStart();


AkelPad.GetSelEnd
_________________

Get selection last char index.

  GetSelEnd();

Return Value
  Number. Selection last char index.

Example:
  var nSelEnd=AkelPad.GetSelEnd();


AkelPad.SetSel
______________

Set selection.

  SetSel(nSelStart, nSelEnd);

Arguments
  nSelStart
    Selection first char index.
  nSelEnd
    Selection last char index.

Return Value
  Zero.

Example:
  AkelPad.SetSel(0, 10);


AkelPad.GetSelText
__________________

Get selected text.

  GetSelText([nNewLine]);

Arguments
  nNewLine (only for AkelPad 4.x.x)
    1    //"\r" new line (default).
    2    //"\n" new line.
    3    //"\r\n" new line.

Return Value
  String. Selected text.

Example:
  var pSelText=AkelPad.GetSelText();


AkelPad.GetTextRange
____________________

Get text range.

  GetTextRange(nRangeStart, nRangeEnd[, nNewLine]);

Arguments
  nRangeStart
    Range first char index.
  nRangeEnd
    Range last char index.
  nNewLine (only for AkelPad 4.x.x)
    1    //"\r" new line (default).
    2    //"\n" new line.
    3    //"\r\n" new line.

Return Value
  String. Text range.

Example:
  var pTextRange=AkelPad.GetTextRange(0, 10);


AkelPad.ReplaceSel
__________________

Replace selection.

  ReplaceSel(pText[, bSelect]);

Arguments
  pText
    Text to replace with.
  bSelect
    true   select inserted text.
    false  don't select inserted text (default).

Return Value
  Zero.

Example:
  AkelPad.ReplaceSel("MyText");


AkelPad.TextFind
________________

Find text.

  TextFind(hHandle, pFindIt, nFlags);

Arguments
  hHandle
    Edit window handle. If zero then active edit window handle is used.
  pFindIt
    Text to find.
  nFlags
    0x00000001  //FR_DOWN        Find down.
    0x00000004  //FR_MATCHCASE   Search is case-sensitive.
    0x00100000  //FR_UP          Find up.
    0x00200000  //FR_BEGINNING   Search from beginning (usage: FR_DOWN|FR_BEGINNING).
    0x00400000  //FR_SELECTION   Search in selection (usage: FR_DOWN|FR_SELECTION).
    0x00800000  //FR_ESCAPESEQ   Search with escape sequences.
    0x01000000  //FR_ALLFILES    Search in all openned MDI documents (not implemented).
    0x08000000  //FR_CYCLESEARCH Cycle search.

Return Value
  Number. Character position of the next match. If there are no more matches, the return value is –1.

Example:
  var hEditWnd=AkelPad.GetEditWnd();
  AkelPad.TextFind(hEditWnd, "MySearchString", 0x00200001 /*FR_DOWN|FR_BEGINNING*/);


AkelPad.TextReplace
___________________

Find and replace text.

  TextReplace(hHandle, pFindIt, pReplaceWith, nFlags, bAll);

Arguments
  hHandle
    Edit window handle. If zero then active edit window handle is used.
  pFindIt
    Text to find.
  pReplaceWith
    Text to replace with.
  nFlags
    0x00000001  //FR_DOWN        Find down.
    0x00000004  //FR_MATCHCASE   Search is case-sensitive.
    0x00100000  //FR_UP          Find up.
    0x00200000  //FR_BEGINNING   Search from beginning (usage: FR_DOWN|FR_BEGINNING).
    0x00400000  //FR_SELECTION   Search in selection (usage: FR_DOWN|FR_SELECTION).
    0x00800000  //FR_ESCAPESEQ   Search with escape sequences.
    0x01000000  //FR_ALLFILES    Search in all openned MDI documents (not implemented).
    0x08000000  //FR_CYCLESEARCH Cycle search (works, if bAll == false).
  bAll
    true   replace all.
    false  replace single.

Return Value
  Number. Character position of the next match. If there are no more matches, the return value is –1.

Example:
  var hEditWnd=AkelPad.GetEditWnd();
  AkelPad.TextReplace(hEditWnd, "MySearchString", "MyReplaceText", 0x00200001 /*FR_DOWN|FR_BEGINNING*/, true);


AkelPad.GetClipboardText
________________________

Get clipboard text.

  GetClipboardText([bAnsi]);

Arguments
  bAnsi
    true   retrieve ansi text.
    false  retrieve unicode text (default).

Return Value
  String. Clipboard text.

Example:
  var pClipboardText=AkelPad.GetClipboardText();


AkelPad.SetClipboardText
________________________

Set clipboard text.

  SetClipboardText(pText);

Arguments
  pText
    Text to set.

Return Value
  Zero.

Example:
  AkelPad.SetClipboardText("MyText");


AkelPad.IsPluginRunning
_______________________

Is AkelPad plugin running.

  IsPluginRunning(pFunction);

Arguments
  pFunction
    Function to check.

Return Value
  true   plugin is running.
  false  plugin isn't running.

Example:
  var bRunning=AkelPad.IsPluginRunning("HighLight::Main");


AkelPad.Call
____________

Call AkelPad plugin.

  Call(pFunction[, ...]);

Arguments
  pFunction
    Function to call.
  ...
    Function parameters.

Return Value
   -1  //UD_FAILED               Operation failed.
    0  //UD_UNLOAD               Plugin unloaded.
  0x1  //UD_NONUNLOAD_ACTIVE     Plugin in memory and active.
  0x2  //UD_NONUNLOAD_NONACTIVE  Plugin in memory, but non-active.
  0x4  //UD_NONUNLOAD_UNCHANGE   Plugin in memory.
  0x8  //UD_HOTKEY_DODEFAULT     Hotkey default processing will done.

Example:
  var nResult=AkelPad.Call("Coder::HighLight", 2, "#000000", "#9BFF9B");


AkelPad.CallEx
______________

Call AkelPad plugin with flags.

  CallEx(nFlags, pFunction[, ...]);

Arguments
  nFlags
    0x02  //DLLCF_GETSUPPORT      Get PDS_* flags without function execution. See AkelDLL.h.
    0x04  //DLLCF_SWITCHAUTOLOAD  If function running after call then turn on autoload, if not then turn off autoload.
    0x08  //DLLCF_SAVENOW         Using with DLLCF_SWITCHAUTOLOAD. Call AKD_DLLSAVE with DLLSF_NOW after switching autoload flag.
    0x10  //DLLCF_SAVEONEXIT      Using with DLLCF_SWITCHAUTOLOAD. Call AKD_DLLSAVE with DLLSF_ONEXIT after switching autoload flag.
  pFunction
    Function to call.
  ...
    Function parameters.

Return Value
   -1  //UD_FAILED               Operation failed.
    0  //UD_UNLOAD               Plugin unloaded.
  0x1  //UD_NONUNLOAD_ACTIVE     Plugin in memory and active.
  0x2  //UD_NONUNLOAD_NONACTIVE  Plugin in memory, but non-active.
  0x4  //UD_NONUNLOAD_UNCHANGE   Plugin in memory.
  0x8  //UD_HOTKEY_DODEFAULT     Hotkey default processing will done.

Example:
  var nResult=AkelPad.CallEx(0x14 /*DLLCF_SWITCHAUTOLOAD|DLLCF_SAVEONEXIT*/, "Coder::HighLight");


AkelPad.Exec
____________

Execute program.

  Exec(pCommandLine[, pWorkDirectory][, nWait]);

Arguments
  pCommandLine
    Command line.
  pWorkDirectory
    Working directory. Default is "".
  nWait
    0  returns immediately after starting the program, automatically returning 0 (default).
    1  waits until the program finishes and returns any error code returned by the program.
    2  waits until the specified process is waiting for user input, automatically returning 0.

Return Value
  Number. Exit code.

Example:
  AkelPad.Exec("notepad.exe");


AkelPad.Command
_______________

Call AkelPad internal command.

  Command(nCmd);

Arguments
  nCmd
    Internal command number.

Return Value
  Number. Depend on command.

Example:
  AkelPad.Command(4101 /*IDM_FILE_NEW*/);


AkelPad.Font
____________

Set font.

  Font(pFont, nStyle, nSize);

Arguments
  pFont
    Font face, for example, "Courier". Unchanged, if "".
  nStyle
    0 ignored.
    1 normal.
    2 bold.
    3 italic.
    4 bold italic.
  nSize
    Font size. Unchanged, if 0.

Return Value
  Zero.

Example:
  AkelPad.Font("Courier", 4, 10)


AkelPad.Recode
______________

Recode selection.

  Recode(nCodePageFrom, nCodePageTo);

Arguments
  nCodePageFrom
    Recode codepage source.
  nCodePageTo
    Recode codepage target.

Return Value
  Zero.

Example:
  AkelPad.Recode(1252, 437);


AkelPad.Include
_______________

Add code from file.

  Include(pFileName);

Arguments
  pFileName
    File name, that located in "[AkelPad]\AkelFiles\Plugs\Scripts\Include" directory.

Remarks
  Method Include is the same as code eval(AkelPad.ReadFile("...")), but allow to detect error placement in include file, if error appear.

Return Value
  true   success.
  false  failed.

Example:
  var pParent;

  AkelPad.Include("CommonFunctions.js");
  pParent=GetParent("C:\\Program Files\\1.txt");
  WScript.Echo(pParent);


AkelPad.IsInclude
_________________

Detect is script executed with AkelPad.Include() method.

  IsInclude();

Return Value
  String. Include file name, if script executed with AkelPad.Include() method or "" otherwise.

Example:
  WScript.Echo("" + AkelPad.IsInclude());


AkelPad.OpenFile
________________

Open file.

  OpenFile(pFile[, nFlags][, nCodePage][, bBOM]);

Arguments
  pFile
    File to open.
  nFlags
    0x1  //OD_ADT_BINARY_ERROR     Check if file is binary.
    0x2  //OD_ADT_REG_CODEPAGE     If last open code page found in registry, then it will be
         //                        used with OD_ADT_DETECT_BOM flag, if not found, then next flags
         //                        will be used OD_ADT_DETECT_CODEPAGE|OD_ADT_DETECT_BOM.
    0x4  //OD_ADT_DETECT_CODEPAGE  Detect code page.
    0x8  //OD_ADT_DETECT_BOM       Detect BOM mark.
         //Default is 0xD          (OD_ADT_BINARY_ERROR|OD_ADT_DETECT_CODEPAGE|OD_ADT_DETECT_BOM).
  nCodePage
    File code page, ignored if (nFlags & OD_ADT_DETECT_CODEPAGE)
  bBOM
    File BOM, ignored if (nFlags & OD_ADT_DETECT_BOM)

Return Value
   0  //EOD_SUCCESS          Success.
  -1  //EOD_ADT_OPEN         Autodetect codepage, can't open file.
  -2  //EOD_ADT_ALLOC        Autodetect codepage, can't allocate buffer.
  -3  //EOD_ADT_READ         Autodetect codepage, read file error.
 -11  //EOD_OPEN             Can't open file.
 -12  //EOD_CANCEL           User press cancel.
 -13  //EOD_WINDOW_EXIST     File already opened.
 -14  //EOD_CODEPAGE_ERROR   Code page isn't implemented.
 -15  //EOD_STOP             Stopped from AKDN_OPENDOCUMENT_START.
 -16  //EOD_STREAMIN         Error in EM_STREAMIN.
 -17  //EOD_DOCUMENTS_LIMIT  Documents limit reached in MDI mode.
 -20  //EOD_MSGNO            File is skipped.
 -21  //EOD_MSGCANCEL        User press cancel.

Example:
  var bResult=AkelPad.OpenFile("C:\\MyFile.txt");


AkelPad.ReadFile
________________

Read contents of a file.

  ReadFile(pFile[, nFlags][, nCodePage][, bBOM]);

Arguments
  pFile
    File to read.
  nFlags
    0x1  //OD_ADT_BINARY_ERROR     Check if file is binary.
    0x2  //OD_ADT_REG_CODEPAGE     If last open code page found in registry, then it will be
         //                        used with OD_ADT_DETECT_BOM flag, if not found, then next flags
         //                        will be used OD_ADT_DETECT_CODEPAGE|OD_ADT_DETECT_BOM.
    0x4  //OD_ADT_DETECT_CODEPAGE  Detect code page.
    0x8  //OD_ADT_DETECT_BOM       Detect BOM mark.
         //Default is 0xD          (OD_ADT_BINARY_ERROR|OD_ADT_DETECT_CODEPAGE|OD_ADT_DETECT_BOM).
  nCodePage
    File code page, ignored if (nFlags & OD_ADT_DETECT_CODEPAGE).
  bBOM
    File BOM, ignored if (nFlags & OD_ADT_DETECT_BOM).

Return Value
  String. Contents of a file.

Example:
  var pText=AkelPad.ReadFile("C:\\MyFile.txt");


AkelPad.SaveFile
________________

Save document.

  SaveFile(hHandle, pFile[, nCodePage][, bBOM][, nFlags]);

Arguments
  hHandle
    Edit window handle. If zero then active edit window handle is used.
  pFile
    File name to save to.
  nCodePage
    Save codepage. If -1 or not specified, current codepage will be used.
  bBOM
    File byte order mark. 1 - exist, 0 - doesn't exist, -1 or not specified - current BOM will be used.
  nFlags
    0x1  //SD_UPDATE       Update file info in program.
    0x2  //SD_SELECTION    Save only selection.
         //Default is 0x1  (SD_UPDATE).

Return Value
   0  //ESD_SUCCESS         Success.
  -1  //ESD_OPEN            Can't open file.
  -2  //ESD_WRITE           Can't write to file.
  -3  //ESD_READONLY        File has read-only attribute.
  -4  //ESD_CODEPAGE_ERROR  Code page isn't implemented.
  -5  //ESD_STOP            Stopped from AKDN_SAVEDOCUMENT_START.
  -6  //ESD_STREAMOUT       Error in EM_STREAMOUT.

Example:
  var hEditWnd=AkelPad.GetEditWnd();
  var nResult=AkelPad.SaveFile(hEditWnd, "C:\\MyFile.txt");


AkelPad.SystemFunction
______________________

Create system function object.

  SystemFunction();

Return Value
  Object. System function object.

Example:
  var oSys=AkelPad.SystemFunction();


AkelPad.SystemFunction().AddParameter
_____________________________________

Add function parameter.

  AddParameter(vParameter);

Arguments
  vParameter
    Function parameter.

Return Value
  Zero.

Example:
  See AkelPad.SystemFunction().Call old syntax example.


AkelPad.SystemFunction().Call
_____________________________

Call system function.

  Call(pDllFunction[, ...]);

Arguments
  pDllFunction
    Function name in format "Dll::Function".
  ...
    Function parameters, must be integer, pointer or string.
    String parameter: in Windows 95/98/Me - Ansi string,
                      in Windows NT/2000/XP - Unicode string.

Return Value
  Number. Call result.

Example (new syntax):
  var hMainWnd=AkelPad.GetMainWnd();
  var oSys=AkelPad.SystemFunction();
  oSys.Call("user32::ShowWindow", hMainWnd, 6 /*SW_MINIMIZE*/);

Example (old syntax):
  var hMainWnd=AkelPad.GetMainWnd();
  var oSys=AkelPad.SystemFunction();
  oSys.AddParameter(hMainWnd);
  oSys.AddParameter(6 /*SW_MINIMIZE*/);
  oSys.Call("user32::ShowWindow");


AkelPad.SystemFunction().GetLastError
_____________________________________

Get call function last error.

  GetLastError();

Return Value
  Number. Call function last error.

Example:
  var hMainWnd=AkelPad.GetMainWnd();
  var oSys=AkelPad.SystemFunction();
  var nError;
  oSys.Call("user32::ShowWindow", hMainWnd, 6 /*SW_MINIMIZE*/);
  nError=oSys.GetLastError();


AkelPad.SystemFunction().RegisterCallback
_________________________________________

Register callback function.

  RegisterCallback(pFunction);

Arguments
  pFunction
    String of function name.

Remarks
  In the case of registration of several functions, necessary to place RegisterCallback directly in front of Call.

Return Value
  Object. Pointer on function.

Example:
  var oSys=AkelPad.SystemFunction();
  var lpEnumWindowsCallback;
  var nStopAfter=3;

  if (lpEnumWindowsCallback=oSys.RegisterCallback("EnumWindowsProc"))
  {
    oSys.Call("user32::EnumWindows", lpEnumWindowsCallback, 0);
    oSys.UnregisterCallback(lpEnumWindowsCallback);
  }

  function EnumWindowsProc(hWnd, lParam)
  {
    //Convert hWnd to hex
    if (hWnd < 0) hWnd=(0xFFFFFFFF + 1) + hWnd;
    hWnd="0x" + hWnd.toString(16).toUpperCase();

    //Show parameters
    WScript.Echo("hWnd=" + hWnd + "; lParam=" + lParam);

    if (--nStopAfter <= 0)
      return false;
    else
      return true;
  }


AkelPad.SystemFunction().UnregisterCallback
___________________________________________

Remove callback function registration. Currently x64 not supported.

  UnregisterCallback(oFunction);

Arguments
  oFunction
    Pointer on function.

Return Value
  Zero.

Example:
  See RegisterCallback example.


AkelPad.MemAlloc
________________

Allocate memory.

  MemAlloc(nSize);

Arguments
  nSize
    Size in bytes to allocate.

Return Value
  Number. Pointer to a buffer.

Example:
  var hMainWnd=AkelPad.GetMainWnd();
  var oSys=AkelPad.SystemFunction();
  var pMessage="MyMessage";
  var pCaption="MyCaption";
  var lpMessageBuffer;
  var lpCaptionBuffer;

  if (lpMessageBuffer=AkelPad.MemAlloc(256))
  {
    AkelPad.MemCopy(lpMessageBuffer, pMessage.substr(0, 255), 0 /*DT_ANSI*/);

    if (lpCaptionBuffer=AkelPad.MemAlloc(256))
    {
      AkelPad.MemCopy(lpCaptionBuffer, pCaption.substr(0, 255), 0 /*DT_ANSI*/);

      oSys.Call("user32::MessageBoxA", hMainWnd, lpMessageBuffer, lpCaptionBuffer, 64 /*MB_ICONINFORMATION*/);

      AkelPad.MemFree(lpCaptionBuffer);
    }
    AkelPad.MemFree(lpMessageBuffer);
  }


AkelPad.MemCopy
_______________

Copy memory.

  MemCopy(lpPointer, vData, nType);

Arguments
  lpPointer
    Pointer to a buffer.
  vData
    Data to copy.
  nType
    Type of the vData parameter:
    0  //DT_ANSI        Copy Ansi string to memory.
    1  //DT_UNICODE     Copy Unicode string to memory.
    2  //DT_QWORD       Copy QWORD number to memory on x64 or DWORD number on x86.
    3  //DT_DWORD       Copy DWORD number to memory.
    4  //DT_WORD        Copy WORD number to memory.
    5  //DT_BYTE        Copy BYTE number to memory.

Return Value
  Number. Bytes copied.

Example:
  See MemAlloc example.


AkelPad.MemRead
_______________

Read memory.

  MemRead(lpPointer, nType);

Arguments
  lpPointer
    Pointer to a buffer.
  nType
    0  //DT_ANSI        Read Ansi string from memory.
    1  //DT_UNICODE     Read Unicode string from memory.
    2  //DT_QWORD       Read QWORD number from memory on x64 or DWORD number on x86.
    3  //DT_DWORD       Read DWORD number from memory.
    4  //DT_WORD        Read WORD number from memory.
    5  //DT_BYTE        Read BYTE number from memory.

Return Value
  String or number.

Example:
  var oSys=AkelPad.SystemFunction();
  var lpDirBuffer;
  var pWinDir;

  if (lpDirBuffer=AkelPad.MemAlloc(256))
  {
    oSys.Call("kernel32::GetWindowsDirectoryA", lpDirBuffer, 256);
    pWinDir=AkelPad.MemRead(lpDirBuffer, 0 /*DT_ANSI*/);

    AkelPad.MemFree(lpDirBuffer);
  }


AkelPad.MemStrPtr
_________________

Get pointer to a script unicode string.

  MemStrPtr(pString);

Arguments
  pString
    Constant string or string object.

Return Value
  Number. Pointer to a unicode string.

Example:
  var hMainWnd=AkelPad.GetMainWnd();
  AkelPad.SendMessage(hMainWnd, 1206 /*AKD_GOTOW*/, 0x1 /*GT_LINE*/, AkelPad.MemStrPtr("10:3"));


AkelPad.MemFree
_______________

Free memory.

  MemFree(lpPointer);

Arguments
  lpPointer
    Pointer to a buffer.

Return Value
  Zero.

Example:
  See MemAlloc example.


AkelPad.Debug
_____________

Debug memory usage.

  Debug([dwType]);

Arguments
  dwType
    0x1  //DBG_MEMREAD     Debug memory read.
    0x2  //DBG_MEMWRITE    Debug memory write.
    0x4  //DBG_MEMFREE     Debug memory free.
    0x8  //DBG_MEMLEAK     Debug memory leak.
         //Default is 0xf  (DBG_MEMREAD|DBG_MEMWRITE|DBG_MEMFREE|DBG_MEMLEAK).

Return Value
  Previous dwType value.

Example:
  var lpBuffer;

  AkelPad.Debug();

  if (lpBuffer=AkelPad.MemAlloc(2))
  {
    AkelPad.MemCopy(lpBuffer, 123, 3 /*DT_DWORD*/);

    AkelPad.MemFree(lpBuffer);
  }


AkelPad.VarType
_______________

Retrieve variable type.

  VarType(vData);

Arguments
  vData
    Variable.

Return Value
  Number. Type (VARTYPE) of variable (VARIANT).
       0 //VT_EMPTY
       1 //VT_NULL
       2 //VT_I2
       3 //VT_I4
       4 //VT_R4
       5 //VT_R8
       6 //VT_CY
       7 //VT_DATE
       8 //VT_BSTR
       9 //VT_DISPATCH
      10 //VT_ERROR
      11 //VT_BOOL
      12 //VT_VARIANT
      13 //VT_UNKNOWN
      14 //VT_DECIMAL
      16 //VT_I1
      17 //VT_UI1
      18 //VT_UI2
      19 //VT_UI4
      20 //VT_I8
      21 //VT_UI8
      22 //VT_INT
      23 //VT_UINT
      24 //VT_VOID
      25 //VT_HRESULT
      26 //VT_PTR
      27 //VT_SAFEARRAY
      28 //VT_CARRAY
      29 //VT_USERDEFINED
      30 //VT_LPSTR
      31 //VT_LPWSTR
      36 //VT_RECORD
      37 //VT_INT_PTR
      38 //VT_UINT_PTR
      64 //VT_FILETIME
      65 //VT_BLOB
      66 //VT_STREAM
      67 //VT_STORAGE
      68 //VT_STREAMED_OBJECT
      69 //VT_STORED_OBJECT
      70 //VT_BLOB_OBJECT
      71 //VT_CF
      72 //VT_CLSID
      73 //VT_VERSIONED_STREAM
  0x0fff //VT_BSTR_BLOB
  0x1000 //VT_VECTOR
  0x2000 //VT_ARRAY
  0x4000 //VT_BYREF
  0x8000 //VT_RESERVED
  0xffff //VT_ILLEGAL
  0x0fff //VT_ILLEGALMASKED
  0x0fff //VT_TYPEMASK

Example:
  var pString="123";
  WScript.Echo("" + AkelPad.VarType(pString));


AkelPad.GetArgLine
__________________

Retrieve argument line.

  GetArgLine([bNoEncloseQuotes]);

Arguments
  bNoEncloseQuotes
    true   Exclude enclose quotes (by default).
    false  Leave enclose quotes.

Return Value
  String. Argument line.

Example:
  var pArgLine;
  
  if (pArgLine=AkelPad.GetArgLine(0))
    WScript.Echo(pArgLine);


AkelPad.GetArgValue
___________________

Retrieve argument value by name.

  GetArgValue(pArgName, vDefault);

Arguments
  pArgName
    Argument name.
  vDefault
    Default value. Set if specified argument name not found.

Return Value
  Argument value. Type inherited from default value.

Example:
  //Script was invoked as follows:
  //Call("Scripts::Main", 1, "MyScript.js", `-ArgName1=0.01 -ArgName2="Value2" /ArgName3=0x10`)

  //Get values 0.01, Value2, 0x10 by names ArgName1, ArgName2, ArgName3.  
  var nArg1=AkelPad.GetArgValue("ArgName1", 0);
  var pArg2=AkelPad.GetArgValue("ArgName2", "");
  var nArg3=AkelPad.GetArgValue("ArgName3", 0);

  WScript.Echo("VarType=" + AkelPad.VarType(nArg1) + "; ArgValue=" + nArg1 + "\r" +
               "VarType=" + AkelPad.VarType(pArg2) + "; ArgValue=" + pArg2 + "\r" +
               "VarType=" + AkelPad.VarType(nArg3) + "; ArgValue=" + nArg3 + "\r");


AkelPad.ScriptSettings
______________________

Create script settings object.

  ScriptSettings();

Return Value
  Object. Script settings object.

Example:
  var oSet=AkelPad.ScriptSettings();


AkelPad.ScriptSettings().Begin
______________________________

Begin settings operations.

  Begin(pScriptName, nFlags);

Arguments
  pScriptName
    Script name without extension.
  nFlags
    0x1  //POB_READ   Begins read options.
    0x2  //POB_SAVE   Begins save options.
    0x4  //POB_CLEAR  Begins new save options (POB_SAVE|POB_CLEAR).

Return Value
  Number. Settings handle.

Example:
  See Read, Write and Delete examples.


AkelPad.ScriptSettings().Read
_____________________________

Read option.

  Read(pOptionName, nType[, vDefault]);

Arguments
  pOptionName
    Option name.
  nType
    1   //PO_DWORD   Read 32-bit number (DWORD).
    2   //PO_BINARY  Read binary data in any form.
    3   //PO_STRING  Read string.
  vDefault
    Default data.

Return Value
  String or number.

Example:
  var oSet=AkelPad.ScriptSettings();

  if (oSet.Begin(WScript.ScriptBaseName, 0x1 /*POB_READ*/))
  {
    pString=oSet.Read("String", 3 /*PO_STRING*/);
    bMultiline=oSet.Read("Multiline", 1 /*PO_DWORD*/);

    oSet.End();
  }


AkelPad.ScriptSettings().Write
______________________________

Write option.

  Write(pOptionName, nType, vData[, nDataSize]);

Arguments
  pOptionName
    Option name.
  nType
    1   //PO_DWORD   Write 32-bit number (DWORD).
    2   //PO_BINARY  Write binary data in any form.
    3   //PO_STRING  Write string.
  vData
    Data to write.
  nDataSize
    Data size in bytes. Can be omitted if PO_DWORD or PO_STRING used (default is -1).

Return Value
  Number. Written data size in bytes.

Example:
  var oSet=AkelPad.ScriptSettings();

  if (oSet.Begin(WScript.ScriptBaseName, 0x2 /*POB_SAVE*/))
  {
    oSet.Write("String", 3 /*PO_STRING*/, "Str1");
    oSet.Write("Sensitive", 1 /*PO_DWORD*/, true);

    oSet.End();
  }


AkelPad.ScriptSettings().Delete
_______________________________

Delete option.

  Delete(pOptionName);

Arguments
  pOptionName
    Option name.

Return Value
  true   success.
  false  failed.

Example:
  var oSet=AkelPad.ScriptSettings();

  if (oSet.Begin(WScript.ScriptBaseName, 0x2 /*POB_SAVE*/))
  {
    oSet.Delete("String");
    oSet.Delete("Sensitive");

    oSet.End();
  }


AkelPad.ScriptSettings().End
____________________________

End settings operations.

  End();

Return Value
  true   success.
  false  failed.

Example:
  See Read, Write and Delete examples.


AkelPad.WindowRegisterClass
___________________________

Register window class.

  WindowRegisterClass(pClassName);

Arguments
  pClassName
    Class name to register.

Return Value
  Number. Class atom that uniquely identifies the class being registered.

Example (JScript):
  var hMainWnd=AkelPad.GetMainWnd();
  var oSys=AkelPad.SystemFunction();
  var hInstanceDLL=AkelPad.GetInstanceDll();
  var hWndDialog;

  if (hMainWnd)
  {
    if (AkelPad.WindowRegisterClass("NewClass"))
    {
      //Create dialog
      hWndDialog=oSys.Call("user32::CreateWindowEx" + _TCHAR,
                           0,                //dwExStyle
                           "NewClass",       //lpClassName
                           0,                //lpWindowName
                           0x90CA0000,       //WS_VISIBLE|WS_POPUP|WS_CAPTION|WS_SYSMENU|WS_MINIMIZEBOX
                           0,                //x
                           0,                //y
                           351,              //nWidth
                           179,              //nHeight
                           hMainWnd,         //hWndParent
                           0,                //ID
                           hInstanceDLL,     //hInstance
                           DialogCallback);  //Script function callback. To use it class must be registered by WindowRegisterClass.

      if (hWndDialog)
      {
        //Disable main window, to make dialog modal
        oSys.Call("user32::EnableWindow", hMainWnd, false);

        //Message loop
        AkelPad.WindowGetMessage();
      }
      AkelPad.WindowUnregisterClass("NewClass");
    }
  }

  function DialogCallback(hWnd, uMsg, wParam, lParam)
  {
    if (uMsg == 1 /*WM_CREATE*/)
    {
    }
    else if (uMsg == 256 /*WM_KEYDOWN*/)
    {
      if (wParam == 27 /*VK_ESCAPE*/)
      {
        //Escape key pushes Cancel button
        oSys.Call("user32::PostMessage" + _TCHAR, hWndDialog, 273 /*WM_COMMAND*/, 2 /*IDCANCEL*/, 0);
      }
    }
    else if (uMsg == 273 /*WM_COMMAND*/)
    {
      if ((wParam & 0xffff) == 2 /*IDCANCEL*/)
      {
        oSys.Call("user32::PostMessage" + _TCHAR, hWndDialog, 16 /*WM_CLOSE*/, 0, 0);
      }
    }
    else if (uMsg == 16 /*WM_CLOSE*/)
    {
      //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);
    }
    return 0;
  }


Example (VBScript):
  'Variables
  hMainWnd=AkelPad.GetMainWnd()
  hInstanceDLL=AkelPad.GetInstanceDll()
  set oSys=AkelPad.SystemFunction()
  set lpCallbackPtr=GetRef("DialogCallback")
  hWndDialog=0

  'VBScript deny names start with (_) underscope
  if AkelPad.IsOldWindows() then
    TCHAR="A"
    TSIZE=1
    TSTR=0
  else
    TCHAR="W"
    TSIZE=2
    TSTR=1
  end if

  'Constants
  Const WM_CREATE=1
  Const WM_KEYDOWN=256
  Const WM_COMMAND=273
  Const WM_CLOSE=16
  Const WM_DESTROY=2
  Const VK_ESCAPE=27
  Const IDCANCEL=2

  if hMainWnd then
    if AkelPad.WindowRegisterClass("NewClass") then

      'Create dialog WS_VISIBLE|WS_POPUP|WS_CAPTION|WS_SYSMENU|WS_MINIMIZEBOX
      hWndDialog=oSys.Call("user32::CreateWindowEx" & TCHAR, 0, "NewClass", 0, &H90CA0000, 0, 0, 351, 179, hMainWnd, 0, hInstanceDLL, lpCallbackPtr)

      if hWndDialog then
        'Disable main window, to make dialog modal
        oSys.Call "user32::EnableWindow", hMainWnd, false

        'Message loop
        AkelPad.WindowGetMessage()
      end if

      AkelPad.WindowUnregisterClass "NewClass"
    end if
  end if

  Function DialogCallback(hWnd, uMsg, wParam, lParam)
    if uMsg = WM_CREATE then
    elseif uMsg = WM_KEYDOWN then
      if wParam = VK_ESCAPE then
        'Escape key pushes Cancel button
        oSys.Call "user32::PostMessage" & TCHAR, hWndDialog, WM_COMMAND, IDCANCEL, 0
      end if
    elseif uMsg = WM_COMMAND then
      if (wParam And &Hffff) = IDCANCEL then
        oSys.Call "user32::PostMessage" & TCHAR, hWndDialog, WM_CLOSE, 0, 0
      end if
    elseif uMsg = WM_CLOSE then
      'Enable main window
      oSys.Call "user32::EnableWindow", hMainWnd, true

      'Destroy dialog
      oSys.Call "user32::DestroyWindow", hWnd
    elseif uMsg = WM_DESTROY then
      'Exit message loop
      oSys.Call "user32::PostQuitMessage", 0
    end if
    DialogCallback=0
  End Function


AkelPad.WindowUnregisterClass
_____________________________

Unregister window class.

  WindowUnregisterClass(pClassName);

Arguments
  pClassName
    Class name to unregister.

Return Value
  true   success.
  false  failed.

Example:
  See WindowRegisterClass example.


AkelPad.WindowGetMessage
________________________

Process thread messages (message loop).

  WindowGetMessage();

Return Value
  Zero.

Example:
  See WindowRegisterClass example.


AkelPad.WindowSubClass
______________________

Install capture for window messages.

  WindowSubClass(hHandle, lpFunction);

Arguments
  hHandle
    Window handle.
  lpFunction
    Function with 4 arguments, in which messages will come.

Return Value
  Number. Previous procedure address.

Example:
  var hWndEdit=AkelPad.GetEditWnd();
  var oSys=AkelPad.SystemFunction();

  if (AkelPad.WindowSubClass(hWndEdit, EditCallback))
  {
    //Message loop
    AkelPad.WindowGetMessage();

    AkelPad.WindowUnsubClass(hWndEdit);
  }

  function EditCallback(hWnd, uMsg, wParam, lParam)
  {
    if (uMsg == 0x102 /*WM_CHAR*/)
    {
      AkelPad.MessageBox(0, "Key \"" + String.fromCharCode(wParam) + "\" is pressed.", "", 0);

      //Exit message loop
      oSys.Call("user32::PostQuitMessage", 0);
    }
  }


AkelPad.WindowUnsubClass
________________________

Remove capture for window messages.

  WindowUnsubClass(hHandle);

Arguments
  hHandle
    Window handle.

Return Value
  Zero.

Example:
  See WindowSubClass example.


AkelPad.ThreadHook
__________________

Install hook for thread.

  ThreadHook(nId, lpFunction, nThreadId);

Arguments
  nId
    See first parameter of SetWindowsHookEx in MSDN.
  lpFunction
    Function with 3 arguments, which will be called.
  nThreadId
    Thread identifier. If zero, the hook is installed for all existing threads of all processes.

Return Value
  Number. Hook handle.

Remarks
  The maximum number of installed hooks at the same time is 4.

Example:
  var hMainWnd=AkelPad.GetMainWnd();
  var oSys=AkelPad.SystemFunction();
  var dwMainThreadID=oSys.Call("user32::GetWindowThreadProcessId", hMainWnd, 0);
  var hHook;

  if (hHook=AkelPad.ThreadHook(3 /*WH_GETMESSAGE*/, HookCallback, dwMainThreadID))
  {
    //Message loop
    AkelPad.WindowGetMessage();

    AkelPad.ThreadUnhook(hHook);
  }

  function HookCallback(nCode, wParam, lParam)
  {
    var uMsg=AkelPad.MemRead(lParam + (_X64?8:4) /*offsetof(MSG, message)*/, 2 /*DT_QWORD*/);

    if (uMsg == 0x100 /*WM_KEYDOWN*/)
    {
      wParam=AkelPad.MemRead(lParam + (_X64?16:8) /*offsetof(MSG, wParam)*/, 2 /*DT_QWORD*/);

      AkelPad.MessageBox(0, "Key \"" + String.fromCharCode(wParam) + "\" with code \"" + wParam + "\" is pressed.", "", 0);

      //Exit message loop
      oSys.Call("user32::PostQuitMessage", 0);
    }
  }


AkelPad.ThreadUnhook
____________________

Remove hook from thread.

  ThreadUnhook(hHandle);

Arguments
  hHandle
    Hook handle.

Return Value
  Zero.

Example:
  See ThreadHook example.


AkelPad.ScriptNoMutex
_____________________

Change synchronization object.

  ScriptNoMutex([nUnlockType]);

Arguments
  nUnlockType
    0x1  //ULT_UNLOCKSCRIPTSQUEUE   Allow other scripts running with this script at the same time (by default).
    0x2  //ULT_UNLOCKPROGRAMTHREAD  Unlock main thread from waiting this script. Only if script is called with extenal call with code 2.
    0x4  //ULT_LOCKMULTICOPY        Deny execution of the multiple script copies. By default execution is not denied.
    0x8  //ULT_UNLOCKMULTICOPY      Allow execution of the multiple script copies.

Return Value
  Number. Changed synchronization objects, see nUnlockType.

Example:
  AkelPad.ScriptNoMutex();


_TCHAR
______

Constant that determines the end of system functions. Uses for AkelPad.SystemFunction().Call method.

  _TCHAR

Return Value
  String. "A" - functions calls with "A" ending (Windows 95/98/Me).
          "W" - functions calls with "W" ending (Windows NT/2000/XP).

Example:
  //How to provide support for Unicode and not lose compatibility with Win9x:
  var oSys=AkelPad.SystemFunction();
  var lpBuffer;
  var pWinDir;

  if (lpBuffer=AkelPad.MemAlloc(256 * _TSIZE))
  {
    oSys.Call("kernel32::GetWindowsDirectory" + _TCHAR, lpBuffer, 256);
    pWinDir=AkelPad.MemRead(lpBuffer, _TSTR);

    AkelPad.MemFree(lpBuffer);
  }


_TSTR
_____

Constant that determines the string type. Uses for MemCopy and MemRead methods.

  _TSTR

Return Value
  Number. 0 - DT_ANSI - ansi string (Windows 95/98/Me).
          1 - DT_UNICODE - unicode string (Windows NT/2000/XP).

Example:
  See _TCHAR example.


_TSIZE
______

Constant that determines the size of symbol in bytes. Uses for MemAlloc method.

  _TSIZE

Return Value
  Number. 1 - sizeof(char) - one byte (Windows 95/98/Me).
          2 - sizeof(wchar_t) - two bytes (Windows NT/2000/XP).

Example:
  See _TCHAR example.


_X64
____

Constant that determines the program bits type - x86 or x64.

  _X64

Return Value
  Number. 0 - x86 version.
          1 - x64 version.

Example:
  if (_X64)
    WScript.Echo("x64 version");
  else
    WScript.Echo("x86 version");