Scripts discussion (4)
- Author
- Message
-
Offline
- Posts: 1879
- Joined: Mon Aug 06, 2007 1:07 pm
- Contact:
Re: Scripts discussion (4)
autoSaveSession.js v.0.2.2 - 2023-11-06
[+] Backup session file before first auto-saving + added -sessionBackup and -maxBackups arguments.
[+] Backup session file before first auto-saving + added -sessionBackup and -maxBackups arguments.
-
Offline
- Posts: 1879
- Joined: Mon Aug 06, 2007 1:07 pm
- Contact:
Re: Scripts discussion (4)
measuresConverter.js v.0.2.11 - 2023-11-08
[*] Improved description for arguments.
[*] Improved self-update (still not recommended, use at your own risk: currencies data will be saved in script itself) and also added update date in header.
[*] Improved currencies white list: added basic UI to configure and store them in preferences (or use -currencies argument to override).
[x] Fixed -maxHeight=-1 argument.
[x] Fixed exchange-rates.org parsing.
[+] Added support for currencies:
- Gold (XAU)
- Afghan afghani (AFN)
- Angolan Kwanza (AOA)
- Azerbaijani Manat (AZN)
- Bosnia and Herzegovina Marka (BAM)
- Congolese franc (CDF)
- Eritrean nakfa (ERN)
- Georgian Lari (GEL)
- Malagasy Ariary (MGA)
- Mozambican Metical (MZN)
- Surinamese Dollar (SRD)
- Tajikistani Somoni (TJS)
- Turkmenistan Manat (TMT)
[x] Replaced obsolete currencies:
- Zambian Kwacha: ZMK -> ZMW
- Zimbabwe Dollar: ZWD -> Zimbabwean Dollar ZWL
[*] Improved ability to prefer currency sources (-preferFXExchangeRate -> -preferSources argument).
[x] Fixed currency.world parser: handle fallback to default currency.
[+] Added -testSource argument (will report errors, only for test purposes).
[*] Improved description for arguments.
[*] Improved self-update (still not recommended, use at your own risk: currencies data will be saved in script itself) and also added update date in header.
[*] Improved currencies white list: added basic UI to configure and store them in preferences (or use -currencies argument to override).
[x] Fixed -maxHeight=-1 argument.
[x] Fixed exchange-rates.org parsing.
[+] Added support for currencies:
- Gold (XAU)
- Afghan afghani (AFN)
- Angolan Kwanza (AOA)
- Azerbaijani Manat (AZN)
- Bosnia and Herzegovina Marka (BAM)
- Congolese franc (CDF)
- Eritrean nakfa (ERN)
- Georgian Lari (GEL)
- Malagasy Ariary (MGA)
- Mozambican Metical (MZN)
- Surinamese Dollar (SRD)
- Tajikistani Somoni (TJS)
- Turkmenistan Manat (TMT)
[x] Replaced obsolete currencies:
- Zambian Kwacha: ZMK -> ZMW
- Zimbabwe Dollar: ZWD -> Zimbabwean Dollar ZWL
[*] Improved ability to prefer currency sources (-preferFXExchangeRate -> -preferSources argument).
[x] Fixed currency.world parser: handle fallback to default currency.
[+] Added -testSource argument (will report errors, only for test purposes).
-
Offline
- Posts: 1879
- Joined: Mon Aug 06, 2007 1:07 pm
- Contact:
Re: Scripts discussion (4)
measuresConverter.js v.0.2.12 - 2023-12-24
[x] Fixed Mauritanian Ouguiya: MRO -> MRU https://en.wikipedia.org/wiki/Mauritanian_ouguiya.
[x] Correctly cleanup cached response from fxexchangerate.com.
[*] Handle missing source URL, e.g. for wrong -preferSources="fx".
[*] Internal improvements for statistics from asyncUpdater.
[x] Fixed Mauritanian Ouguiya: MRO -> MRU https://en.wikipedia.org/wiki/Mauritanian_ouguiya.
[x] Correctly cleanup cached response from fxexchangerate.com.
[*] Handle missing source URL, e.g. for wrong -preferSources="fx".
[*] Internal improvements for statistics from asyncUpdater.
-
Offline
- Posts: 351
- Joined: Mon Jun 03, 2019 2:33 am
Re:
Если что я сделал упрощённый понятный пример из этого на PureBasic, с комментариями. Точнее упростил один из пользователей PureBasic, а я вытащил в отдельный пример без лишних функций. Прошлый пример слишком запутанный. Я даже сделал инструмент FindAllReferences[Win] (совместными усилиями), но не удалось адаптировать к AkelPad, работает только со ScintillaAZJIO wrote: ↑Fri May 01, 2020 10:18 pm DV
На счёт CommandPalette.js - я нашёл пример на PureBasic для раскраски текста внутри пункта для ListView, то есть для списка-таблицы. Было бы удобно если искомый текст в пунктах был бы подсвечен.
вот https://pastebin.com/3Dm5XpGi
видео как подсвечивается текст внутри пункта
-
Offline
- Posts: 351
- Joined: Mon Jun 03, 2019 2:33 am
Re: Scripts discussion (4)
DrawText (WinApi) рисует.
Например строка "привет мир", в ней надо подсветить "вет". Сначала рисуется "при" одним цветом, потом colors(idx & 1) это тупо массив с двумя элементами цвета, меняем цвет и следующий кусок "вет" рисуется новым цветом. Но перед эти сдвигаем позицию в пикселях:
subItemRect\left + GetCharWidth(*nmhdr\hwndFrom, t$) здесь мы получаем ширину в пикселях и прибавляем к элементу структуры subItemRect\left, то есть рисуем "вет" там где закончилось "при", снова меняем цвет и дорисовываем " мир".
Все константы начинающиеся с "#" являются WinAPI константами, без "#".
Я вчера начал пытаться, но забыл как создать структуру в AkelPad, а может и не знал.
В коде немного подругому, там фраза "привет мир" с помощью регулярных выражений заменяется на "при|вет| мир", потом функцией запрашивается кусок текста 1, потом 2, потом 3, где параметр "|" задаётся как разделитель, куски складываются без разделителя. Я в примере просто вставил эти разделители изначально. Но всё это не обязательно таким способом делать.
colors(idx & 1) тут "idx & 1" это битовый флаг 1&1 = 1, 2&1=0, 3&1=1 и т.д. потому что 3 это 2 и 1, 5 это 4 и 1 и т.д. то есть нечётные числа дают 1, а чётные 0 отсюда у массива два индекса 0 и 1 и на каждом шаге цикла просто преключается цвет.
Это как у кнопки флаг BS_OWNERDRAW делает кнопку с возможностью рисовать на ней что угодно. Так и с пунктом получается на нём просто рисуется "собственный" текст.
Например строка "привет мир", в ней надо подсветить "вет". Сначала рисуется "при" одним цветом, потом colors(idx & 1) это тупо массив с двумя элементами цвета, меняем цвет и следующий кусок "вет" рисуется новым цветом. Но перед эти сдвигаем позицию в пикселях:
subItemRect\left + GetCharWidth(*nmhdr\hwndFrom, t$) здесь мы получаем ширину в пикселях и прибавляем к элементу структуры subItemRect\left, то есть рисуем "вет" там где закончилось "при", снова меняем цвет и дорисовываем " мир".
Все константы начинающиеся с "#" являются WinAPI константами, без "#".
Я вчера начал пытаться, но забыл как создать структуру в AkelPad, а может и не знал.
В коде немного подругому, там фраза "привет мир" с помощью регулярных выражений заменяется на "при|вет| мир", потом функцией запрашивается кусок текста 1, потом 2, потом 3, где параметр "|" задаётся как разделитель, куски складываются без разделителя. Я в примере просто вставил эти разделители изначально. Но всё это не обязательно таким способом делать.
colors(idx & 1) тут "idx & 1" это битовый флаг 1&1 = 1, 2&1=0, 3&1=1 и т.д. потому что 3 это 2 и 1, 5 это 4 и 1 и т.д. то есть нечётные числа дают 1, а чётные 0 отсюда у массива два индекса 0 и 1 и на каждом шаге цикла просто преключается цвет.
Это как у кнопки флаг BS_OWNERDRAW делает кнопку с возможностью рисовать на ней что угодно. Так и с пунктом получается на нём просто рисуется "собственный" текст.
-
Offline
- Posts: 1294
- Joined: Thu Nov 16, 2006 11:53 am
- Location: Kyiv, Ukraine
Re: Scripts discussion (4)
Тестова версія на пробу:
https://github.com/d0vgan/AkelPad-Scrip ... nything.js
Скоріше за все, деякі частини коду можна покращати, щось може бути непотрібним, щось може відвалюватися... Та наче працює

