Attribute VB_Name = "Vysilani"
Option Explicit


'----------------------------------------------------------
'priprava konkretniho radku k odeslani do koderu
'----------------------------------------------------------

Public Sub DoVysilaniFlash()

Dim vv As Integer
Dim pp As String
Dim i As Boolean

    i = False
    
    If (Dir(CestaSoubory & "/Flash.rds") <> "") Then
    
        vv = Hour(Time) * 60 + Minute(Time) + 1
        If vv = 1440 Then vv = 0
            
        If (RdsPole(vv, 2) = "P") Then
            If Priorita(1) > Priorita(2) Then i = True
        Else
            If Priorita(0) > Priorita(2) Then i = True
        End If
        
        If (i = True) Then
            Open CestaSoubory & "/Flash.rds" For Input As #39
                Line Input #39, pp
            
                RdsPole(vv, 1) = pp
                RdsPole(vv, 2) = "F"
            Close #39
        End If
        
        Kill CestaSoubory & "/Flash.rds"
    
    End If
    
    DoEvents

End Sub


'----------------------------------------------------------
'vytvori soubor 'PraveVysilame' kde ulozi text ktery se skutecne
'podarilo odeslat na COM
'produkcni soft tento soubor nacita a zobrazuje
'a zobrazi i tento skutecny text tady v textu
'----------------------------------------------------------

Public Sub DoPraveVysilame()
    
    Dim Kdy As String

    Kdy = Day(Date) & "." & Month(Date) & "." & Year(Date) & "  "
    Kdy = Kdy & Hour(Time) & ":" & Prevod(Minute(Time)) & " "

    Do While (Len(Kdy) < 17)
        Kdy = Kdy & " "
    Loop
    
    Select Case OutTyp
    
        Case "TEXT          ":
    
            Open (CestaSoubory & "/PraveVysilame.rds") For Output As #14
                Print #14, "0 " & Kdy & Left(OutString, 64)
            Close #14
            Indik = 0
                
        Case "PROMO         ":
        
            Open (CestaSoubory & "/PraveVysilame.rds") For Output As #14
                Print #14, "1 " & Kdy & Left(OutString, 64)
            Close #14
            Indik = 1
                
        Case "FLASH         ":
    
            Open (CestaSoubory & "/PraveVysilame.rds") For Output As #14
                Print #14, "2 " & Kdy & Left(OutString, 64)
            Close #14
            Indik = 2
                
        Case "NAHRADNI TEXT ":
    
            Open (CestaSoubory & "/PraveVysilame.rds") For Output As #14
                Print #14, "3 " & Kdy & Left(OutString, 64)
            Close #14
            Indik = 3
            
        Case "POKUSNY TEXT  ":
        
            Open (CestaSoubory & "/PraveVysilame.rds") For Output As #14
                Print #14, "4 " & Kdy & Left(OutString, 64)
            Close #14
            Indik = 4
        
        Case "Pondelni text ":
        
            Open (CestaSoubory & "/PraveVysilame.rds") For Output As #14
                Print #14, "5 " & Kdy & Left(OutString, 64)
            Close #14
            Indik = 5
        
        Case "Uterni text   ":
        
            Open (CestaSoubory & "/PraveVysilame.rds") For Output As #14
                Print #14, "6 " & Kdy & Left(OutString, 64)
            Close #14
            Indik = 6
            
        Case "Stredecni text":
        
            Open (CestaSoubory & "/PraveVysilame.rds") For Output As #14
                Print #14, "7 " & Kdy & Left(OutString, 64)
            Close #14
            Indik = 7
            
        Case "Ctvrtecni text":
        
            Open (CestaSoubory & "/PraveVysilame.rds") For Output As #14
                Print #14, "8 " & Kdy & Left(OutString, 64)
            Close #14
            Indik = 8
            
        Case "Patecni text  ":
        
            Open (CestaSoubory & "/PraveVysilame.rds") For Output As #14
                Print #14, "9 " & Kdy & Left(OutString, 64)
            Close #14
            Indik = 9
            
        Case "Sobotni text  ":
        
            Open (CestaSoubory & "/PraveVysilame.rds") For Output As #14
                Print #14, "10" & Kdy & Left(OutString, 64)
            Close #14
            Indik = 10
            
        Case "Nedelni text  ":
        
            Open (CestaSoubory & "/PraveVysilame.rds") For Output As #14
                Print #14, "11" & Kdy & Left(OutString, 64)
            Close #14
            Indik = 11

    End Select

    
    '----------------------------
    'zobrazi ve statusu skutecne
    'odeslany text
    
    Frm1.LblStStat.ForeColor = &HEA4A1C
    PraveVysilameZobr Kdy

    DoEvents
    
End Sub
