update dev300-m58
[ooovba.git] / scp2 / source / mkopenwith.btm
blob0c09f3b5e1511d2cbe40feb60099319307ef46ec
1 @ECHO OFF
2 IF '%1'==' GOTO End
3 IF NOT EXIST %1\. GOTO Module_Error
5 SET OUTPUT=%1\OpenWith.SCP
7 SET FILE=%@FILEOPEN[supported_extensions.txt,read,t]
9 ECHO // "OpenWith" Windows Registry keys for extensions supported by %1         > %OUTPUT%
10 ECHO.                                                                                                                                           >> %OUTPUT%
12 :While_Read_File
13 SET LINE=%@FILEREAD[%FILE%]
14 IF '%LINE%'=='' GOTO While_Read_File
15 IF '%@LEFT[1,%LINE%]'==';' GOTO While_Read_File
16 IF '%LINE%'=='**EOF**' GOTO End_Read_File
18 IF NOT '%@LEFT[1,%LINE%]'=='[' GOTO Register_Extension
20 SET MODULE=%@UPPER[%@WORD["[]",0,%LINE%]]
21 GOTO While_Read_File
23 :Register_Extension
24 IF NOT '%MODULE%'=='%@UPPER[%1]' GOTO While_Read_File
26 ECHO // .%LINE%                                                                                                 >> %OUTPUT%
27 ECHO RegistryItem gid_Regitem_OpenOffice_%LINE%_OpenWith_%1             >> %OUTPUT%
28 ECHO     ParentID = PREDEFINED_HKEY_CLASSES_ROOT;                               >> %OUTPUT%
29 ECHO     Subkey = ".%LINE%\OpenWithProgIDs";                                    >> %OUTPUT%
30 ECHO     ModuleID = gid_Module_Prg_%1_Bin;                                              >> %OUTPUT%
31 ECHO     Name = "opendocument.%1Document.1";                                    >> %OUTPUT%
32 ECHO     Value = "%PRODUCTNAME %PRODUCTVERSION";                                >> %OUTPUT%
33 ECHO End                                                                                                                >> %OUTPUT%
34 ECHO.                                                                                                                   >> %OUTPUT%
36 REM GOTO End_Read_File
37 GOTO While_Read_File
39 :End_Read_File
40 SET ERROR=%@FILECLOSE[%FILE%]
41 GOTO End
43 :Help
44 ECHO Usage:             %0 Module
45 ECHO Example:   %0 Calc
46 GOTO End
48 :Module_Error
49 ECHO Module %1 not found !
50 GOTO End
52 :End