The Wiert Corner – irregular stream of stuff

Jeroen W. Pluimers on .NET, C#, Delphi, databases, and personal interests

  • My badges

  • Twitter Updates

  • My Flickr Stream

  • Pages

  • All categories

  • Email Subscription

    Enter your email address to subscribe to this blog and receive notifications of new posts by email.

    Join 716 other subscribers

Delphi XE4: installer batch file for “experimental GExperts + code formatter for Delphi XE4”

Posted by jpluimers on 2013/06/12

Slightly more than a month ago, Thomas Müller release the experimental GExperts + code formatter for Delphi XE4.

Since there is no official GExperts for Delphi XE4 build yet, his installation instructions include this:

Use the ExpertManager tool to register GExperts to Delphi XE4.

The thing is: ExpertManager is part of GExperts, so this introduces a “chichen-and-egg” situation.

So I wrote a small batch file and a bit of documentation to install it.

Just in case you cannot download that SVN changeset easily, here are the documentation and batch-file:

Documentation

Steps to install:
0- Quit Delphi XE4
1- Download the GExperts XE4 experimental from http://blog.dummzeuch.de/2013/04/28/experimental-gexperts-code-formatter-for-delphi-xe4/
2- Recursively unpack that download
3- Copy the batch file Install-GExperts-XE4-experimental–run-as-administrator-from-ExpertManager.exe-directory.bat into that directory
4- From that directory, run the copied Install-GExperts-XE4-experimental–run-as-administrator-from-ExpertManager.exe-directory.bat
5- Run Delphi XE4
6- Check if GExperts is installed

Batch file

[sourcecode language=”text”]
:: check if user is administrator

"C:\Windows\system32\cacls.exe" "C:\Windows\system32\config\system" 1>nul 2>&1 && (goto :isAdmin)
:isNoAdmin
echo you need to be Administrator, and (when under Vista or higher) run this using using UAC
goto :exit

:isAdmin

:: Gets the right link for x86 (32-bit) program files
IF /I %PROCESSOR_ARCHITECTURE% == amd64 goto :x64
IF /I %PROCESSOR_ARCHITEW6432% == amd64 goto :x64
goto :x86
:x64
:: OS is 64bit
set ProgramFilesX86=%ProgramFiles(x86)%
goto :continue
:x86
:: OS is 32bit
set ProgramFilesX86=%ProgramFiles%
goto :continue

:continue

:: create the right directory and copy the files

setlocal

set TargetDirectory=%ProgramFilesX86%\GExperts for RAD Studio XE4

mkdir "%TargetDirectory%"
:: set FilesToCopy=DbugIntf.pas ExpertManager.exe GExperts.chm GExpertsDebugWindow.exe GExpertsGrep.exe regularexpert\GExpertsRSXE4.dll Readme.txt preview.pas
set FilesToCopy=ExpertManager.exe GExperts.chm regularexpert\GExpertsRSXE4.dll preview.pas

for %%f in (%FilesToCopy%) do copy /y %%f "%TargetDirectory%\"
set RegFile="%TargetDirectory%\ExpertsXE4.reg"
:: explorer /select,"%TargetDirectory%\GExpertsRSXE4.dll"

:: expand backslash into double backslash for .REG file
set ExpertTarget="%TargetDirectory%\GExpertsRSXE4.dll"
set ExpertTarget=%ExpertTarget:\=\\%

::Windows Registry Editor Version 5.00
::
::[HKEY_CURRENT_USER\Software\Embarcadero\BDS\11.0\Experts]
::"GExperts"="C:\\Program Files (x86)\\GExperts for RAD Studio XE4\\GExpertsRSXE4.dll"
::
echo Windows Registry Editor Version 5.00 >%RegFile%
echo. >>%RegFile%
echo [HKEY_CURRENT_USER\Software\Embarcadero\BDS\11.0\Experts] >>%RegFile%
echo "GExperts"=%ExpertTarget% >>%RegFile%
echo. >>%RegFile%
:: explorer /select,%RegFile%
regedit /S %RegFile%

endlocal

goto :exit

:exit
[/sourcecode]

–jeroen

via: experimental GExperts + code formatter for Delphi XE4 « twm’s blog.

2 Responses to “Delphi XE4: installer batch file for “experimental GExperts + code formatter for Delphi XE4””

  1. btw: There is no chicken and egg problem: I had included the Experts manager as a stand alone executable.

    • jpluimers's avatar

      jpluimers said

      I must have been blind. Multiple times. Thanks for mentioning it. Does it work with multiple Delphi versions or just one?

Leave a Comment

 

Discover more from The Wiert Corner - irregular stream of stuff

Subscribe now to keep reading and get access to the full archive.

Continue reading