How to use ObjectResolvedScript

Posted by: jsnahil on 3 April 2020, 3:42 am EST

  • Posted 3 April 2020, 3:42 am EST

    I have two questions relating to running scripts.

    1. How do I debug script?
    2. The following script stopped working many months. Why?

      

    Public Sub AddDocument(ByRef doc As S1PrintDocument,
    ByVal EnsureEvenPages As Boolean)
    If EnsureEvenPages Then
    Dim re As RenderEmpty = New RenderEmpty With {
    .ObjectResolvedScript = Script
    }
    doc.ScriptingOptions.Language = Scripting.ScriptLanguageEnum.VB
    doc.Body.Children.Add(re)
    doc.Body.Children.Add(New RenderEmpty())
    End If
    MyBase.Items.Add(doc)
    End If

    doc.Dispose()
    doc = Nothing
    GC.Collect()
    GC.WaitForPendingFinalizers()

    End Sub
  • Replied 3 April 2020, 9:03 pm EST

    jsnahil said:
    I have two questions relating to running scripts.

    1. How do I debug script?
    2. The following script stopped working many months. Why?
      
    Dim Script As String =
    "Iff MultiDocument.PageCount MOD 2 = 0 Then \r\n" +
    " Dim lc As LayoutChangeNewPage = New LayoutChangeNewPage() \r\n" +
    " lc.PageLayout = New PageLayout() \r\n" +
    " lc.PageLayout.PageHeader = New RenderEmpty()\r\n" +
    " lc.PageLayout.PageFooter = New RenderEmpty()\r\n" +
    " Document.Body.Children(RenderObject.IndexInOwner + 1).LayoutChangeAfter = lc\r\n" +
    "Else\r\n" +
    " Document.Body.Children(RenderObject.IndexInOwner + 1).LayoutChangeAfter = Nothing\r\n" +
    "End If\r\n"

    Public Sub AddDocument(ByRef doc As S1PrintDocument,
    ByVal EnsureEvenPages As Boolean)
    If EnsureEvenPages Then
    Dim re As RenderEmpty = New RenderEmpty With {
    .ObjectResolvedScript = Script
    }
    doc.ScriptingOptions.Language = Scripting.ScriptLanguageEnum.VB
    doc.Body.Children.Add(re)
    doc.Body.Children.Add(New RenderEmpty())
    End If
    MyBase.Items.Add(doc)
    End If
    doc.Dispose()
    doc = Nothing
    GC.Collect()
    GC.WaitForPendingFinalizers()
    End Sub
  • Replied 5 April 2020, 9:43 pm EST

    Hi Joginder,

    To replicate the issue at our end we need your stripped-down sample with that has the above-given script and also mention the control version in which it working fine.

    Regards,
    Prabhat Sharma.
  • Replied 6 April 2020, 1:02 am EST

    Hi Prabhat,

    Thanks for your response. My sample woks fine in one environment but does not do anything in another. Is it possible to check if the script is executed? and step through the VBScript?

    Regards,
    Joginder
  • Replied 6 April 2020, 8:04 pm EST

    Hi Joginder,

    Sorry but it is not possible to debug the script.

    To replicate the issue at our end we need your sample and the evnvironment detail in which it is not working fine.
    It will help us to assit you in a better way and if needed we will forward it to devs.

    Regards,
    Prabhat Sharma.
  • Marked as Answer

    Replied 7 April 2020, 2:01 am EST

    Hi Prabhat,

    Thanks for your response. I created a test application and it always works. If I not able to debug VBScript I am happy to close this issue.

    Regards,
    Joginder
Need extra support?

Upgrade your support plan and get personal unlimited phone support with our customer engagement team

Learn More

Forum Channels