We value your input! Please participate in Archicad 28 Home Screen and Tooltips/Quick Tutorials survey
2023-10-05 10:17 AM - last edited on 2024-09-16 02:26 PM by Doreena Deng
ResConv.exe doc mentions that macros can be defined using [-d <ID1>] [-d <ID2>] [...] [-d <IDn>] formula.
I'm making experiments with it and couldn't make it work.
The command line looks like this:
<Command Condition="'$(BuildType)'=='Debug'">"$(ACDevKitSupport)\Tools\Win\ResConv.exe" -m r -D WINDOWS -T W -q utf8 1252 -i "RINT\$(ProjectName).grc" -D _DEBUG -D COMPANY_NAME="$(CompanyName)" -o "$(OutDir)\RO\$(ProjectName).grc.rc2"</Command>
But this (and many variations for this) doesn't work. What is the decipherment of this enigma?
BTW for me the #include in .grc files don't work, neither, see https://community.graphisoft.com/t5/Archicad-C-API/Graphisoft-Resource-Compiler-include-not-working/...
Solved! Go to Solution.
2023-10-07 11:07 AM
Hi Sam,
The ResConv.doc help is not very clear about it, but I think you can only define if a variable as a flag and check if it's there with "#ifdef".
I don't think you can give it an actual value like you did and then use that value.
@Sam Karli wrote:
BTW for me the #include in .grc files don't work, neither, see https://community.graphisoft.com/t5/Archicad-C-API/Graphisoft-Resource-Compiler-include-not-working/...
I can't answer in that thread since it's locked, so I'm answering here. I don't think that the issue is with #includes, but that you are using the substitution wrong. First of all, the substitution of defined macros happens not during the ResConv.exe step but later using the Windows Resource Compiler (rc.exe).
And second, APP_NAME
is not substituted there because the substitution you are trying doesn't work in strings. (and I also think that it's wrong to use "@"-signs around the defined macro).
What would work is to substitute numbers like this:
#define NUMBER_MACRO 32520 // This could also be in an include file
//...
'STR#' NUMBER_MACRO "Prompt strings" {
/* [ ] */ "This has to be a fixed string before it goes to ResConv.exe"
/* [ ] */ "This too"
}
But I guess that won't help in your case.
Now from your questions I'm guessing that you want variable strings in your resources. I see two options:
// This is the resource file
'STR#' 32520 "Prompt strings" {
/* [ ] */ "The following will be replaced: %s"
/* [ ] */ "Normal String"
}
// This is some code file where you access the resource
GS::UniString format;
RSGetIndString (&format, 32520, 1, ACAPI_GetOwnResModule ());
GS::UniString substitutedString = GS::UniString::Printf (format, "MySuperAppName");
// Substituted string should now be "The following will be replaced: MySuperAppName"
Hope that helps!
Bernd
2023-10-07 11:07 AM
Hi Sam,
The ResConv.doc help is not very clear about it, but I think you can only define if a variable as a flag and check if it's there with "#ifdef".
I don't think you can give it an actual value like you did and then use that value.
@Sam Karli wrote:
BTW for me the #include in .grc files don't work, neither, see https://community.graphisoft.com/t5/Archicad-C-API/Graphisoft-Resource-Compiler-include-not-working/...
I can't answer in that thread since it's locked, so I'm answering here. I don't think that the issue is with #includes, but that you are using the substitution wrong. First of all, the substitution of defined macros happens not during the ResConv.exe step but later using the Windows Resource Compiler (rc.exe).
And second, APP_NAME
is not substituted there because the substitution you are trying doesn't work in strings. (and I also think that it's wrong to use "@"-signs around the defined macro).
What would work is to substitute numbers like this:
#define NUMBER_MACRO 32520 // This could also be in an include file
//...
'STR#' NUMBER_MACRO "Prompt strings" {
/* [ ] */ "This has to be a fixed string before it goes to ResConv.exe"
/* [ ] */ "This too"
}
But I guess that won't help in your case.
Now from your questions I'm guessing that you want variable strings in your resources. I see two options:
// This is the resource file
'STR#' 32520 "Prompt strings" {
/* [ ] */ "The following will be replaced: %s"
/* [ ] */ "Normal String"
}
// This is some code file where you access the resource
GS::UniString format;
RSGetIndString (&format, 32520, 1, ACAPI_GetOwnResModule ());
GS::UniString substitutedString = GS::UniString::Printf (format, "MySuperAppName");
// Substituted string should now be "The following will be replaced: MySuperAppName"
Hope that helps!
Bernd
2023-10-10 08:45 AM
Thanks for Your detailed answer,
some thoughts:
-using cmake seems to be a good idea since Graphisoft is moving towards this approach (see devkit/Examples). Unfortunately I'm absolutely a beginner in this topic but this is a strong argument that I should pick this up
-regarding "@SOME_MACRO@"-style stuff, I've seen this in a live code (but didn't work for me), but I think the developer is in my network and can say how it worked.
Thanks
Sam
2023-10-11 10:34 AM
Hi Sam,
- I think CMake is definitely worth the investment. Especially if you want to compile your Add-Ons for both macOS and Windows.
- The "@SOME_MACRO@" stuff is actually how you can do substitution in CMake via the configure_file function.
Best,
Bernd