sieukrem / jn-npp-plugin

Plugin for Notepad++ allowing you to automate some tasks using JavaScript
https://github.com/sieukrem/jn-npp-plugin/wiki
110 stars 24 forks source link

Is it possible to somehow intercept the Alt + key in the script? #67

Closed trdm closed 6 years ago

trdm commented 6 years ago

I will explain the situation. To introduce some characters you need to switch from Russian to Latin. In the 1C editor, it is possible to assign symbols of the type Alt + 'e' to Hotkey, which gives Alt + '' ' And how to do this in jN? I can not find Virtual-Key Codes here https://msdn.microsoft.com/en-us/library/dd375731%28VS.85%29.aspx Interested in entering without modifying the layout of the characters: ', <, >, $, &

trdm commented 6 years ago

Did the workpiece, only to get psKey for addHotSym? function addHotSym (psFu, psKey)

function typeSymbol( psSymb ) { Editor.currentView.selection = psSymb; }
function addHotSym(psFu, psKey) {
    var rv = {
        ctrl: false,
        shift: false,
        alt: true,
        key: psKey, // "I"
        cmd: psFu
    };
    //addHotKey(rv);
}

function typeSymbol_1() {   typeSymbol( '<' );} addHotSym(typeSymbol_1,0);
function typeSymbol_2() {   typeSymbol( '>' );} addHotSym(typeSymbol_2,0);
function typeSymbol_3() {   typeSymbol( '\'' );} addHotSym(typeSymbol_3,0);
function typeSymbol_4() {   typeSymbol( '~' );} addHotSym(typeSymbol_4,0);
function typeSymbol_5() {   typeSymbol( '$' );} addHotSym(typeSymbol_5,0);
trdm commented 6 years ago

Solved a problem: // Ввод символов в русской раскладке схема Alt+' >> ' ; Alt+$ >> $. Можно не переключать раскладку. function typeSymbol_1() { typeSymbol( '<' );} addHotSym(typeSymbol_1,0xBC); function typeSymbol_3() { typeSymbol( '\'' );} addHotSym(typeSymbol_3,0xDE); function typeSymbol_2() { typeSymbol( '>' );} addHotSym(typeSymbol_2,0xBE); function typeSymbol_4() { typeSymbol( '~' );} addHotSym(typeSymbol_4,0xC0); function typeSymbol_5() { typeSymbol( '$' );} addHotSym(typeSymbol_5,0x34);