Request: Numbering plugin

Discuss and announce AkelPad plugins
  • Author
  • Message
Offline
Posts: 21
Joined: Sun May 06, 2007 10:14 am

Request: Numbering plugin

Post by Idjo »

Can you please make a numbering plugin, that any time you submit it, it writes the next number?

For example I want to make a macro that works like this:
(Home, #, Call Plugin, Space, Down arrow)

And here's the result:

Code: Select all

Things to buy:
Bread
Milk
Newspaper
||
V

Code: Select all

Things to buy:
#1 Bread
#2 Milk
#3 Newspaper
I suggest parameters like:
current number (changes when using the plugin), maximum and minimum, difference size (can also be negative), number of duplicates.

Examples:

Code: Select all

current=2, maximum=5, minimum=1, difference=1, number of duplicates=1.
2,3,4,5,1,2,3...

current=2, maximum=5, minimum=1, difference=-1, number of duplicates=2.
2,2,1,1,5,5,4,4...

current=3, maximum=5, minimum=1, difference=2, number of duplicates=1.
2,4,1,3,5...
And for display, parameter like:
minimum chars, filling char, right or left filling.

Examples

Code: Select all

minimum=1
1,2,3,4...

minimum=2, char=0, left.
01,02,03...09,10,11...99,100...

minimum=3, char=space, right.
  1,  2,  3...  9, 10... 99,100
Thank you in advance.

P.S you can also add an option to choose the base (Decimal, Octal etc.).

Offline
Posts: 876
Joined: Tue Jul 24, 2007 8:54 am

Post by Fr0sT »

Maybe better to add this feature into Lines plugin?

Offline
Posts: 21
Joined: Sun May 06, 2007 10:14 am

Post by Idjo »

As a line feature it w'ont be enough dinamic.
What if I don't want it in the begining of a row? Or what if I don't want it in rows at all?

Offline
Posts: 876
Joined: Tue Jul 24, 2007 8:54 am

Post by Fr0sT »

Maybe it's easier for you to take a look at the Scripts and implement every necessary functions by yourself. Imho, such feature won't be needed enough to compensate development costs.

Offline
Posts: 21
Joined: Sun May 06, 2007 10:14 am

Post by Idjo »

OK. But how do I save the current number untill the next call? The other parameter I can define as constants.

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

Post by Instructor »


Offline
Posts: 21
Joined: Sun May 06, 2007 10:14 am

Post by Idjo »

Thank you.

Is there a way to deal with files? I'm not familier with the object in JS.

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

Post by Instructor »

Updated: NumberCount.js

1. Open documents in MDI mode in which you want to insert numbers.
2. Change "nLastNumber=0x7FFFFFFF" and "bAllDocuments=true"
3. Call NumberCount.js via AkelPad.

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

Post by VladSh »

Расскажите пожалуйста что делает этот скрипт? Все что-то радуются, а я завидую белой завистью - что-то хорошее проходит мимо :)))

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

Post by Instructor »

VladSh
Idjo wrote:

Code: Select all

Things to buy:
Bread
Milk
Newspaper
||
V

Code: Select all

Things to buy:
#1 Bread
#2 Milk
#3 Newspaper

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

Post by VladSh »

Я вижу смысл в нумерации:

Code: Select all

Things to buy:
1. Bread
2. Milk
3. Newspaper
или так:

Code: Select all

Things to buy:
1). Bread
2). Milk
3). Newspaper
А зачем решётка впереди? И зачем ограничение на макс. количество строк? Здесь явно какая-то хитрость задумана против русских людей!.. :D

Немного уважения к создателю топика - пишем на его языке. (Instructor)

Sorry! I speak english very bad... :roll: (VladSh)
Last edited by VladSh on Thu Aug 02, 2007 1:43 pm, edited 1 time in total.

Offline
Posts: 21
Joined: Sun May 06, 2007 10:14 am

Post by Idjo »

I don't know what you're saying but it was just an example. I don't need it for shoping lists :) .

There's a bug. Try assign the script with ctrl+something and it will do ctrl+home instead of home.

Offline
Posts: 876
Joined: Tue Jul 24, 2007 8:54 am

Post by Fr0sT »

Don't know how to save current number between script calls (though it should be simple file I/O), but I suppose it's possible to enter needed value at script's start through Windows InputBox routine. As long as I know, system functions are supported by Scripts plugin?

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

Post by Instructor »

Idjo wrote:There's a bug. Try assign the script with ctrl+something and it will do ctrl+home instead of home.
This is because script don't check keyboard state. Use F1, F2...

Offline
Posts: 21
Joined: Sun May 06, 2007 10:14 am

Post by Idjo »

OK, thanks.
Anyway I think this problem need to be fixed.
Post Reply