Programm code is not executed

A batch process loads an image, create a thumbnail from it and finally export it (Button: Create and Export Thumbnail). I would like to override the output path and additional settings via program code. If I integrate the method SaveImageAsThumbnail, generally no program code will be executed. If I comment out the program code between the comments "from here" "to here" with "'", no program code will be executed either. Only when I remove the program code will the program run again.

Public Sub SaveImageAsThumbnail

    Dim newSaveFileName As String
    Dim window1, doc1, varList1

    newSaveFileName = "C:\temp\Thumbnail.png"

    With MediaCy.Automation.Application.WindowCommands.Active(Nothing)
        .Run(window1)
    End With

    With MediaCy.Automation.Application.DocumentCommands.Activate(Nothing)
        .Run(window1, doc1)
    End With

    ' from here
    With MediaCy.Automation.Application.ApplicationCommands.SetOption(Nothing)
        .Module = "QuickSave"
        .Section = "Publication"
        .Key = "Extension"
        .Value = "PNG"
        .Run()
    End With

    With MediaCy.Automation.Application.ApplicationCommands.SetOption(Nothing)
        .Module = "QuickSave"
        .Section = "Publication"
        .Key = "Reopen"
        .Value = False
        .Run()
    End With

    With MediaCy.Automation.Application.ApplicationCommands.SetOption(Nothing)
        .Module = "QuickSave"
        .Section = "Publication"
        .Key = "UseCurrentZoom"
        .Value = False
        .Run()
    End With

    With MediaCy.Automation.Application.ApplicationCommands.SetOption(Nothing)
        .Module = "QuickSave"
        .Key = "PlaySound"
        .Value = False
        .Run()
    End With

    With MediaCy.Automation.Application.ApplicationCommands.SetOption(Nothing)
        .Module = "QuickSave"
        .Section = "Publication"
        .Key = "ImageSize"
        .Value = 1000
        .Run()
    End With

    With MediaCy.Automation.Application.ApplicationCommands.SetOption(Nothing)
        .Module = "QuickSave"
        .Section = "Publication"
        .Key = "Path"
        .Value = newSaveFileName
        .Run()
    End With
    ' to here

    With MediaCy.Automation.Application.WindowCommands.QuickSaveSelectedForPublication(Nothing)
        .Run(varList1)
    End With

End Sub
I have attached a sample project. What can I do? How can I solve this?

Thanks in advance
fsup
Sign In or Register to comment.