Scripts plugin

Discuss and announce AkelPad plugins
  • Author
  • Message
Offline
Site Admin
Posts: 6311
Joined: Thu Jul 06, 2006 7:20 am

Post by Instructor »

F. Phoenix
Вставляете в тексте скрипта "debugger" или "AkelPad.DebugJIT();".

Offline
Site Admin
Posts: 6311
Joined: Thu Jul 06, 2006 7:20 am

Post by Instructor »

Изменено: для методов AkelPad.Call*, если был вызван скрипт, возвращается результат AkelPad.ScriptExitCode.

Changed: for AkelPad.Call* methods, if script was called, then result of AkelPad.ScriptExitCode returns.


Scripts plugin v18.6

Offline
Posts: 142
Joined: Fri Aug 15, 2008 8:58 am

SetClipboardText not respect carriage return

Post by Diamen »

When i use SetClipboardText to copy a text block that have carriage returns and past in other tab it work.
But if i paste it to other software, f.e. notepad.exe, it remove all carriage return.
I think that this happens because SetClipboardText does not take into consideration the set carriage return (unix, window, mac).
Not problem if use copy to clipboard from contextual menu.
Do it is possible to fix it?
my workaround use
var clp=AkelPad.GetSelText().replace(/[\r\n]/g, "\r\n");
before of
AkelPad.SetClipboardText(clp);

DV
Offline
Posts: 1250
Joined: Thu Nov 16, 2006 11:53 am
Location: Kyiv, Ukraine

Re: SetClipboardText not respect carriage return

Post by DV »

Diamen wrote:var clp=AkelPad.GetSelText().replace(/[\r\n]/g, "\r\n");
This is a good solution. Many editors do support different line ending characters (unlike the standard Notepad), so in general it's OK to set the clipboard text as is.
However, an optional parameter nNewLine for SetClipboardText (similar to the one in GetSelText and GetTextRange) would indeed make sense.

Offline
Site Admin
Posts: 6311
Joined: Thu Jul 06, 2006 7:20 am

Post by Instructor »

Diamen
AkelPad.GetSelText(3 /*\r\n*/)

Offline
Posts: 142
Joined: Fri Aug 15, 2008 8:58 am

Post by Diamen »

Instructor
It fix, ty.

Do exist a same option for copy from menu and context menu?

Offline
Site Admin
Posts: 6311
Joined: Thu Jul 06, 2006 7:20 am

Post by Instructor »

Diamen
Now only as script:

Code: Select all

var hWndEdit=AkelPad.GetEditWnd();
var dwNewLine=AkelPad.SendMessage(hWndEdit, 3229 /*AEM_GETNEWLINE*/, 0, 0);

AkelPad.SendMessage(hWndEdit, 3230 /*AEM_SETNEWLINE*/, 0x2 /*AENL_OUTPUT*/, MAKELONG(0, 7 /*AELB_RN*/));
AkelPad.SendMessage(hWndEdit, 3038 /*AEM_COPY*/, 0, 0);
AkelPad.SendMessage(hWndEdit, 3230 /*AEM_SETNEWLINE*/, 0x2 /*AENL_OUTPUT*/, dwNewLine);

function MAKELONG(a, b)
{
  return (a & 0xffff) | ((b & 0xffff) << 16);
}



Update:
With test version you can copy, cut, paste with specified new line. See documentation.

Offline
Posts: 142
Joined: Fri Aug 15, 2008 8:58 am

Post by Diamen »

Do you can share the x64 test version?

Offline
Posts: 1161
Joined: Sun Oct 20, 2013 11:44 am

Post by Skif_off »


KDJ
Offline
Posts: 1949
Joined: Sat Mar 06, 2010 7:40 pm
Location: Poland

Post by KDJ »

But these test versions are dated 03 November 2017.

Offline
Site Admin
Posts: 6311
Joined: Thu Jul 06, 2006 7:20 am

Post by Instructor »

KDJ
Forgot to upload :) Done.

Offline
Posts: 142
Joined: Fri Aug 15, 2008 8:58 am

Post by Diamen »

when i try to use:
"" Command(4154,10) Icon(8)
in toolbar:
1 - copy word under caret, if no selection
is not usable why button is disabled
how to enable it also without selection?

Offline
Posts: 874
Joined: Sat Jan 16, 2010 2:03 pm

Post by opk44 »

Diamen
how to enable it also without selection?

Code: Select all

-"" Command(4154,10) Icon(8) 
See "\AkelFiles\Docs\ToolBar-Eng.txt" Lines 122-133
...at presence of a minus sign the button status will not change somehow (become inactive, be pressed)...

Offline
Posts: 3217
Joined: Wed Nov 29, 2006 1:19 pm
Location: Киев, Русь
Contact:

Post by VladSh »

Diamen
You can to use the Hotkeys-plugin, also.

Offline
Posts: 142
Joined: Fri Aug 15, 2008 8:58 am

Post by Diamen »

opk44 wrote: ...at presence of a minus sign the button status will not change somehow (become inactive, be pressed)...
ty.
Post Reply