office-gobmx/scp2/source/mkopenwith.btm
2011-02-03 18:25:04 +01:00

52 lines
1.3 KiB
Text
Executable file

@ECHO OFF
IF '%1'==' GOTO End
IF NOT EXIST %1\. GOTO Module_Error
SET OUTPUT=%1\OpenWith.SCP
SET FILE=%@FILEOPEN[supported_extensions.txt,read,t]
ECHO // "OpenWith" Windows Registry keys for extensions supported by %1 > %OUTPUT%
ECHO. >> %OUTPUT%
:While_Read_File
SET LINE=%@FILEREAD[%FILE%]
IF '%LINE%'=='' GOTO While_Read_File
IF '%@LEFT[1,%LINE%]'==';' GOTO While_Read_File
IF '%LINE%'=='**EOF**' GOTO End_Read_File
IF NOT '%@LEFT[1,%LINE%]'=='[' GOTO Register_Extension
SET MODULE=%@UPPER[%@WORD["[]",0,%LINE%]]
GOTO While_Read_File
:Register_Extension
IF NOT '%MODULE%'=='%@UPPER[%1]' GOTO While_Read_File
ECHO // .%LINE% >> %OUTPUT%
ECHO RegistryItem gid_Regitem_OpenOffice_%LINE%_OpenWith_%1 >> %OUTPUT%
ECHO ParentID = PREDEFINED_HKEY_CLASSES_ROOT; >> %OUTPUT%
ECHO Subkey = ".%LINE%\OpenWithProgIDs"; >> %OUTPUT%
ECHO ModuleID = gid_Module_Prg_%1_Bin; >> %OUTPUT%
ECHO Name = "opendocument.%1Document.1"; >> %OUTPUT%
ECHO Value = "%PRODUCTNAME %PRODUCTVERSION"; >> %OUTPUT%
ECHO End >> %OUTPUT%
ECHO. >> %OUTPUT%
REM GOTO End_Read_File
GOTO While_Read_File
:End_Read_File
SET ERROR=%@FILECLOSE[%FILE%]
GOTO End
:Help
ECHO Usage: %0 Module
ECHO Example: %0 Calc
GOTO End
:Module_Error
ECHO Module %1 not found !
GOTO End
:End