Viewing 1 post (of 1 total)
  • Author
    Posts
  • #9788
    Stefan
    Participant

    Just as an example what can be done.

    An how to add an own pop-up menu to execute an function
    from your script/macro or EmEditors build-in commandos.

    You can create your own menu in EmEditor,
    here e.g. an pop-up menu, launched by key-press or from customized menu:

    To create your own pop-up menu follow this steps:
    1. Copy the below code into EmEditor and Save as e.g. myMenu.jsee
    2. Execute menu “Macros > Select This” to add this macro to My Macros
    3. Assign an keyboard shortcut to launch this pop-up menu
    > Tools > Properties for all configurations > [Keyboard]
    > Category: My Macros
    > Commands: myMenu.jsee
    > Press new shortcut key: e.g. Ctrl+Alt+M
    > [Assign]
    > [OK]

    How to use:
    – press “Ctrl+Alt+M” to launch your new menu.

    The code to create such an menu:


    MyMenu=CreatePopupMenu();

    MyMenu.Add("Execute Function &one",1);
    MyMenu.Add("Execute Function &two",2);
    MyMenu.Add( "", 0, eeMenuSeparator );
    MyMenu.Add("Echo: &Hello World!",3);
    MyMenu.Add( "", 0, eeMenuSeparator );
    MyMenu.Add("&About",100);

    var vItem = MyMenu.Track();

    switch(vItem)
    {
    case 1:
    one();
    break;
    case 2:
    two();
    alert("This was second case.");
    break;
    case 3:
    alert("Hello World!");
    break;
    case 100:
    alert("Just an little test.nThank you!nnnStefan");
    break;
    default:
    break;
    }

    function two(){alert("This is an EmEditor Popup-menu test")}
    function one(){alert("Name of this file: " + document.FullName);}


    See EmEditor help > PopupMenu Object for more infos.

    Instead, or as addition, to use an shortcut to launch your menu,
    you can customize the EmEditor main menu (or others, e.g.
    the context or the tray-icon menu) to add your own menu-items
    or even an completely whole new menu.

    You have saved the pop-up menu script as shown above to an file?
    Now, follow this steps:

    * Tools > Customize Menus…
    * choose here e.g. ‘Main Menu’
    * click at the last item: ‘&Help’
    * click at [Insert Below]
    >> (o)Popup, Name: ‘MyMenu’
    >> [OK]
    * click at the last item: ‘MyMenu’
    * click at [Insert Right]
    >> (o)Command
    >> Category: My Macros
    >> Commands: myMenu.jsee
    >> [OK]
    > [OK]

    (Instead of an own menu, you can also add your script as an item to e.g Tools menu)

    You should have an new main menu entry ‘MyMenu’ now after ‘Help’:

    How to use:
    – click at the item in your menu to launch your script.

    An pop-up menu example:

    .

Viewing 1 post (of 1 total)
  • You must be logged in to reply to this topic.