' =============================================
'   PK-POS v1 - 28/11/2024
' =============================================

NumeroCassette = 14

String FileName   = "DatiCassette"
String Extension  = ".csv"
String FilePathAndName

' ------------------------------------- BUTTONS
For v1 = 1 To NumeroCassette
	v2 = v1
	If v2 > NumeroCassette / 2
		v2 = v2 + 16 - NumeroCassette / 2
	EndIf
	Button v2 Label "Post" + v1
	Button v2 Color Honeydew
Next
Button 33 Label Data
Button 33 Color Yellow9
Button 35 Label ApriCartella
Button 35 Color Yellow9
Button 36 Label ApriFile
Button 36 Color Yellow9

' ------------------------------------- INIT
Option Speed 9

s1 = Now
FilePathAndName = FileName + "_" + Left(s1, 10) + Extension
FilePathAndName = Replace(FilePathAndName, "/", "_")

Window MinSize 
Load Theremino_Hal.exe
Gosub MainLoop
Stop

' ------------------------------------- CLOSE APPLICATION
Label EventStop
	Load CloseApps Theremino_Hal.exe
	Window Sizable 
End

' ------------------------------------- MAIN LOOP
Label MainLoop
	' --------------------------------- Test SLOTS
	Numeric NumeroCassette
	Numeric Cassetta
	For Cassetta = 1 To NumeroCassette
		If Slot(Cassetta) <> Array1(Cassetta)
			Array1(Cassetta) = Slot(Cassetta)
			If Slot(Cassetta) = 0
				AddCassetta
			EndIf
		EndIf
	Next
	' ---------------------------------- Print TIME
	Button Data Text  "  " + Now
Goto MainLoop

Numeric StartTime

Label AddCassetta
	Array2(Cassetta) = Array2(Cassetta) + 1
	Button Cassetta Text "Post 1  = " + Array2(Cassetta)
	Beep 700 10
	SaveFile
Return

Label SaveFile
	s1 = Now + ";"
	For v1 = 1 To NumeroCassette
		s1 = s1 + Array2(v1) + ";"
	Next
	s1 = Left(s1, Len(s1) - 1) 
	Save StringToFile s1 FilePathAndName
Return

Label ApriFile
	Load FilePathAndName
Return

Label ApriCartella
	Load ".\Files"
Return


'BOOKMARKS 

'EDITEDLINES 20 10 1 5 30 5 35 10 45 5 40 10 53 5 11 10 6 10 25 10 58 8 63 8 68 10 75 10 80 10 

'WATCH 
'WATCH 
'WATCH 
'WATCH Array1
