```vb Sub SaveRecipes() 'Tip: ' 1. Use the or shortcut to open a list of all objects and functions ' 2. Write the code using the HMI Runtime object. ' Example: HmiRuntime.Screens("Screen_1"). ' 3. Use the shortcut to create an object reference. 'Write the code as of this position: ' v 0.2 MVera 14-06-24 ' This script works with the PC and WinCE filesystem ' Need to change the TypeOfPanel constant 'Define variable of script Dim FolderPath, fileObj, fileSysObj, Row Dim n, TagNomeSetDati, Spaces 'Definitions Const MaxNumDeRiccete = 51 Const MaxNumArea = 2 Const TypeOfPanel = "WinCE" ' "WinCE" "WindowsPC" Dim NumDataSet 'Define Folder Address On Error Resume Next If TypeOfPanel = "WinCE" Then '******************************** ' WINCE '******************************** FolderPath = "\Storage Card SD\AllRecipes" Set fileSysObj = CreateObject("FileCtl.FileSystem") If Err.Number <> 0 Then ShowSystemAlarm "1. " & Err.Number & " " & Err.Description Err.Clear End If If fileSysObj.Dir(FolderPath)="" Then fileSysObj.MkDir(FolderPath) If Err.Number <> 0 Then ShowSystemAlarm "2. " & Err.Number & " " & Err.Description Err.Clear End If End If fileSysObj = Nothing Err.Clear For n = 1 To MaxNumDeRiccete For NumDataSet = 1 To MaxNumArea 'Prendo il Nome del formato n SmartTags("XData\Rcp\File") = FolderPath & "\RECIPE_" & CStr(n) & "_" & CStr(NumDataSet) & ".cvs" ExportDataRecords n, NumDataSet, SmartTags("XData\Rcp\File"), hmiOverwriteAlways, hmiOff, "XData\Rcp\STATUS_NomeSetDati" 'Attendo il Risultato del Formato n Do Until (SmartTags("XData\Rcp\STATUS_NomeSetDati") = 4 Or (SmartTags("XData\Rcp\STATUS_NomeSetDati")) = 12) Loop If Err.Number = 0 Then ShowSystemAlarm (SmartTags("XData\Rcp\NomeSetDati") & " format saved.") Else ShowSystemAlarm "62 " & Err.Number & " " & Err.Description End If Next Next Else '******************************** ' WINDOWS PC '******************************** FolderPath = "C:\FLASH\Recipes" Set fileSysObj = CreateObject("Scripting.FileSystemObject") If Not fileSysObj.FolderExists(FolderPath) Then fileSysObj.CreateFolder FolderPath End If For n = 1 To MaxNumDeRiccete For NumDataSet = 1 To MaxNumArea SmartTags("XData\Rcp\File") = FolderPath & "\RECIPE_" & CStr(n) & "_" & CStr(NumDataSet) & ".cvs" ExportDataRecords n, NumDataSet, SmartTags("XData\Rcp\File"), hmiOverwriteAlways, hmiOff, "XData\Rcp\STATUS_NomeSetDati" 'Attendo il Risultato del Formato n Do Until (SmartTags("XData\Rcp\STATUS_NomeSetDati") = 4 Or (SmartTags("XData\Rcp\STATUS_NomeSetDati")) = 12) Loop If Err.Number = 0 Then ShowSystemAlarm (SmartTags("XData\Rcp\NomeSetDati") & " format saved.") Else ShowSystemAlarm "62 " & Err.Number & " " & Err.Description End If Next Next End If End Sub ```