0
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
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
| |
Call Main
Sub Main()
Dim objShell
Dim sDistFileName, sCurDirName
Dim i, pos
Set objShell = CreateObject("Wscript.Shell")
sIncPath = objShell.ExpandEnvironmentStrings("%INCLUDE%")
sDistFileName = getIncludeFileName(Editor.GetLineStr(0))
sCurDirName = getCurrentFolderName()
If openFile(sCurDirName & sDistFileName) Then Exit Sub
i = 1
Do While True
pos = InStr(i, sIncPath, ";")
If IsNull(pos) Then Exit Do
If pos = 0 Then
If openFile(Mid(sIncPath, i)) Then Exit Sub
Exit Do
End If
If openFile(Mid(sIncPath, i, pos - i)) Then Exit Sub
i = pos + 1
Loop
End Sub
Function getIncludeFileName(sLine)
Dim pos, endpos
getIncludeFileName = ""
pos = InStr(1, sLine, "<")
If pos = 0 Then
pos = InStr(1, sLine, """")
endpos = InStr(pos + 1, sLine, """")
Else
endpos = InStr(pos + 1, sLine, ">")
End If
If pos = 0 Or endpos = 0 Then Exit Function
pos = pos + 1
getIncludeFileName = Mid(sLine, pos, endpos - pos)
End Function
Function getCurrentFolderName()
Dim pos
Dim sCurFileName
getCurrentFolderName = ""
sCurFileName = GetFileName()
pos = InStrRev(sCurFileName, "\")
If pos = 0 Then Exit Function
getCurrentFolderName = Mid(sCurFileName, 1, pos)
End Function
Function openFile(sPath)
Dim fso
Set fso = CreateObject("Scripting.FileSystemObject")
openFile = False
If (fso.FileExists(sPath)) Then
Editor.FileOpen (sPath)
openFile = True
End If
End Function
|