0

How to get variable (a video filename) from Lua and use in VB Net?.

In Lua:

function videoID(sender, vidsource)
 if sender.Name == 'Awaken' then
    vidsource = 'awaken.mp4'
 elseif sender.Name == 'Crew' then
    vidsource = 'Crew.mp4'
 else
    return vidsource
 end
 local f = assert(io.open(main_path..'/GLauncherResources/video.txt', "w"))
 f:write(vidsource)
 f:close()
end

Next, in VB Net, I want to read a variable from file video.txt (just contains 1 line), and use the variable as video name which will play in vb net:

Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load
        Dim video As String
        Dim path As String = "E:\GLauncherResources\video.txt"
        video = File.ReadAllLines(path).ToString()
        Console.Write(video)
        MediaPlayer1.URL = video

        'Dim video = IO.File.ReadAllLines(My.Application.Info.DirectoryPath & "\video.txt")
        'MediaPlayer1.URL = video
    End Sub

Or is any other way just pass the variable without need to save to a text file?.

Egor Skriptunoff
  • 23,359
  • 2
  • 34
  • 64
JoeFern
  • 117
  • 1
  • 8
  • Do you start VB.NET program from Lua code? – Egor Skriptunoff Mar 27 '20 at 12:58
  • #Egor Skriptunoff - Yes, after the vb net program compiled as an exe file. I just need the 'video name' variable which use to play a video in the vb net program, using 'mediaPlayer1.URL = path..+ the video name variable. – JoeFern Mar 27 '20 at 15:01
  • Never mind. I solved the problem. In Lua use : 'writeToClipboard(vidsource)' to store video name variable to memory and in VB Net use : 'Dim video As String = Clipboard.GetText' and then ' MediaPlayer1.URL = video'. Its work. – JoeFern Mar 27 '20 at 15:20

0 Answers0