Announcement

Collapse
No announcement yet.

File select in template for inews

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • File select in template for inews


    I'm trying to work out a template where an inews user will load file from their desktop or downloads folder.

    The script in my scene reads a locally stored data file but the path will vary. I would like to make a button that triggers the script RegisterFileSelector and changes the path and file if this is possible.

    Thanks!

  • #2
    Scene:
    Code:
    Dim result As String
    
    Sub OnInitParameters()
        RegisterFileSelector("filename", "File", "", "", "*.csv")
    End Sub
    
    Sub OnParameterChanged(parameterName As String)
        If parameterName = "filename" Then
           Dim filename As string = This.ScriptPluginInstance.GetParameterString("filename")
           If System.FileExists(filename) Then
              System.LoadTextFile(filename, result)
              println result
           Else
              println "File does not exist"
           End If
        End If
    End Sub
    Template:
    Code:
    Const dlgFilter = "*.csv|*.csv"
    
    Sub btnFilePathClick(Sender)
        OpenDialogFile.Filter = dlgFilter
        If OpenDialogFile.Execute Then
           txtFilePath.Text = OpenDialogFile.FileName
        End If
    End sub
    Attached Files

    Comment


    • #3
      Thanks so much for your help. I will try that out.

      Comment


      • #4
        I'm able to use the template to connect to the correct path and file with this. Also, the scene plays out correctly locally. Only problem is I can't preview in inews. Maybe a network problem.

        Thanks again

        Comment

        Working...
        X