Home Image-Pro Plus Automation with Macros

User select rotation.

In my macro I would like the rotation tool to open so the user can manually select the rotation then have the macro proceed.  How do I go about doing this?

Thanks

Matt

Answers

  • Hi Matt,

    This macro runs interactive "Rotate Preview" and then rotates active image on selected angle.

    Thanks,
    Nikita.


    Public Module Macros
    
        Public Function Rotate_with_Preview() As SimpleScript
            Rotate_with_Preview = New SimpleScript
            Dim doc1
    
            With Application.DocumentCommands.Active(Rotate_with_Preview)
                .Run(doc1)
            End With
    
            With Automate.ScriptingCommands.CodeCommand(Rotate_with_Preview)
                If .Run() Then
                    ' User Code Here
                    Dim im As McImage = .Application.ActiveImage, image1
                    Dim rpv As MediaCy.IQL.Display.Overlays.McRotatePreviewTool
                    Dim a As Double = 0.0
    
                    If im IsNot Nothing Then
                        rpv = im.ImageToolsOverlay.SelectTool("McOvrMgr.McRotatePreviewTool")
    
                        With Automate.ScriptingCommands.Interaction(Rotate_with_Preview)
                            .Text = "Rotate"
                            .Prompt = "Please, rotate preview on the active image with a mouse and click Ok."
                            .Interactive = True
                            .Run(doc1, Nothing)
                        End With
    
                        rpv.CommandFlags = MediaCy.IQL.Display.Overlays.mcRotatePreviewToolCommandFlags.mcrptcfGetRotationAngleOfPreview
                        a = CDbl(-rpv.CommandData) : im.ImageToolsOverlay.SelectTool()
    
                        With Adjust.ImageCommands.Rotate(Rotate_with_Preview)
                            .Orient = Image.OrientType.RotateAngle
                            .Angle = a
                            .Clip = MediaCy.IQL.Operations.mcWarpClip.mcwcNoClip
                            .Visible = True
                            .Run(doc1, image1)
                        End With
                    End If
                End If
            End With
    
        End Function
    
    End Module
Sign In or Register to comment.