Scripts discussion (2)
- Author
- Message
-
Offline
- Posts: 2247
- Joined: Tue Aug 07, 2007 2:03 pm
- Location: Vinnitsa, Ukraine
KDJ
RT_STRING is value of resource type identifiers for string resource type, number(WORD 2 bytes only) or \0-terminated string. Equals to 6. You can find its and of other predefined types values in Win32\kernel32.js of mine Win32 Constants Library (you should use it effectively like AkelPad.Include("win32\\kernel32.js"), instead of manual definition if those constants or direct usage of *magic numbers*).
IDS_STRING is resource item identifier, number(WORD) or string(\0 termonated). You must specified value you need to load. Where to obtain it? From the author of module you want to load from. Since you want to load it from AkelPad's language modules, you should get it source(download from Download section here). You need file AkelFiles/Langs/Resources/resource.h there are all resource ID's used in AP and language modules.
This tripe (resource type, resource id, langid) uniquely identifies any resource in resource package(resource archive or image file).
I just realised I mislead you a little. If you going to seek localised version of button on standard AP's dialog, you must load dialog resource using resource type constant RT_DIALOG =5, not string resource, and in returned piece of memory you must parse it as DLGTEMPLATE or DLGTEMPLATEEX structure(see MSDN).
RT_STRING is value of resource type identifiers for string resource type, number(WORD 2 bytes only) or \0-terminated string. Equals to 6. You can find its and of other predefined types values in Win32\kernel32.js of mine Win32 Constants Library (you should use it effectively like AkelPad.Include("win32\\kernel32.js"), instead of manual definition if those constants or direct usage of *magic numbers*).
IDS_STRING is resource item identifier, number(WORD) or string(\0 termonated). You must specified value you need to load. Where to obtain it? From the author of module you want to load from. Since you want to load it from AkelPad's language modules, you should get it source(download from Download section here). You need file AkelFiles/Langs/Resources/resource.h there are all resource ID's used in AP and language modules.
This tripe (resource type, resource id, langid) uniquely identifies any resource in resource package(resource archive or image file).
I just realised I mislead you a little. If you going to seek localised version of button on standard AP's dialog, you must load dialog resource using resource type constant RT_DIALOG =5, not string resource, and in returned piece of memory you must parse it as DLGTEMPLATE or DLGTEMPLATEEX structure(see MSDN).
-
Offline
- Posts: 119
- Joined: Sat Jan 12, 2008 10:16 am
- Location: Shantou, China
FeyFre and VladSh, Thank you for your criticism.
FeyFre
Zen-coding is a great toolkit for html and css workflow, and it has been renamed and moved to emmet for a while. It seems some update in it. Could you take a little time to update your script with that?
FeyFre
Zen-coding is a great toolkit for html and css workflow, and it has been renamed and moved to emmet for a while. It seems some update in it. Could you take a little time to update your script with that?
-
Offline
- Posts: 2247
- Joined: Tue Aug 07, 2007 2:03 pm
- Location: Vinnitsa, Ukraine
KDJ
First of all you Resource type argument is second, not third. I.e You should comment 16 line and uncomment 17.
Next, in order to determine error you should use GetLastError function immediately after call:
In script you posted here lasterror will be ERROR_RESOURCE_TYPE_NOT_FOUND=1813
(you can obtain human readable error text by calling function FormatMessageW/A)
if you fix 16,17 line you will get good result, or another error(you will get ERROR_RESOURCE_NAME_NOT_FOUND=1814).
And it is not their error. It is peculiarities of FindResourceEx function. It works with raw data stored in resources directory of image(and returns raw data). Don't worry, what I say next not every developer for windows knows, and even I know it accidentally. RT_STRING resources are stored in chunks of string(16 per chunk). That resource ID you use( 150) it threats as Chunk ID, and tries to find it. Fails. So you must convert you string id into chunk id, get raw string chunk, and extract required string manually. I never done that before, but here you can see example(in Russian)
Use ResourceHacker to inspect String resources(you will see strings are chunked)
First of all you Resource type argument is second, not third. I.e You should comment 16 line and uncomment 17.
Next, in order to determine error you should use GetLastError function immediately after call:
Code: Select all
hRes = oSys.Call("Kernel32::FindResourceExW", hLangLib, 6 /*RT_STRING*/, 150 /*STR_MESSAGEBOX_CANCEL*/, nLangID);
if(hRes==0)
{
var lasterror = oSys.GetLastError();
WScript.Echo(lasterror);
WScript.Quit();
}
(you can obtain human readable error text by calling function FormatMessageW/A)
if you fix 16,17 line you will get good result, or another error(you will get ERROR_RESOURCE_NAME_NOT_FOUND=1814).
And it is not their error. It is peculiarities of FindResourceEx function. It works with raw data stored in resources directory of image(and returns raw data). Don't worry, what I say next not every developer for windows knows, and even I know it accidentally. RT_STRING resources are stored in chunks of string(16 per chunk). That resource ID you use( 150) it threats as Chunk ID, and tries to find it. Fails. So you must convert you string id into chunk id, get raw string chunk, and extract required string manually. I never done that before, but here you can see example(in Russian)
Use ResourceHacker to inspect String resources(you will see strings are chunked)
-
Offline
- Posts: 119
- Joined: Sat Jan 12, 2008 10:16 am
- Location: Shantou, China
It's not correct.KDJ wrote:GetStringFromResource.jsCode: Select all
nStrID = AkelPad.InputBox(AkelPad.GetMainWnd(), WScript.ScriptName, "Resource string ID:", nStrID); if (! nStrID)
Below is corrected:
Code: Select all
sStrID = AkelPad.InputBox(AkelPad.GetMainWnd(), WScript.ScriptName, "Resource string ID:", sStrID);
if (! sStrID)
-
Offline
- Posts: 767
- Joined: Mon Sep 28, 2009 10:03 am
- Location: Minsk, Belarus
+1cnnnc wrote:FeyFre
Zen-coding is a great toolkit for html and css workflow, and it has been renamed and moved to emmet for a while. It seems some update in it. Could you take a little time to update your script with that?
-
Offline
- Posts: 176
- Joined: Sat Dec 24, 2011 4:05 pm
KDJ, I finished translation of your FindFiles.js, but has 2 moments, which modified:
Both versions: FindFiles-Rus.7z
- Need about +10px for better translation of "Don't search in larger than:" label
- " B " for "bytes" in status bar was untranslatable
Both versions: FindFiles-Rus.7z
Last edited by F. Phoenix on Wed Jan 02, 2013 5:53 pm, edited 1 time in total.
-
Offline
- Posts: 176
- Joined: Sat Dec 24, 2011 4:05 pm
KDJ, in this case I prefere "Не искать в больших, чем:", but don't see the problem to increase it. And what about add bytes mark after input field? For something like this: screenshot.
DV, вот там из-за отстутствия этой "Б", по моему, как раз и есть основной недостаток интуитивности. Тем более, что поле ввода текстовое, а не NumericUpDown. А с ней вполне неплохо бы воспринималось и "Не искать в больших, чем:", и твое "Не искать в файлах >"; а так этот символ еще, к примеру, в виде стрелки частенько юзается.
DV, вот там из-за отстутствия этой "Б", по моему, как раз и есть основной недостаток интуитивности. Тем более, что поле ввода текстовое, а не NumericUpDown. А с ней вполне неплохо бы воспринималось и "Не искать в больших, чем:", и твое "Не искать в файлах >"; а так этот символ еще, к примеру, в виде стрелки частенько юзается.
-
Offline
- Posts: 366
- Joined: Mon Jan 10, 2011 5:28 pm
- Contact:
А настолько ли большая проблема делать эти окошки и шрифты не пиксельных размеров, а растягивающимися под размеры шрифтов пользователя? Вот я увеличил шрифты в системе. Opera и utorrent на это отреагировали отлично - всё растянулось и всё читабельно. А Акельпад неоднозначно среагировал - в меню шрифт изменился и менюшки подвинулись, но статусная строка под ширину надписей не исправилась и кое-что съедается, в настройках и заголовках вкладок mdi шрифт не сменился (и, соответственно, смотрится мелко на фоне остальных программ). Плагины и скрипты так и остались на прописанных в них шрифтах и размерах. Могут ли разработчики учитывать то, что пользоатель может хотеть все смотерть большим шрифтом или не тем, который за него впишет разработчик?
-
Offline
- Posts: 1250
- Joined: Thu Nov 16, 2006 11:53 am
- Location: Kyiv, Ukraine
Вообще - да. Просто дело в том, что реализация этого дела средствами Win API сделана, выражаясь словами одного из наших политиков, "немножко по-дебильному". Часто просто неохота возиться со всеми этими контекстами устройств, шрифтами и прочим отстоем ради пересчёта размеров.Lenchik wrote:Могут ли разработчики учитывать то, что пользоатель может хотеть все смотерть большим шрифтом или не тем, который за него впишет разработчик?