Veel Voorkomende Vragen

 
 

Hoe voeg ik nieuwe commando's toe aan de Commando Prompt?

De HTML-Kit kan commandos'en frases via de Commando Pormpt in het Berichtenvenster ingeven. Deze mogelijkheid kan worden gebruikt om modulen toe te passen en deze íntelligent' te gerbuiken. Bijvoorbeeld, een calculator-plugin voegt een 'calc'-commando toe dat kan worden gebruikt om berekeningen uit te voeren, en een kleurenkaart-plugin kan commandos toevoegen om hexadecimale waarden om te zetten in namen van kleuren.

De volgende voorbeeld-plugin voegt twee commando's toe aan de Commando Prompt. Sla de volgende code op in een bestand genaamd: demoCommandPromptHandler.hks en installeer het met behulp van "Gereedschap| Installeer | Installeer plugin" in het hoofdmenu. Om deze plugin te testen HI of DEMOND in het Commando Prompt venster en druk op Enter.

=== hier afknippen ===

function hkp_Register(pDataIn, pDataOut)
{
  hkp_DataSetGlobalSuffix("_1");

    // name of the plugin (must be unique)
  hkp_DataAdd(pDataOut, "NAME", "demoCommandPromptRun");

  hkp_DataAdd(pDataOut, "HINT", "Demonstrates how to read the command line parameters passed through the Command Prompt window.");

  hkp_DataAdd(pDataOut, "SECTION", "hkpDemos");

    // no need to show a button on the ActionsBar
  hkp_DataAddInt(pDataOut, "BUTTON_VISIBLE", 0);

    // editor not required
  hkp_DataAddInt(pDataOut, "MODE_EDITOR_REQUIRED", 0);

    // respond to commands "notepad" and "np"
  hkp_DataAdd(pDataOut, "COMMANDPROMPT_COMMANDS", "notepad,np");

    // some help text
  hkp_DataAdd(pDataOut, "COMMANDPROMPT_HELP", "Opens Notepad with the specified parameters.");

    // request command prompt events
  hkp_DataAddInt(pDataOut, "COMMANDPROMPT_EVENT_ONINVOKE", 1);

  hkp_DataSetGlobalSuffix("");
}

function hkp_Main(pDataIn, pDataOut)
{
    // is this a command prompt event?
  if( 1400 == hkp_DataGetInt(pDataIn, "EVENT", 0) )
  {
    var sText = "", sCommand = "", sParams = "", sExec = "";

    if( hkp_DataGet(pDataIn, "COMMANDPROMPT_IN_CMDLINE_COMMAND", &sText) )
    {
      sCommand = sText;
    }
    if( hkp_DataGet(pDataIn, "COMMANDPROMPT_IN_CMDLINE_PARAMS", &sText) && length(sText) )
    {
      sParams = sText;
    }

    sExec = "notepad.exe "+sParams;

    WinExec(sExec, 1);

    hkp_DataAdd(pDataOut, "COMMANDPROMPT_OUTPUT", "Executing: "+sExec);
  }

    // no other output either way
  hkp_DataAddInt(pDataOut, "MODE_OUTPUT", 1);
}

=== hier afknippen ===
 
Terug
 
© 2005 Chami.com. All Rights Reserved. | Translation © 2005 Gerard Schaefers