summaryrefslogtreecommitdiff
path: root/scp2/source/mkopenwith.btm
blob: 0c09f3b5e1511d2cbe40feb60099319307ef46ec (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
@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