-
Offline
- Posts: 351
- Joined: Mon Jun 03, 2019 2:33 am
Re: Scripts discussion (4)
DV
Круто получилось.
CommandPalette.js тоже бы так.
Круто получилось.
CommandPalette.js тоже бы так.
-
Offline
- Posts: 1294
- Joined: Thu Nov 16, 2006 11:53 am
- Location: Kyiv, Ukraine
-
Offline
- Posts: 1
- Joined: Wed Feb 14, 2024 3:11 pm
- Location: USA
Re:
@KDJ, Does AkelPadTitle.js still work? I put it into AkelFiles\Plugs\Scripts together with other scripts and I cannot get it to do anything. Calculator.js and IconsOnTabs.js work as expected, so I'm wondering if something changed since 2013, breaking AkelPadTitle.js. Thanks.
-
Offline
- Posts: 1294
- Joined: Thu Nov 16, 2006 11:53 am
- Location: Kyiv, Ukraine
Re: Scripts discussion (4)
GoToAnything.js - version 0.7.0 official release.
Here is a modest list of the changes:
+ while filtering, the matching parts of file names are highlighted
+ Shift+F4 and Ctrl+Shift+Q toggle the auto-preview (on/off)
+ F4 and Ctrl+Q preview the selected file (when the auto-preview is off)
+ the file list includes [D] items which are read from a given directory
+ Alt+D allows to specify a directory for the [D] items
https://github.com/d0vgan/AkelPad-Scrip ... nything.js
Here is a modest list of the changes:
+ while filtering, the matching parts of file names are highlighted
+ Shift+F4 and Ctrl+Shift+Q toggle the auto-preview (on/off)
+ F4 and Ctrl+Q preview the selected file (when the auto-preview is off)
+ the file list includes [D] items which are read from a given directory
+ Alt+D allows to specify a directory for the [D] items
https://github.com/d0vgan/AkelPad-Scrip ... nything.js
-
Offline
- Posts: 351
- Joined: Mon Jun 03, 2019 2:33 am
Re: Scripts discussion (4)
Попробовал, мне показалось файлов много в результатах, и решил проверить не из истории ли взят файл. В общем закрываю файл при открытом окне GoToAnything и выбираю этот файл в GoToAnything и AkelPad упал. Может проверить что файл открыт?
-
Offline
- Posts: 1294
- Joined: Thu Nov 16, 2006 11:53 am
- Location: Kyiv, Ukraine
Re: Scripts discussion (4)
Can't reproduce.
Could you describe exact steps to reproduce?
-
Offline
- Posts: 1294
- Joined: Thu Nov 16, 2006 11:53 am
- Location: Kyiv, Ukraine