omron — 3-1-11 File Handling

Coffee Machine scenario SECTION 3 Advanced Tutorial 6. Add a button to manually restart logging using the command " StopLogging("Dataset1") " 7. Add a 'Close' button with an animation to close the page. 8. Open Main page and add an animation to the "Data Logging" button to display the new page called Datalog . 3-1-11 File Handling We'll add a file handling page allowing the selected drink to be written to a file on disk. The file format will look like this: 03:42:52 10/30/2002 - User Selection: 14 03:44:28 10/30/2002 - User Selection: 22 03:53:28 10/31/2002 - User Selection: 16 First add the points required by this step. Then write the subroutine to do the work.

This subroutine should be called every time a drink is made. 1, 2, 3… 1. At the Project level, add a subroutine script called WriteToDisk 2. Add an integer parameter called sel . aux_text2 = ValueToText( selection ) aux_text = $Time + " "+ $Date+ " - User selection: "+aux_text2 ret = WriteMessage("selections.txt", -1, aux_text, true) 3. Add script code to Make the Drink script to call the new subroutine. Add the detail to the File Handling page: 1, 2, 3… 1. Make a new page with the following properties: Page Title = File Border Style = THICK Display Mode = POPUP Top = 0 Left = 505 Height = 582 Width = 295 2. Use the Workspace to remove the Display On Run option from the popup menu.

32 Point name Point type Default Value Description (optional) aux text2 _ Text Temporary text area for conversions fileindex Integer Index to current position in text file filename Text Name of text file to read from. ret Integer General purpose 'return' value from various script functions