summaryrefslogtreecommitdiff
path: root/utility/demo-fw/pc-tools/CreateDemoBin/PPT/Module1.bas
blob: 4d0fecec27b7f7d83a700853ce2f4620a382d65b (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
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
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
Attribute VB_Name = "Module1"
Sub ExportPPTInfo()

Dim DataTextStr As String
Dim SrcPpt As Application
Dim BaseObj As Object
Dim OutputText As String
Dim pShape As Shape
Dim pTextRange As TextRange
Dim pActionSetting As ActionSetting
Dim pSlide As Slide
Dim pTextFrame As TextFrame
Dim flag As Integer
Dim CurType As Integer
Dim SlideNo As Integer
Dim HyperlinkNo As Integer
Dim intOutFile As Integer
Dim Addr As String
Dim Filename As String
Dim Index As Integer
Dim stringLen As Integer
Dim Pos As Integer
Dim Notes As String
Dim defaulttxt, Options, WSH, inputtext, NameNoExt

    flag = 0
    CurType = 0
    SlideNo = 1
    HyperlinkNo = 1


    Set SrcPpt = Application
    For Each SlideItem In SrcPpt.ActivePresentation.Slides
        OutputText = OutputText + "Slide" + Str(SlideNo) + ":" + Chr$(13) & Chr$(10)
        OutputText = OutputText + "Slide Size:" + Chr$(13) & Chr$(10)
        OutputText = OutputText + "Width: " + Str(SlideItem.Master.Width) + Chr$(13) & Chr$(10) + "Height: " + Str(SlideItem.Master.Height) + Chr$(13) & Chr$(10) + Chr$(13) & Chr$(10)

'       MsgBox SlideItem.NotesPage.Shapes.Placeholders(2).TextFrame.TextRange.Text
        Notes = SlideItem.NotesPage.Shapes.Placeholders(2).TextFrame.TextRange.Text
        If Notes <> "" Then
            OutputText = OutputText + "Properties::" + Chr$(13) & Chr$(10)
            OutputText = OutputText + Notes + Chr$(13) & Chr$(10) + Chr$(13) & Chr$(10)
        End If
        
        SlideNo = SlideNo + 1
        HyperlinkNo = 0
        For Each linkitem In SlideItem.Hyperlinks
            flag = 0
            Addr = linkitem.Address
            If Addr = "BoxOnly" Then
                OutputText = OutputText + "Display Box:" + Chr$(13) & Chr$(10)
            Else
                HyperlinkNo = HyperlinkNo + 1
                OutputText = OutputText + "HyperLink" + Str(HyperlinkNo) + "::" + Chr$(13) & Chr$(10)
                OutputText = OutputText + Chr$(34) + "Link Address" + Chr$(34) + ": " + Addr + Chr$(13) & Chr$(10)
            End If
            
            If (TypeName(linkitem.Parent) = "Shape" Or TypeName(linkitem.Parent) = "TextRange") Then
                flag = 1
                If TypeName(linkitem.Parent) = "Shape" Then
                    Set pShape = linkitem.Parent
                    OutputText = OutputText + "Top: " + Str(pShape.Top) + Chr$(13) & Chr$(10) + "Left: " + Str(pShape.Left) + Chr$(13) & Chr$(10) + "Width: " + Str(pShape.Width) + Chr$(13) & Chr$(10) + "Height: " + Str(pShape.Height) + Chr$(13) & Chr$(10)
'                    MsgBox Str(pShape.Left) + " " + Str(pShape.Top)
                Else
                    Set pTextRange = linkitem.Parent
                    OutputText = OutputText + "Top: " + Str(pTextRange.BoundTop) + Chr$(13) & Chr$(10) + "Left: " + Str(pTextRange.BoundLeft) + Chr$(13) & Chr$(10) + "Width: " + Str(pTextRange.BoundWidth) + Chr$(13) & Chr$(10) + "Height: " + Str(pTextRange.BoundHeight) + Chr$(13) & Chr$(10)
'                    MsgBox Str(pTextRange.BoundLeft) + " " + Str(pTextRange.BoundTop)
                End If
            Else
                Select Case TypeName(linkitem.Parent)
                    
                    Case "ActionSetting"
                        Set pActionSetting = linkitem.Parent
                        CurType = 3
                    Case "Slide"
                        Set pSlide = linkitem.Parent
                        CurType = 4
                    
                    Case "TextFrame"
                        Set pTextFrame = linkitem.Parent
                        CurType = 5
                    
                End Select
            
            End If
            While Not (flag = 1)
                Select Case CurType
                    Case 3
                        If (TypeName(pActionSetting.Parent) = "Shape" Or TypeName(pActionSetting.Parent) = "TextRange") Then
                            flag = 1
                            If TypeName(pActionSetting.Parent) = "Shape" Then
                                Set pShape = pActionSetting.Parent
                                OutputText = OutputText + "Top: " + Str(pShape.Top) + Chr$(13) & Chr$(10) + "Left: " + Str(pShape.Left) + Chr$(13) & Chr$(10) + "Width: " + Str(pShape.Width) + Chr$(13) & Chr$(10) + "Height: " + Str(pShape.Height) + Chr$(13) & Chr$(10)
            '                    MsgBox Str(pShape.Left) + " " + Str(pShape.Top)
                            Else
                                Set pTextRange = pActionSetting.Parent
                                OutputText = OutputText + "Top: " + Str(pTextRange.BoundTop) + Chr$(13) & Chr$(10) + "Left: " + Str(pTextRange.BoundLeft) + Chr$(13) & Chr$(10) + "Width: " + Str(pTextRange.BoundWidth) + Chr$(13) & Chr$(10) + "Height: " + Str(pTextRange.BoundHeight) + Chr$(13) & Chr$(10)
            '                    MsgBox Str(pTextRange.BoundLeft) + " " + Str(pTextRange.BoundTop)
                            End If
                        Else
                            Select Case TypeName(pActionSetting.Parent)
                                Case "ActionSetting"
                                    Set pActionSetting = pActionSetting.Parent
                                    CurType = 3
                                Case "Slide"
                                    Set pSlide = pActionSetting.Parent
                                    CurType = 4
                                Case "TextFrame"
                                    Set pTextFrame = pActionSetting.Parent
                                    CurType = 5
                            End Select
                        
                        End If
                    Case 4
                        If (TypeName(pSlide.Parent) = "Shape" Or TypeName(pSlide.Parent) = "TextRange") Then
                            flag = 1
                            If TypeName(pSlide.Parent) = "Shape" Then
                                Set pShape = pSlide.Parent
                                OutputText = OutputText + "Top: " + Str(pShape.Top) + Chr$(13) & Chr$(10) + "Left: " + Str(pShape.Left) + Chr$(13) & Chr$(10) + "Width: " + Str(pShape.Width) + Chr$(13) & Chr$(10) + "Height: " + Str(pShape.Height) + Chr$(13) & Chr$(10)
            '                    MsgBox Str(pShape.Left) + " " + Str(pShape.Top)
                            Else
                                Set pTextRange = pSlide.Parent
                                OutputText = OutputText + "Top: " + Str(pTextRange.BoundTop) + Chr$(13) & Chr$(10) + "Left: " + Str(pTextRange.BoundLeft) + Chr$(13) & Chr$(10) + "Width: " + Str(pTextRange.BoundWidth) + Chr$(13) & Chr$(10) + "Height: " + Str(pTextRange.BoundHeight) + Chr$(13) & Chr$(10)
            '                    MsgBox Str(pTextRange.BoundLeft) + " " + Str(pTextRange.BoundTop)
                            End If
                        Else
                            Select Case TypeName(pSlide.Parent)
                                Case "ActionSetting"
                                    Set pActionSetting = pSlide.Parent
                                    CurType = 3
                                Case "Slide"
                                    Set pSlide = pSlide.Parent
                                    CurType = 4
                                Case "TextFrame"
                                    Set pTextFrame = pSlide.Parent
                                    CurType = 5
                            End Select
                        
                        End If
                    Case 5
                        If (TypeName(pTextFrame.Parent) = "Shape" Or TypeName(pTextFrame.Parent) = "TextRange") Then
                            flag = 1
                            If TypeName(pTextFrame.Parent) = "Shape" Then
                                Set pShape = pTextFrame.Parent
                                OutputText = OutputText + "Top: " + Str(pShape.Top) + Chr$(13) & Chr$(10) + "Left: " + Str(pShape.Left) + Chr$(13) & Chr$(10) + "Width: " + Str(pShape.Width) + Chr$(13) & Chr$(10) + "Height: " + Str(pShape.Height) + Chr$(13) & Chr$(10)
            '                    MsgBox Str(pShape.Left) + " " + Str(pShape.Top)
                            Else
                                Set pTextRange = pTextFrame.Parent
                                OutputText = OutputText + "Top: " + Str(pTextRange.BoundTop) + Chr$(13) & Chr$(10) + "Left: " + Str(pTextRange.BoundLeft) + Chr$(13) & Chr$(10) + "Width: " + Str(pTextRange.BoundWidth) + Chr$(13) & Chr$(10) + "Height: " + Str(pTextRange.BoundHeight) + Chr$(13) & Chr$(10)
            '                    MsgBox Str(pTextRange.BoundLeft) + " " + Str(pTextRange.BoundTop)
                            End If
                        Else
                            Select Case TypeName(pTextFrame.Parent)
                                Case "ActionSetting"
                                    Set pActionSetting = pTextFrame.Parent
                                    CurType = 3
                                Case "Slide"
                                    Set pSlide = pTextFrame.Parent
                                    CurType = 4
                                Case "TextFrame"
                                    Set pTextFrame = pTextFrame.Parent
                                    CurType = 5
                            End Select
                        
                        End If
                End Select
            Wend
            
            
        OutputText = OutputText + Chr$(13) & Chr$(10)
        Next
        
        For Each linkitem In SlideItem.Master.Hyperlinks
            flag = 0
            Addr = linkitem.Address
            If Addr = "BoxOnly" Then
                OutputText = OutputText + "Display Box:" + Chr$(13) & Chr$(10)
            Else
                HyperlinkNo = HyperlinkNo + 1
                OutputText = OutputText + "HyperLink" + Str(HyperlinkNo) + "::" + Chr$(13) & Chr$(10)
                OutputText = OutputText + Chr$(34) + "Link Address" + Chr$(34) + ": " + Addr + Chr$(13) & Chr$(10)
            End If
            
            If (TypeName(linkitem.Parent) = "Shape" Or TypeName(linkitem.Parent) = "TextRange") Then
                flag = 1
                If TypeName(linkitem.Parent) = "Shape" Then
                    Set pShape = linkitem.Parent
                    OutputText = OutputText + "Top: " + Str(pShape.Top) + Chr$(13) & Chr$(10) + "Left: " + Str(pShape.Left) + Chr$(13) & Chr$(10) + "Width: " + Str(pShape.Width) + Chr$(13) & Chr$(10) + "Height: " + Str(pShape.Height) + Chr$(13) & Chr$(10)
'                    MsgBox Str(pShape.Left) + " " + Str(pShape.Top)
                Else
                    Set pTextRange = linkitem.Parent
                    OutputText = OutputText + "Top: " + Str(pTextRange.BoundTop) + Chr$(13) & Chr$(10) + "Left: " + Str(pTextRange.BoundLeft) + Chr$(13) & Chr$(10) + "Width: " + Str(pTextRange.BoundWidth) + Chr$(13) & Chr$(10) + "Height: " + Str(pTextRange.BoundHeight) + Chr$(13) & Chr$(10)
'                    MsgBox Str(pTextRange.BoundLeft) + " " + Str(pTextRange.BoundTop)
                End If
            Else
                Select Case TypeName(linkitem.Parent)
                    
                    Case "ActionSetting"
                        Set pActionSetting = linkitem.Parent
                        CurType = 3
                    Case "Slide"
                        Set pSlide = linkitem.Parent
                        CurType = 4
                    
                    Case "TextFrame"
                        Set pTextFrame = linkitem.Parent
                        CurType = 5
                    
                End Select
            
            End If
            While Not (flag = 1)
                Select Case CurType
                    Case 3
                        If (TypeName(pActionSetting.Parent) = "Shape" Or TypeName(pActionSetting.Parent) = "TextRange") Then
                            flag = 1
                            If TypeName(pActionSetting.Parent) = "Shape" Then
                                Set pShape = pActionSetting.Parent
                                OutputText = OutputText + "Top: " + Str(pShape.Top) + Chr$(13) & Chr$(10) + "Left: " + Str(pShape.Left) + Chr$(13) & Chr$(10) + "Width: " + Str(pShape.Width) + Chr$(13) & Chr$(10) + "Height: " + Str(pShape.Height) + Chr$(13) & Chr$(10)
            '                    MsgBox Str(pShape.Left) + " " + Str(pShape.Top)
                            Else
                                Set pTextRange = pActionSetting.Parent
                                OutputText = OutputText + "Top: " + Str(pTextRange.BoundTop) + Chr$(13) & Chr$(10) + "Left: " + Str(pTextRange.BoundLeft) + Chr$(13) & Chr$(10) + "Width: " + Str(pTextRange.BoundWidth) + Chr$(13) & Chr$(10) + "Height: " + Str(pTextRange.BoundHeight) + Chr$(13) & Chr$(10)
            '                    MsgBox Str(pTextRange.BoundLeft) + " " + Str(pTextRange.BoundTop)
                            End If
                        Else
                            Select Case TypeName(pActionSetting.Parent)
                                Case "ActionSetting"
                                    Set pActionSetting = pActionSetting.Parent
                                    CurType = 3
                                Case "Slide"
                                    Set pSlide = pActionSetting.Parent
                                    CurType = 4
                                Case "TextFrame"
                                    Set pTextFrame = pActionSetting.Parent
                                    CurType = 5
                            End Select
                        
                        End If
                    Case 4
                        If (TypeName(pSlide.Parent) = "Shape" Or TypeName(pSlide.Parent) = "TextRange") Then
                            flag = 1
                            If TypeName(pSlide.Parent) = "Shape" Then
                                Set pShape = pSlide.Parent
                                OutputText = OutputText + "Top: " + Str(pShape.Top) + Chr$(13) & Chr$(10) + "Left: " + Str(pShape.Left) + Chr$(13) & Chr$(10) + "Width: " + Str(pShape.Width) + Chr$(13) & Chr$(10) + "Height: " + Str(pShape.Height) + Chr$(13) & Chr$(10)
            '                    MsgBox Str(pShape.Left) + " " + Str(pShape.Top)
                            Else
                                Set pTextRange = pSlide.Parent
                                OutputText = OutputText + "Top: " + Str(pTextRange.BoundTop) + Chr$(13) & Chr$(10) + "Left: " + Str(pTextRange.BoundLeft) + Chr$(13) & Chr$(10) + "Width: " + Str(pTextRange.BoundWidth) + Chr$(13) & Chr$(10) + "Height: " + Str(pTextRange.BoundHeight) + Chr$(13) & Chr$(10)
            '                    MsgBox Str(pTextRange.BoundLeft) + " " + Str(pTextRange.BoundTop)
                            End If
                        Else
                            Select Case TypeName(pSlide.Parent)
                                Case "ActionSetting"
                                    Set pActionSetting = pSlide.Parent
                                    CurType = 3
                                Case "Slide"
                                    Set pSlide = pSlide.Parent
                                    CurType = 4
                                Case "TextFrame"
                                    Set pTextFrame = pSlide.Parent
                                    CurType = 5
                            End Select
                        
                        End If
                    Case 5
                        If (TypeName(pTextFrame.Parent) = "Shape" Or TypeName(pTextFrame.Parent) = "TextRange") Then
                            flag = 1
                            If TypeName(pTextFrame.Parent) = "Shape" Then
                                Set pShape = pTextFrame.Parent
                                OutputText = OutputText + "Top: " + Str(pShape.Top) + Chr$(13) & Chr$(10) + "Left: " + Str(pShape.Left) + Chr$(13) & Chr$(10) + "Width: " + Str(pShape.Width) + Chr$(13) & Chr$(10) + "Height: " + Str(pShape.Height) + Chr$(13) & Chr$(10)
            '                    MsgBox Str(pShape.Left) + " " + Str(pShape.Top)
                            Else
                                Set pTextRange = pTextFrame.Parent
                                OutputText = OutputText + "Top: " + Str(pTextRange.BoundTop) + Chr$(13) & Chr$(10) + "Left: " + Str(pTextRange.BoundLeft) + Chr$(13) & Chr$(10) + "Width: " + Str(pTextRange.BoundWidth) + Chr$(13) & Chr$(10) + "Height: " + Str(pTextRange.BoundHeight) + Chr$(13) & Chr$(10)
            '                    MsgBox Str(pTextRange.BoundLeft) + " " + Str(pTextRange.BoundTop)
                            End If
                        Else
                            Select Case TypeName(pTextFrame.Parent)
                                Case "ActionSetting"
                                    Set pActionSetting = pTextFrame.Parent
                                    CurType = 3
                                Case "Slide"
                                    Set pSlide = pTextFrame.Parent
                                    CurType = 4
                                Case "TextFrame"
                                    Set pTextFrame = pTextFrame.Parent
                                    CurType = 5
                            End Select
                        
                        End If
                End Select
            Wend
            
            
        OutputText = OutputText + Chr$(13) & Chr$(10)
        Next
        OutputText = OutputText + Chr$(13) & Chr$(10) + Chr$(13) & Chr$(10)
    Next
    
    stringLen = Len(SrcPpt.ActivePresentation.Name)
    For Index = 1 To stringLen
        If Mid(SrcPpt.ActivePresentation.Name, Index, 1) = "." Then
            Pos = Index
        End If
    Next
    
    Filename = Left(SrcPpt.ActivePresentation.Name, Pos - 1) + ".txt"
    NameNoExt = Left(SrcPpt.ActivePresentation.Name, Pos - 1)

    Open Filename For Output As #1
    Print #1, OutputText
    Close #1
    
' Save as PNG files
With Application.ActivePresentation
    '.SaveAs SrcPpt.ActivePresentation.Name, ppSaveAsBMP
    .Export SrcPpt.ActivePresentation.Name, "BMP", 320, 240
End With

Set WSH = CreateObject("WSCRIPT.SHELL")

defaulttxt = "-profile at91sam3u-ek"

inputtext = "Use following format:" + Chr$(13) & Chr$(10) + " -profile <EK-board-name>, default profiles" + Chr$(13) & Chr$(10) + "Or" + Chr$(13) & Chr$(10) + " -bitdepth xx -width xxx -height xxx -rotate xxx [-noreversebitorder]"

Do

Options = InputBox(inputtext, "Input convert param:", defaulttxt)

If Len(Options) = 0 Then
Exit Do

Else

inputtext = "../bin/CreateDemoBin.exe " + Options + " " + NameNoExt

WSH.POPUP (inputtext)

WSH.Run (inputtext)


Exit Do

End If

Loop

End Sub

personal git repositories of Harald Welte. Your mileage may vary