Jump to content
dummzeuch

RAD AI Companion

Recommended Posts

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 by dummzeuch
  • Confused 1

Share this post


Link to post
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
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.

  • Like 1

Share this post


Link to post

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
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

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×