dummzeuch 1707 Posted Friday at 12:55 PM (edited) I just tried the new RAD AI companion: Quote How can I detect the Delphi version and build number from within an IDE plugin? Quote To detect the Delphi version and build number from within an IDE plugin, you can use the IOTAVersionSKUInfoService interface provided by the Tools API. This interface allows you to query the list of installed platforms, SKU, and if the running IDE is a Trial version. Here is a basic example of how you might use this interface: uses ToolsAPI; procedure GetDelphiVersionInfo; var VersionService: IOTAVersionSKUInfoService; SKU: Integer; IsTrial: Boolean; begin if Supports(BorlandIDEServices, IOTAVersionSKUInfoService, VersionService) then begin SKU := VersionService.SKU; IsTrial := VersionService.IsProductTrial; // Use SKU and IsTrial to determine the version and build number // You can also use PlatformAPI.PlatformIDToName to convert platform IDs to human-readable names end; end; This code checks if the IOTAVersionSKUInfoService is supported and then retrieves the SKU and trial status, which can help you determine the version and build number of the Delphi IDE. For more detailed information, you may need to refer to the ToolsAPI.pas file where the interface is defined. Give me example code that returns the IDE's version number plus build number as a string from within an IDE plugin Quote To return the IDE's version number plus build number as a string from within an IDE plugin, you can use the IOTAVersionSKUInfoService interface. Here's an example of how you might implement this in Delphi: uses ToolsAPI, SysUtils; function GetIDEVersionAndBuild: string; var VersionService: IOTAVersionSKUInfoService; SKU: Integer; IsTrial: Boolean; begin Result := 'Unknown Version'; if Supports(BorlandIDEServices, IOTAVersionSKUInfoService, VersionService) then begin SKU := VersionService.SKU; IsTrial := VersionService.IsProductTrial; // Construct the version and build number string Result := Format('Delphi SKU: %d, Trial: %s', [SKU, BoolToStr(IsTrial, True)]); end; end; This function checks if the IOTAVersionSKUInfoService is available and retrieves the SKU and trial status. It then formats these values into a string. You can expand this example to include more detailed version and build number information if needed, based on the available properties and methods in the IOTAVersionSKUInfoService interface. Not impressed. Edited Friday at 12:56 PM by dummzeuch 1 Share this post Link to post
FredS 140 Posted Friday at 02:48 PM 1 hour ago, dummzeuch said: Not impressed. The Artificial Indexers are good at returning other peoples work, when asked a second time they return more work of yet another person in a completely different style and syntax. Share this post Link to post
Anders Melander 2104 Posted Friday at 03:09 PM Apart from the AI stuff, you do know how to determine the IDE version and build number, right? Share this post Link to post
dummzeuch 1707 Posted Friday at 04:27 PM 1 hour ago, Anders Melander said: Apart from the AI stuff, you do know how to determine the IDE version and build number, right? Yes, I do. When I test AIs I tend to ask things I already know so I can easily spot whether the answers are any good. In this case I had just updated the version detection in GExperts to support Delphi 13 so this was the first question that came into my mind. 1 Share this post Link to post
Dave Novo 62 Posted Friday at 07:48 PM This is what Claude said. No idea if its true or not since I have never looked into this procedure GetCompleteVersionInfo(out ProductName, Version, BuildNumber: string); var Services: IOTAServices; AboutBox: IOTAAboutBoxServices; FullVersionString: string; Parts: TArray<string>; begin ProductName := ''; Version := ''; BuildNumber := ''; Services := BorlandIDEServices as IOTAServices; if Assigned(Services) then begin ProductName := Services.GetProductIdentifier; Version := Services.GetIDEVersionString; end; AboutBox := BorlandIDEServices as IOTAAboutBoxServices; if Assigned(AboutBox) then begin FullVersionString := AboutBox.GetVersionString; // Parse the build number from the full version string // Format is typically: "Embarcadero® Delphi 10.4 Version 27.0.40680.4203" Parts := FullVersionString.Split([' ']); if Length(Parts) > 0 then BuildNumber := Parts[High(Parts)]; // Get the last part end; end; Share this post Link to post
Anders Melander 2104 Posted Friday at 09:18 PM 1 hour ago, Dave Novo said: This is what Claude said. No idea if its true or not since I have never looked into this Just like GPS navigation systems made people forget how to find direction, apparently AI has made people forget how to think for themselves 🤔 From where do you think the about box gets its version number information?. Share this post Link to post
Dave Novo 62 Posted Saturday at 04:44 PM HI Anders, Of course the about box gets its version number somewhere. The point being, do I care? Of course, I could spend another 5-30 minutes digging through undocumented IDE ToolsAPI code. Or maybe better yet, spend 20-45 minutes digging through 100 false starts on google results, stasck overfloat posts etc., only at the end of the day to learn the proper API call to execute to get the version number. Then, I can brag to all my friends that I still remember how to "think", as if reading through undocumented IDE Services code is a hallmark of a great thinker. Or I can take the code above (presuming it actually works) and move on to building the tool I actually want to build. By this logic, if someone has posted the code above on StackOverflow and it popped up someone's first stack overflow query, and they used it, and it worked as far as they needed it to, would that person still have forgotten how to think? One could easily argue that people who ignore AI, and spend 30 minutes trying to accomplish a task that AI gets an answer in 10 seconds have forgotten how to think. Of course, with all the usual caveats that often AI is not correct, especially on obscure questions that it does not have a lot of training material on the web. But often it is correct, at least correct enough for you to move on and do what you really wanted to do in the first place. 2 Share this post Link to post
dummzeuch 1707 Posted Saturday at 04:47 PM 2 minutes ago, Dave Novo said: By this logic, if someone has posted the code above on StackOverflow and it popped up someone's first stack overflow query, and they used it, and it worked as far as they needed it to, would that person still have forgotten how to think? Simple answer: Yes. You don't take any code from the web and use it without understanding it. Share this post Link to post
Dave Novo 62 Posted Saturday at 05:47 PM Quote You don't take any code from the web and use it without understanding it. So if I find a code snippet on the internet how to use the Format function to format floating point numbers and it recommends %8.2f, I should then read the source code of the format function in Delphi and make sure that I understand the entire method to ensure that the suggestion is correct. Maybe you do that, and if you do that is awesome for you that you have the time to do so. Of course, there is the possibility that using %8.2f can cause a buffer overflow and then I am opening the door to a zero day exploit on my application. Of course I understand the Claude code snippet. It is pulling the info from the About box. What is not to understand? Unfortunately, I do not have as much time to analyze every method of Delphi source, and analyze the ramifications of every code snippet I use from the web in Depth. In the example above, I would judge that pulling information from an About box is likely not the most efficient way to do it, also is not likely to introduce any security problems. Given the lack of any documentation on the ToolsApi I would also realize it would take a significant amount of time to figure out the "right way". Conclusion: try the code above and hope it works 🙂 Share this post Link to post
David Heffernan 2475 Posted Saturday at 06:42 PM 53 minutes ago, Dave Novo said: So if I find a code snippet on the internet how to use the Format function to format floating point numbers and it recommends %8.2f, I should then read the source code of the format function in Delphi and make sure that I understand the entire method to ensure that the suggestion is correct. Why read the source code. You can read the documentation. Why wouldn't you want to be confident your code worked? Fine for throw away hobbyist programs. But for professional development you couldn't survive this way. Anyone in my team that tried this would be spoken to. Share this post Link to post
Anders Melander 2104 Posted Saturday at 06:43 PM 33 minutes ago, Dave Novo said: Of course I understand the Claude code snippet. It is pulling the info from the About box. What is not to understand? I think we have a case of tunnel vision here. Extracting the version number from the About Box is obviously not the way to do it; There's no contract that specifies how the returned string is formatted and if they change the format, the code breaks. "Delphi 14.0 Version 12.34.567.890 by Embarcadero®" The solution is really, really simple and does not involve the ToolsAPI at all: Assuming this is being done from a package or a DLL, use GetModuleFilename to get the filename of the host application (i.e. bds.exe). Use GetFileVersionInfo to get the version info. Share this post Link to post
Dave Novo 62 Posted Saturday at 07:01 PM Quote You can read the documentation. Why wouldn't you want to be confident your code worked? The only way to know your code works is to test it. I am confident the code works if the test passes. If you feel it is sufficient to rely on the Delphi documentation, that is your personal choice. I can find tons of examples where the Delphi documentation was flawed, or bugs in Delphi where the docs were correct and specified what should happen, but it did not. My point is everyone draws the line somewhere, but that line is arbitrary and based on personal experience, and a sense of how critical the functionality is. You draw the line that if the web says something, and you read the documentation and it seems to agree, then use it. (of course I am exxagerating here, I doubt a developer of your experience would actually do that, but that is what you suggested) @dummzeuch suggests to draw the line when you "understand it". Of course the degree to which one can understand any code depends, in general, on how long one wants to spend on it. Does "understanding" mean reading the docs, reading the source, trying various permutations of the code, making a test, all of the above, who knows? I suggest that much of the time what people actually do with AI and code from the web is try the suggested thing, and if it works, they use it. Of course, if they are in a section where the code needs to be utmost performant, maybe you have to spend more time. Or if there are other particular requirements then you spend more time. But if the AI/Web code works for you, then fine. Every minute you spend perfecting a line of code, is a minute you don't spend writing another line of code. Its always a balance and I shy away from blanket statements that are intended to apply to any situation. Personally, I have had a lot of success with AI and with taking code snippets from the web. Sometimes what you are doing warrants a deep look. Other times, not. 1 Share this post Link to post
DelphiUdIT 265 Posted Saturday at 07:39 PM @Dave Novo As others have already said, if you're a professional programmer, you have to know the code you're using. This doesn't mean you have to read the entire VCL code... it just means that when you get a piece of code, wherever you get it, you have to take a look at it. And you have to read the accompanying documentation. Then there are trusted sources, such as those recommended by Embarcadero or the "products" of members of well-known forums. And you might not even glance at these sources, but you still have to read the documentation. You see, one of the current problems emerging with artificial intelligence is that many people with no programming experience are proposing solutions developed entirely by AI without even looking at the code... and perhaps without even running it. How is it possible to use (and propose) such code without knowing it? Now, however, much more attention is needed, and lastly, from a professional point of view, the new legislative regulations being released in Europe to regulate the software sector leave little room for doubt on this point. 2 Share this post Link to post
PeterPanettone 179 Posted yesterday at 12:12 PM On 9/12/2025 at 2:55 PM, dummzeuch said: I just tried the new RAD AI companion Generally, AIs often make mistakes or hallucinate when asked advanced questions about Delphi code. The most reliable AI for Delphi code is SUPERGROK. Share this post Link to post
PeterPanettone 179 Posted yesterday at 12:52 PM 17 hours ago, DelphiUdIT said: you have to read the accompanying documentation You are right, DOCUMENTATION is everything. AI-generated code without accompanying documentation is dangerous (SUPERGROK always links to documentation for anything it generates). However, I strongly reject "regulation" laws from a criminal organization as the so-called "EU" (EU ≠ Europe). Share this post Link to post
Javier Tarí 33 Posted yesterday at 01:13 PM 20 hours ago, Dave Novo said: But often it is correct, at least correct enough for you to move on and do what you really wanted to do in the first place. Welcome to the pyre for heretics, Dave 😜😜😜😜 We should ask for a sub forum called "Heretic followers of the AI God", so our posts don't perturb the purity of Perfect Coding 👻👻👻 Share this post Link to post
PeterPanettone 179 Posted yesterday at 01:23 PM 10 minutes ago, Javier Tarí said: AI God Do you think AI is becoming a new religion? Share this post Link to post
Javier Tarí 33 Posted yesterday at 01:32 PM 1 minute ago, PeterPanettone said: Do you think AI is becoming a new religion? I think ignoring progress is a self inflicted wound. Yes, people forget on how to navigate without GPS And surely someone thought exactly the same when maps where invented. The compass was catastrophic: people forgot how to navigate with sun, stars and nature signals. Debuggers where a clear signal of Doom: people could create impure code and then look for signs of the impurity and fix them Unit tests, what a diabolic invention... Instead of knowing deeply your code, you would delegate the detection of errors on other code constructions Should I continue? Note: AI can become a zillion things, depending only on the humans using it. Of course, that's just my opinion 3 Share this post Link to post
PeterPanettone 179 Posted yesterday at 01:42 PM 5 minutes ago, Javier Tarí said: AI can become a zillion things, depending only on the humans using it You are so right. That is exactly the right way to look at AI. Unfortunately, AI is also becoming a tool for political oppression. And thank you for the humorous part. 1 Share this post Link to post
Javier Tarí 33 Posted yesterday at 05:33 PM 3 hours ago, PeterPanettone said: AI is also becoming a tool for political oppression I totally agree, but I will keep using AI if it's there to use Share this post Link to post