Set application = WScript.CreateObject("PowerPoint.Application") If application.SlideShowWindows.Count > 0 Then ' If PowerPoint is in slideshow mode, then stop the script Call Err.Raise(60002, , "PowerPoint is in presentation mode. Cannot perform operation.") Else ' Get the arguments from the plugin manipulation-shape.ts mergeMode = WScript.Arguments(0) typeMode = WScript.Arguments(1) isEditing = WScript.Arguments(2) count = 0 count = application.ActiveWindow.Selection.ShapeRange.Count If typeMode = "EDIT_POINT" Then ' Edit points mode If count = 1 Then shape = application.ActiveWindow.Selection.ShapeRange.Name With application.ActiveWindow.Selection.SlideRange.Shapes For x = 1 To .Count If .Item(x).Name = shape Then IndexOf = x End If Next ' Switch on off the editing mode If isEditing = "true" Then .Range(IndexOf).Select WScript.Quit ' Stop the execution of the script Else .Range(IndexOf).Select On Error Resume Next application.CommandBars.ExecuteMso("ObjectEditPoints") On Error GoTo 0 End If End With Else Call Err.Raise(60003, , "For edit points only can select 1 shape. Currently selected: " & count) End If Else ' Merge shapes mode If count > 1 Then If mergeMode = "UNION" Then application.CommandBars.ExecuteMso("ShapesUnion") ElseIf mergeMode = "COMBINE" Then application.CommandBars.ExecuteMso("ShapesCombine") ElseIf mergeMode = "FRAGMENT" Then application.CommandBars.ExecuteMso("ShapesFragment") ElseIf mergeMode = "INTERSECT" Then application.CommandBars.ExecuteMso("ShapesIntersect") ElseIf mergeMode = "SUBTRACT" Then application.CommandBars.ExecuteMso("ShapesSubtract") Else Call Err.Raise(60003, , "Invalid merge mode") End If Else Call Err.Raise(60003, , "For merge shapes must select at least 2 shapes. Currently selected: " & count) End If End If End If