1 | Option Explicit
|
---|
2 |
|
---|
3 | ' RDFInt.php - RDF Interfaces for PHP
|
---|
4 | ' Copyright 2011 netlabs.org
|
---|
5 | ' Author: Christian Langanke, Adrian Gschwend
|
---|
6 | '
|
---|
7 | ' Licensed under the Apache License, Version 2.0 (the "License");
|
---|
8 | ' you may not use this file except in compliance with the License.
|
---|
9 | ' You may obtain a copy of the License at
|
---|
10 | '
|
---|
11 | ' http://www.apache.org/licenses/LICENSE-2.0
|
---|
12 | '
|
---|
13 | ' Unless required by applicable law or agreed to in writing, software
|
---|
14 | ' distributed under the License is distributed on an "AS IS" BASIS,
|
---|
15 | ' WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
---|
16 | ' See the License for the specific language governing permissions and
|
---|
17 | ' limitations under the License.
|
---|
18 |
|
---|
19 | Const CONST_REGVAL_PREFBROWSER_FILETYPE = "HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\FileExts\.html\UserChoice\Progid"
|
---|
20 | Const CONST_REGSUBVAL_FILETYPE_COMMAND = "shell\open\command\"
|
---|
21 |
|
---|
22 | Dim rc : rc = Main
|
---|
23 | WScript.Quit rc
|
---|
24 |
|
---|
25 | '===============================================================
|
---|
26 | Function Main( )
|
---|
27 | Main = 0
|
---|
28 |
|
---|
29 | Dim oFSO : Set oFSO = CreateObject("Scripting.FileSystemObject")
|
---|
30 | Dim oWshShell : Set oWshShell = Wscript.CreateObject("Wscript.Shell")
|
---|
31 |
|
---|
32 | ' get name of configfile from 1st parm
|
---|
33 | If (WScript.Arguments.Count = 0) Then
|
---|
34 | WScript.Echo "Error: no config file specified!"
|
---|
35 | Main = 87
|
---|
36 | Exit Function
|
---|
37 | End If
|
---|
38 | Dim strIndexFile : strIndexFile = oFSO.GetAbsolutePathName( WScript.Arguments(0))
|
---|
39 | If (Not oFSO.FileExists( strIndexFile)) Then
|
---|
40 | WScript.Echo "Error: file not found: " & strCfgFile
|
---|
41 | Main = 2
|
---|
42 | Exit Function
|
---|
43 | End If
|
---|
44 |
|
---|
45 | ' get command for default browser
|
---|
46 | Dim strUrl : strUrl = "file:///" & Replace( strIndexFile, "\", "/")
|
---|
47 | Dim strFileType : strFileType = oWshShell.RegRead( CONST_REGVAL_PREFBROWSER_FILETYPE)
|
---|
48 | Dim strExec : strExec = oWshShell.RegRead( "HKEY_CLASSES_ROOT\" & strFileType & "\" & CONST_REGSUBVAL_FILETYPE_COMMAND)
|
---|
49 | If (InStr( strExec, "%1") > 0) Then
|
---|
50 | strExec = Replace( strExec, "%1", strUrl)
|
---|
51 | Else
|
---|
52 | strExec = strExec & " """ & strUrl & """"
|
---|
53 | End If
|
---|
54 |
|
---|
55 | ' launch browser with file
|
---|
56 | oWshShell.Run strExec
|
---|
57 |
|
---|
58 | End Function
|
---|
59 | '===============================================================
|
---|