AkelPad Forum Index AkelPad
Support forum
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

hotkey for text margins etc -- a "writer's script"
Goto page Previous  1, 2, 3  Next
 
Post new topic   Reply to topic    AkelPad Forum Index -> Discussion (English)
View previous topic :: View next topic  
Author Message
FeyFre



Joined: 07 Aug 2007
Posts: 2038
Location: Vinnitsa, Ukraine

PostPosted: Sat Aug 20, 2011 7:58 am    Post subject: Reply with quote

Quote:
assigned it to a hotkey
You assigned hotkey in HotKey plugin or in Scripts plugin? In any case that plugin should be setup for autoload.
Back to top
View user's profile Send private message AIM Address Yahoo Messenger MSN Messenger
se7h



Joined: 28 Sep 2009
Posts: 767
Location: Minsk, Belarus

PostPosted: Sat Aug 20, 2011 8:00 am    Post subject: Reply with quote

martz

Try to understand

Script worked before you changed the names of schemes?

Click ALT+P and check:
Script::Main and Coder::HighLight is enabled (checked)?

Assign a keyboard shortcut through Scripts plugin setup (double click on Script::Main) See screenshot
Back to top
View user's profile Send private message
martz



Joined: 19 Apr 2011
Posts: 19

PostPosted: Sat Aug 20, 2011 9:18 am    Post subject: Reply with quote

Now it works. Great, thanks Smile

Since we're "at it", two more questions though:

1. Is it possible to change the location of AkelFiles folder?

(Explanation: to have one AP instance always in "writing" mode and another in "normal" mode, I'm using two different .exe and .ini files -- but would be nice if these "different programs" shared all the scripts, plugins etc. Because as for now, I have to manually synchronize any changes related to plugs/scripts.)

2. Can one also somehow change the title of AkelPad window? Ie to have a "AkelPad Notes" and a "AkelPad Writing"? (That's handy for Alt-Tabbing in Windows Smile)

Thanks,
M.


Last edited by martz on Sat Aug 20, 2011 10:08 pm; edited 1 time in total
Back to top
View user's profile Send private message
KDJ



Joined: 06 Mar 2010
Posts: 1339
Location: Poland

PostPosted: Sat Aug 20, 2011 6:38 pm    Post subject: Reply with quote

martz wrote:
2. Can one also somehow change the title of AkelPad window? Ie "AkelPad Notes" and "AkelPad Writing"?

You can do it by the script SetWindowTitle.js:
Code:
var sWndTitle = "AkelPad Notes";
var hMainWnd  = AkelPad.GetMainWnd();
var lpText;

if ((hMainWnd) && (lpText = AkelPad.MemAlloc((sWndTitle.length + 1) * _TSIZE)))
{
  AkelPad.MemCopy(lpText, sWndTitle, _TSTR);
  AkelPad.SystemFunction().Call("user32::SetWindowText" + _TCHAR, hMainWnd, lpText);
  AkelPad.MemFree(lpText);
}
Back to top
View user's profile Send private message
FeyFre



Joined: 07 Aug 2007
Posts: 2038
Location: Vinnitsa, Ukraine

PostPosted: Sun Aug 21, 2011 1:18 am    Post subject: Reply with quote

KDJ, your code can be much simpler - only one statement.
Code:
AkelPad.SystemFunction().Call("user32::SetWindowText" + _TCHAR, AkelPad.GetMainWnd(), "AkelPad Notes")
Back to top
View user's profile Send private message AIM Address Yahoo Messenger MSN Messenger
martz



Joined: 19 Apr 2011
Posts: 19

PostPosted: Sun Aug 21, 2011 11:09 am    Post subject: Reply with quote

This is excellent, guys. Thank you again!

(Btw, I already embedded a different color icon into one of my AkelPad.exe files, so now it's really comfy to switch between the "different applications".)

So, as for now, I've only got one slight annoyance. When the whole screen is already filled with text and I continue typing, then the caret stays on the very bottom line of the screen. In the long run this is inconvenient for the eyes. Hence, could a script:

a) Add customizable top and bottom margins to the full screen window or
b) As a workaround, enable a "page break". That is, after reaching the bottom of the screen, the script would always empty the screen and I could start typing from the top line of the window again.

I think (and hope) not only the "article writers" but also coders would benefit from additions like these.

Thanks for any thoughts,
AP is an awesome tool,
M.


Last edited by martz on Sun Aug 21, 2011 11:15 am; edited 1 time in total
Back to top
View user's profile Send private message
KDJ



Joined: 06 Mar 2010
Posts: 1339
Location: Poland

PostPosted: Sun Aug 21, 2011 11:12 am    Post subject: Reply with quote

FeyFre wrote:
KDJ, your code can be much simpler - only one statement.
Code:
AkelPad.SystemFunction().Call("user32::SetWindowText" + _TCHAR, AkelPad.GetMainWnd(), "AkelPad Notes")

Indeed, it works.
But, the description on msdn shows, that the second argument of SetWindowText() is of type LPCTSTR - a pointer to the string.
Back to top
View user's profile Send private message
FeyFre



Joined: 07 Aug 2007
Posts: 2038
Location: Vinnitsa, Ukraine

PostPosted: Sun Aug 21, 2011 3:26 pm    Post subject: Reply with quote

Quote:
But, the description on msdn shows, that the second argument of SetWindowText() is of type LPCTSTR - a pointer to the string.
Yes, and Call method automatically detects argument as string and converts it internally into LPCSTR representation.(This feature was introduced a while ago into Scripts plugin)
Back to top
View user's profile Send private message AIM Address Yahoo Messenger MSN Messenger
KDJ



Joined: 06 Mar 2010
Posts: 1339
Location: Poland

PostPosted: Sun Aug 21, 2011 5:28 pm    Post subject: Reply with quote

FeyFre
Well, yes, but in SendMessage() method can not use a string, it must be a pointer.
Code:
AkelPad.SendMessage(AkelPad.GetMainWnd(), 0x000C /*WM_SETTEXT*/, 0, "AkelPad Notes");

generates a data type mismatch error.
Back to top
View user's profile Send private message
Infocatcher



Joined: 06 Aug 2007
Posts: 1614

PostPosted: Sun Aug 21, 2011 5:41 pm    Post subject: Reply with quote

KDJ wrote:
Well, yes, but in SendMessage() method can not use a string, it must be a pointer.
I think, it would be good to improve SendMessage(). Smile
Back to top
View user's profile Send private message Visit poster's website
FeyFre



Joined: 07 Aug 2007
Posts: 2038
Location: Vinnitsa, Ukraine

PostPosted: Sun Aug 21, 2011 7:00 pm    Post subject: Reply with quote

Infocatcher, no, it would not. Sad
Back to top
View user's profile Send private message AIM Address Yahoo Messenger MSN Messenger
VladSh



Joined: 29 Nov 2006
Posts: 2610
Location: ,

PostPosted: Mon Aug 22, 2011 8:23 am    Post subject: Reply with quote

martz wrote:
So, as for now, I've only got one slight annoyance. When the whole screen is already filled with text and I continue typing, then the caret stays on the very bottom line of the screen. In the long run this is inconvenient for the eyes.

While, with some reservations, you can try the to Scroll-plugin, see the description of the Scroll::Settings-function for call an external in plug-in documentation.
I added the proposal to expand the functionality of the plug-in topic.
Back to top
View user's profile Send private message Visit poster's website
Instructor
Site Admin


Joined: 06 Jul 2006
Posts: 5315

PostPosted: Mon Aug 22, 2011 2:08 pm    Post subject: Reply with quote

martz wrote:
a) Add customizable top and bottom margins to the full screen window...
This is possible with AEM_SETRECT, but maybe next variant will be more suitable.

