Announcement

Collapse
No announcement yet.

Create a log to keep track if image was played

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

  • Create a log to keep track if image was played

    Hello and thank you,

    Does anyone know of a way to keep track if an image on a template got played? if it went to air?

    What I need is an As-Run log for a specific image

    The image gets loaded to a template via a VTW script when a button gets checked, but I only need to know if it actually went to air

    Any ideas welcomed, thanks


  • #2
    How about you add a script on the image container inside artist. The script checks which image is used but only if the engine has been OnAir, not in normal artistmode (to allow testing) and then write the result to a file or something
    RegisterFileSelector("File", "File:","c:\","test.txt", "*.txt")
    Just an idea

    Comment


    • #3
      Lars Henriksen Hello and thanks, thats exactly the script I am writing but on VTW, then checking if the scene is on the output engine and if thats the correct image write to a text file adding the date and time.

      Any other ideas welcomed

      Comment


      • #4
        Lars Henriksen How would I check for the engine, PerField?

        Comment


        • #5
          I have a scenescript that checks my BACK_LAYER if a particular scene is loaded. If I want my background layer to have video, I send a 1 value to an omo. If not i send a 0. The script below checks if the machine is on air or in Artist mode and sends the correct command based on that. The Background scene then have some keyframes that sends me the state via SHM if it is loaded or not. It works pretty smooth. Same thing could be used in your case. First check if the machine is on Air. Then check which image have been loaded if it is on air. Hope this helps

          Code:
          dim c as Container
          dim i as Integer
              c = Scene.FindContainer("_BG")
              
          sub OnInitParameters()
              registerPushButton("check", "Check scene in back", 1)
              registerPushButton("btnBGIn", "Change BG to loop", 2)
          end sub
          
          sub checkContent()
              i = c.GetFunctionPluginInstance("Omo").GetParameterInt("vis_con")
              'println(14, "type is set to " & i)
          
          '---DONT USE VIDEO
              if i == cInt(0) then
                      if sendCommand("MAIN IS_ON_AIR") = "0" then
                          'println(14, "its not on air")
                          sendCommand("SCENE_EDITOR*BACK_LAYER SET_ACTIVE 0")
                      else
                          sendCommand("RENDERER*BACK_LAYER SET_ACTIVE 0")
                      end if
          
          '---USE VIDEO
              elseif i == cInt(1) OR i == cInt(2) then
                      if sendCommand("MAIN IS_ON_AIR") = "0" then
                          'println(14, "its not on air")
                          sendCommand("SCENE_EDITOR*BACK_LAYER SET_ACTIVE 1")
                          sendCommand("SCENE_EDITOR*BACK_LAYER SET_OBJECT SCENE*MyLoopingBG/ScenePath")
                      else
                          sendCommand("RENDERER*BACK_LAYER SET_ACTIVE 1")
                          sendCommand("RENDERER*BACK_LAYER SET_OBJECT SCENE*MyLoopingBG/ScenePath")
                      end if
                      
          '---CHECK BG SCENE    
              dim content as string = sendCommand("BACK_SCENE*LOCATION_PATH GET")
                  if content = ("SCENE*MyLoopingBG/ScenePath") then
          
                      if System.Map["BGLoop.state"] == "loaded" then
              
                      elseif System.Map["BGLoop.state"] == "sceneOutDone" then
          
                      elseif System.Map["BGLoop.state"] == "sceneIn" then
                          'sendCommand("BACK_SCENE*STAGE START;")
                      elseif System.Map["BGLoop.state"] == "sceneInDone" then
                          sendCommand("BACK_SCENE*STAGE CONTINUE;")
                          'println(13, "Animating to Black Loop")    
                      end if
                  end if     
              end if
          end sub
          
          sub OnExecAction(buttonId As Integer)
              if buttonId = 1 then
                  checkContent()
                  'println(13, "Checking if BGLoop is loaded")
              elseif buttonId = 2 then
                  if i == cInt(1) OR i == cInt(2) then
                  'if System.Map["BGLoop.state"] == "sceneOutDone" OR System.Map["BGLoop.state"] == "loaded" then
                      sendCommand("SCENE*MyLoopingBG/ScenePath*STAGE*DIRECTOR*Default CONTINUE")
                  else
                  
                  end if
              end if
          end sub
          
          sub OnInit()
              checkContent()
          end sub

          Comment


          • #6
            Lars Henriksen

            this is what i have so far,

            this is writing to an existing file
            I need to create a text file every day
            I only get one value from the array
            and its overwriting whats already there

            if you can please help me out with this

            thanks

            Code:
            dim times_played as Array[string]
            dim todays_date = this.Geometry.Text
            
            Sub OnInitParameters()
                RegisterPushButton("get_date", "Get Date", 1)
                RegisterPushButton("write_file", "Write File", 2)
            End Sub
            
            Sub OnExecAction(buttonId As Integer)
                If buttonId = 1 then    
                    if todays_date = todays_date then
                        write_to_array()
                    end if    
                End if
                
                If buttonId = 2 then
                    write_to_file()
                end if
            End Sub
            
            Sub write_to_array()
                if cstr(texture.image.uuid) = "C7C745FC-1687-47D0-BF72C11819F6225B" then
                    todays_date = this.Geometry.Text
                    println(todays_date)
                    times_played.push(todays_date)
                end if
            End Sub
            
            Sub write_to_file()
                dim server_share as string
                server_share = "C:/hotbuttonreport.txt"
                for i=times_played.lbound to times_played.ubound 
                    system.SaveTextFile(server_share, chr(10) & times_played[i])
                Next
            end sub

            Comment


            • #7
              I asked a colleague and he forwarded me this.
              http://www.devguru.com/content/techn...ntextfile.html
              Im not sure how to get that implemented in your code but its a pointer towards the overwrite problem, you need to open the txt file and append instead of just writing, I was told.

              Comment


              • #8
                Hi.

                You are overwriting the same file with a line of your array.

                Code:
                Sub write_to_file()
                      dim server_share as string
                      server_share = "C:/hotbuttonreport.txt"
                      for i=times_played.lbound to times_played.ubound
                            system.SaveTextFile(server_share, chr(10) & times_played[i])
                      Next
                end sub
                You need to put all of your lines from your array into a text string (as that is what the savetextfile expects), and put that as the parameter for the function. (your todays_date needs to be in a format that doesnt make the OS think it is a path. I.e 12/12/18, should be 12_12_18)

                This should then be:

                Code:
                Sub write_to_file()
                        dim server_share as string
                        server_share = "C:/hotbuttonreport_" & todays_date & ".txt"
                        dim sOutput as string
                        for i=0 to times_played.ubound
                             sOutput &= time_played[i] & "\n"
                        Next
                
                        system.SaveTextFile(server_share, sOutput)
                end sub

                Huy
                Last edited by hng; 08-13-2018, 07:55 AM.

                Comment


                • #9
                  If you want to append the text file, then you will need to read in the existing text file into an array, and then output that as a string, to be output again into the same text file. Vizscript does not have any append functionality when writing to a file.

                  Comment

                  Working...
                  X