Home Image-Pro Automation (Macros, Apps, Reports)

Keyboard Shortcut to Run Macro Question (Image-Pro 10)

Hello, 
I would like to set keyboard shortcuts for various macro functions I have already coded. However, looking at the previous questions on this forum has not been very helpful. 

Here is the macro code I have now, which is not yet operating as I do not know what to enter If/When:
Public Function Auto_All() As SimpleScript
        Auto_All = New SimpleScript
        Auto_All.Shortcut = MediaCy.IQL.Application.mcScriptShortcut.CtrlW 
        With Automate.ScriptingCommands.CodeCommand(Auto_All)
            If .Run() Then
                'not sure what to put here, previous post said "user code"
            End If
            End With
'Rest of macro code
Here is the app button click code:
Public Sub button6_Click(sender As Object, e As System.EventArgs) Handles button6.Click
        Auto_All()
    End Sub
Does anyone know what user code I would enter to create the shortcut to run the macro? Thank you!

Answers

  • I see that the shortcut for your macro is Ctrl-W. Is you macro executed when you hit Ctrl-W?

    Yuri

  • Hello, 
    No, there is a pop-up window that states "ChangeType operation is not supported". 

    Here is the macro code just in case:
    Public Function Auto_All() As SimpleScript
            Auto_All = New SimpleScript
            Auto_All.Shortcut = MediaCy.IQL.Application.mcScriptShortcut.CtrlW
            With Automate.ScriptingCommands.CodeCommand(Auto_All)
                If .Run() Then
                    
                End If
                End With
            Dim trdoc1
    
            With Application.RibbonCommands.SelectRibbonTab(Auto_All)
                .TabName = "TrackingTab"
                .Run()
            End With
    
            With Application.DocumentCommands.Active(Auto_All)
                .Run(trdoc1)
            End With
    
            With Measure.TrackingCommands.FindTracksAuto(Auto_All)
                .Interactive = True
                .Run(trdoc1)
            End With
    
            With Application.RibbonCommands.SelectRibbonTab(Auto_All)
                .TabName = "Share"
                .Run()
            End With
    
            Measure.Data.CollectorCommands.Clear(Auto_All).Run()
    
            With Measure.Data.CollectorCommands.Collect(Auto_All)
                .Run(New List({trdoc1}))
            End With
    
        End Function
  • This message means that there is an error in the macro and the macro cannot be loaded or executed. The error message reports the line and position of the error. Please check that line and try to fix the error.

    Yuri

  • I changed the format of the image and that resolved the issue, everything is working now. Thank you so much!


Sign In or Register to comment.