martz wrote:
b) As a workaround, enable a "page break". That is, after reaching the bottom of the screen, the script would always empty the screen and I could start typing from the top line of the window again.
"Next variant" Smile Add new shortcut in Hotkeys plugin:
Name: EnterNoscroll
Command: Call("Scroll::Settings", 5)
Hotkey: Enter or Ctrl+Enter

P.S. of course Scroll plugin must be installed.

Infocatcher wrote:
KDJ wrote:
Well, yes, but in SendMessage() method can not use a string, it must be a pointer.
I think, it would be good to improve SendMessage(). Smile
Code:
oSys.Call("user32::SendMessage" + _TCHAR, hWndFind, 0x143 /*CB_ADDSTRING*/, 0, "12345");
Back to top
View user's profile Send private message Send e-mail
Infocatcher



Joined: 06 Aug 2007
Posts: 1614

PostPosted: Mon Aug 22, 2011 4:55 pm    Post subject: Reply with quote

Instructor wrote:
Code:
oSys.Call("user32::SendMessage" + _TCHAR, hWndFind, 0x143 /*CB_ADDSTRING*/, 0, "12345");
Yes, but why not make a similar improvement in SendMessage() ?
Back to top
View user's profile Send private message Visit poster's website
martz



Joined: 19 Apr 2011
Posts: 19

PostPosted: Tue Aug 23, 2011 11:46 am    Post subject: Reply with quote

Instructor wrote:

martz wrote:
b) As a workaround, enable a "page break". That is, after reaching the bottom of the screen, the script would always empty the screen and I could start typing from the top line of the window again.
"Next variant" Smile Add new shortcut in Hotkeys plugin:
Name: EnterNoscroll
Command: Call("Scroll::Settings", 5)
Hotkey: Enter or Ctrl+Enter

P.S. of course Scroll plugin must be installed.

Hmm, this doesn't do the trick for me. Instead it shows me the beginning of the file (line 1).

How would you implement this with AEM_SETRECT?

Thanks a bunch,
M.
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    AkelPad Forum Index -> Discussion (English) All times are GMT
Goto page Previous  1, 2, 3  Next
Page 2 of 3

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


SourceForge.net Logo Powered by phpBB © 2001, 2005 phpBB Group