{*******************************************************}
{                                                       }
{       Pascal Script Source File                       }
{       Run by RemObjects Pascal Script in CnWizards    }
{                                                       }
{       Generated by CnPack IDE Wizards                 }
{                                                       }
{*******************************************************}

program ActionShortCut;

uses
  Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
  CnWizUtils;

// This script shows how to get IDE Action Names and Set Action Shortcut.
  
var
  ActionList: TCustomActionList;
  I: Integer;
  List: TStrings;
  Action: TContainedAction;

begin
  // Print All Action Names and Captions.
  ActionList := GetIDEActionList;
  List := TStringList.Create;
  try
    for I := 0 to ActionList.ActionCount - 1 do
      if ActionList.Actions[I] is TCustomAction then
        List.Add(ActionList.Actions[I].Name + ' | ' + TCustomAction(ActionList.Actions[I]).Caption +
          ' | ' + ShortCutToText(TCustomAction(ActionList.Actions[I]).ShortCut))
      else
        List.Add(ActionList.Actions[I].Name);

    Writeln(List.Text);
  finally
    List.Free;
  end;

  // Change shortcut of 'View AlignPalette' in View Menu.
  Action := FindIDEAction('ViewAlignPaletteCommand');
  if (Action <> nil) and (Action is TCustomAction) then
  begin
    TCustomAction(Action).ShortCut := TextToShortCut('Shift+Alt+A');
    Writeln('Now You can Show Align Palette by Pressing Shift+Alt+A.');
  end;
end.

 