{"id":3847,"date":"2025-04-21T12:33:33","date_gmt":"2025-04-21T12:33:33","guid":{"rendered":"https:\/\/webprojects.cloud\/wordpress\/splatco\/?post_type=spl_knowledgebase&#038;p=3847"},"modified":"2025-06-10T06:27:39","modified_gmt":"2025-06-10T06:27:39","slug":"fileopenfilename-mode-hash-function","status":"publish","type":"spl_knowledgebase","link":"https:\/\/webprojects.cloud\/wordpress\/splatco\/knowledgebase\/deprecated\/hmi_log-hash-command\/fileopenfilename-mode-hash-function\/","title":{"rendered":"# FileOpen(FileName, Mode) hash function"},"content":{"rendered":"\n<p>Valid for use with hash command:&nbsp;<code><a href=\"https:\/\/webprojects.cloud\/wordpress\/splatco\/knowledgebase\/deprecated\/hmi_log-hash-command\/\">HMI_Log<\/a><\/code><\/p>\n\n\n\n<p>This function serves multiple purposes:<\/p>\n\n\n\n<ol class=\"wp-block-list\">\n<li>Selecting the base of a file name to be used for subsequent logging operations.<\/li>\n\n\n\n<li>Creating an initial file with the given name.<\/li>\n\n\n\n<li>Setting the mode to use with the file name.<\/li>\n\n\n\n<li>Subsequently, switching between log files.<\/li>\n<\/ol>\n\n\n\n<p>The first time a file is to be opened in a session of&nbsp;<a href=\"https:\/\/webprojects.cloud\/wordpress\/splatco\/knowledgebase\/glossary-of-terms\/#o5380\">SimpleHMI<\/a>, the&nbsp;<code>Mode<\/code>&nbsp;must be specified. Any subsequent uses of the&nbsp;<code>Mode<\/code>&nbsp;argument are unnecessary, and ignored. You can have up to 20 log files on the go at once. Any log data from the SPLat (host) will be saved to the file last mentioned in a&nbsp;<code>FileOpen<\/code>, thus the&nbsp;<code>FileOpen<\/code>&nbsp;function serves to switch between files. You may for example use one file to log temperature every second and another to log manual interventions by an&nbsp;<a href=\"https:\/\/webprojects.cloud\/wordpress\/splatco\/knowledgebase\/glossary-of-terms\/#o5369\">Enduser<\/a>.<\/p>\n\n\n\n<p>The safest policy is to do a&nbsp;<code>FileOpen<\/code>&nbsp;just before each write to a file, and also during the Connect event handler, and to include the mode every time.<\/p>\n\n\n\n<h6 class=\"wp-block-heading\">FileName<\/h6>\n\n\n\n<p>The&nbsp;<code>FileName<\/code>&nbsp;should be a simple file name, without a directory\/folder path. It may optionally contain a file name extension. Examples are:<\/p>\n\n\n\n<p><code>MyFile.txt<\/code><\/p>\n\n\n\n<p><code>MyFile<\/code><\/p>\n\n\n\n<p>The first of those includes an extension, which will be used when the file is written. The second contains no extension. SimpleHMI will default it to&nbsp;<code>.log<\/code>.<\/p>\n\n\n\n<p>Note: Windows is insensitive to case, so&nbsp;<code>MyFile<\/code>,&nbsp;<code>myfile<\/code>&nbsp;and&nbsp;<code>MYfIle<\/code>&nbsp;are all equivalent. The Android file system&nbsp;<em>is<\/em>&nbsp;case sensitive. The SimpleHMI shares code between Windows and Android, and is internally case-insensitive. If you vary the case between references, the results in Android could be unpredictable.<\/p>\n\n\n\n<h6 class=\"wp-block-heading\">Mode<\/h6>\n\n\n\n<p>The mode controls the automatic generation of date codes and sequence numbers as part of the file name written to disk\/SD card according to the following table:.<\/p>\n\n\n\n<figure class=\"wp-block-table\"><table><tbody><tr><th>Mode<\/th><th>Description<\/th><th>Behaviour when SimpleHMI is first started<\/th><th>Effect of&nbsp;<code><a href=\"https:\/\/webprojects.cloud\/wordpress\/splatco\/knowledgebase\/deprecated\/hmi_log-hash-command\/newfilefilename-hash-function\/\">NewFile(FileName)<\/a><\/code>&nbsp;hash function<\/th><\/tr><tr><td>0<\/td><td>Plain. The base name is used as-is. The base name may not include the character pairs<\/td><td>Data is appended to any existing file with this name.<\/td><td>The existing file will be overwritten on the next&nbsp;<code><a href=\"https:\/\/webprojects.cloud\/wordpress\/splatco\/knowledgebase\/deprecated\/hmi_log-hash-command\/logwrite-hash-function\/\">LogWrite<\/a><\/code>&nbsp;to this file.<\/td><\/tr><tr><td>1<\/td><td>Dated. A date stamp is automatically included in the file name. The form is<\/td><td>Data is appended to any existing file with this name.<\/td><td>If an existing file of the same base name has today&#8217;s date, it will be overwritten on the next&nbsp;<code><a href=\"https:\/\/webprojects.cloud\/wordpress\/splatco\/knowledgebase\/deprecated\/hmi_log-hash-command\/logwrite-hash-function\/\">LogWrite<\/a><\/code>&nbsp;to this file, and old data will be lost. Otherwise a new file will be created with today&#8217;s date.<\/td><\/tr><tr><td>2<\/td><td>Numbered. A sequence number is automatically included in the file name. The form is<\/td><td>On the next&nbsp;<code><a href=\"https:\/\/webprojects.cloud\/wordpress\/splatco\/knowledgebase\/deprecated\/hmi_log-hash-command\/logwrite-hash-function\/\">LogWrite<\/a><\/code>&nbsp;to this file base name the number will be incremented.<\/td><td>On the next&nbsp;<code><a href=\"https:\/\/webprojects.cloud\/wordpress\/splatco\/knowledgebase\/deprecated\/hmi_log-hash-command\/logwrite-hash-function\/\">LogWrite<\/a><\/code>&nbsp;to this file base name the number will be incremented.<\/td><\/tr><tr><td>3<\/td><td>Dated and numbered, for example<\/td><td>If the existing file of the same base name has today&#8217;s date, then on the next&nbsp;<code><a href=\"https:\/\/webprojects.cloud\/wordpress\/splatco\/knowledgebase\/deprecated\/hmi_log-hash-command\/logwrite-hash-function\/\">LogWrite<\/a><\/code>&nbsp;to this file base name the number will be incremented.<\/td><td>If the existing file of the same base name has today&#8217;s date, then on the next&nbsp;<code><a href=\"https:\/\/webprojects.cloud\/wordpress\/splatco\/knowledgebase\/deprecated\/hmi_log-hash-command\/logwrite-hash-function\/\">LogWrite<\/a><\/code>&nbsp;to this file base name the number will be incremented.<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<h6 class=\"wp-block-heading\">The logging directory\/folder<\/h6>\n\n\n\n<p>The folder used to save log files is not controller from the SPLat.<\/p>\n\n\n\n<p>In Android the log files are always written to a default directory. When you plug the Android device into a computer via USB the files will be in a directory named&nbsp;<code>SimpleHMI\/logging<\/code>. No user action, short of removing the SD card from the device, can stop logging.<\/p>\n\n\n\n<p>In Windows the enduser must select a folder for log files to be stored in. If no folder has been selected, SimpleHMI will prompt the enduser for one, just once. The selected folder is remembered between sessions, and may be changed in the Settings tab. If none has been selected the system will ask the enduser to select a folder. If no folder is selected, logging is impossible and log data is ignored.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Valid for use with hash command:&nbsp;HMI_Log This function serves multiple purposes: The first time a file is to be opened in a session of&nbsp;SimpleHMI, the&nbsp;Mode&nbsp;must&#8230;<\/p>\n","protected":false},"author":1,"featured_media":0,"parent":3814,"menu_order":1,"template":"","class_list":["post-3847","spl_knowledgebase","type-spl_knowledgebase","status-publish","hentry"],"acf":[],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v25.6 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title># FileOpen(FileName, Mode) hash function - SPLat Controls<\/title>\n<meta name=\"robots\" content=\"noindex, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"# FileOpen(FileName, Mode) hash function - SPLat Controls\" \/>\n<meta property=\"og:description\" content=\"Valid for use with hash command:&nbsp;HMI_Log This function serves multiple purposes: The first time a file is to be opened in a session of&nbsp;SimpleHMI, the&nbsp;Mode&nbsp;must...\" \/>\n<meta property=\"og:url\" content=\"https:\/\/webprojects.cloud\/wordpress\/splatco\/knowledgebase\/deprecated\/hmi_log-hash-command\/fileopenfilename-mode-hash-function\/\" \/>\n<meta property=\"og:site_name\" content=\"SPLat Controls\" \/>\n<meta property=\"article:modified_time\" content=\"2025-06-10T06:27:39+00:00\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data1\" content=\"3 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\/\/webprojects.cloud\/wordpress\/splatco\/knowledgebase\/deprecated\/hmi_log-hash-command\/fileopenfilename-mode-hash-function\/\",\"url\":\"https:\/\/webprojects.cloud\/wordpress\/splatco\/knowledgebase\/deprecated\/hmi_log-hash-command\/fileopenfilename-mode-hash-function\/\",\"name\":\"# FileOpen(FileName, Mode) hash function - SPLat Controls\",\"isPartOf\":{\"@id\":\"https:\/\/webprojects.cloud\/wordpress\/splatco\/#website\"},\"datePublished\":\"2025-04-21T12:33:33+00:00\",\"dateModified\":\"2025-06-10T06:27:39+00:00\",\"breadcrumb\":{\"@id\":\"https:\/\/webprojects.cloud\/wordpress\/splatco\/knowledgebase\/deprecated\/hmi_log-hash-command\/fileopenfilename-mode-hash-function\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/webprojects.cloud\/wordpress\/splatco\/knowledgebase\/deprecated\/hmi_log-hash-command\/fileopenfilename-mode-hash-function\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/webprojects.cloud\/wordpress\/splatco\/knowledgebase\/deprecated\/hmi_log-hash-command\/fileopenfilename-mode-hash-function\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/webprojects.cloud\/wordpress\/splatco\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Deprecated\",\"item\":\"https:\/\/webprojects.cloud\/wordpress\/splatco\/knowledgebase\/deprecated\/\"},{\"@type\":\"ListItem\",\"position\":3,\"name\":\"# HMI_Log hash command\",\"item\":\"https:\/\/webprojects.cloud\/wordpress\/splatco\/knowledgebase\/deprecated\/hmi_log-hash-command\/\"},{\"@type\":\"ListItem\",\"position\":4,\"name\":\"# FileOpen(FileName, Mode) hash function\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/webprojects.cloud\/wordpress\/splatco\/#website\",\"url\":\"https:\/\/webprojects.cloud\/wordpress\/splatco\/\",\"name\":\"SPLat Controls\",\"description\":\"OEM Embedded Machine Controllers\",\"publisher\":{\"@id\":\"https:\/\/webprojects.cloud\/wordpress\/splatco\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/webprojects.cloud\/wordpress\/splatco\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\/\/webprojects.cloud\/wordpress\/splatco\/#organization\",\"name\":\"SPLat Controls\",\"url\":\"https:\/\/webprojects.cloud\/wordpress\/splatco\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/webprojects.cloud\/wordpress\/splatco\/#\/schema\/logo\/image\/\",\"url\":\"https:\/\/webprojects.cloud\/wordpress\/splatco\/wp-content\/uploads\/2024\/10\/logo.svg\",\"contentUrl\":\"https:\/\/webprojects.cloud\/wordpress\/splatco\/wp-content\/uploads\/2024\/10\/logo.svg\",\"caption\":\"SPLat Controls\"},\"image\":{\"@id\":\"https:\/\/webprojects.cloud\/wordpress\/splatco\/#\/schema\/logo\/image\/\"}}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"# FileOpen(FileName, Mode) hash function - SPLat Controls","robots":{"index":"noindex","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"og_locale":"en_US","og_type":"article","og_title":"# FileOpen(FileName, Mode) hash function - SPLat Controls","og_description":"Valid for use with hash command:&nbsp;HMI_Log This function serves multiple purposes: The first time a file is to be opened in a session of&nbsp;SimpleHMI, the&nbsp;Mode&nbsp;must...","og_url":"https:\/\/webprojects.cloud\/wordpress\/splatco\/knowledgebase\/deprecated\/hmi_log-hash-command\/fileopenfilename-mode-hash-function\/","og_site_name":"SPLat Controls","article_modified_time":"2025-06-10T06:27:39+00:00","twitter_card":"summary_large_image","twitter_misc":{"Est. reading time":"3 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/webprojects.cloud\/wordpress\/splatco\/knowledgebase\/deprecated\/hmi_log-hash-command\/fileopenfilename-mode-hash-function\/","url":"https:\/\/webprojects.cloud\/wordpress\/splatco\/knowledgebase\/deprecated\/hmi_log-hash-command\/fileopenfilename-mode-hash-function\/","name":"# FileOpen(FileName, Mode) hash function - SPLat Controls","isPartOf":{"@id":"https:\/\/webprojects.cloud\/wordpress\/splatco\/#website"},"datePublished":"2025-04-21T12:33:33+00:00","dateModified":"2025-06-10T06:27:39+00:00","breadcrumb":{"@id":"https:\/\/webprojects.cloud\/wordpress\/splatco\/knowledgebase\/deprecated\/hmi_log-hash-command\/fileopenfilename-mode-hash-function\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/webprojects.cloud\/wordpress\/splatco\/knowledgebase\/deprecated\/hmi_log-hash-command\/fileopenfilename-mode-hash-function\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/webprojects.cloud\/wordpress\/splatco\/knowledgebase\/deprecated\/hmi_log-hash-command\/fileopenfilename-mode-hash-function\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/webprojects.cloud\/wordpress\/splatco\/"},{"@type":"ListItem","position":2,"name":"Deprecated","item":"https:\/\/webprojects.cloud\/wordpress\/splatco\/knowledgebase\/deprecated\/"},{"@type":"ListItem","position":3,"name":"# HMI_Log hash command","item":"https:\/\/webprojects.cloud\/wordpress\/splatco\/knowledgebase\/deprecated\/hmi_log-hash-command\/"},{"@type":"ListItem","position":4,"name":"# FileOpen(FileName, Mode) hash function"}]},{"@type":"WebSite","@id":"https:\/\/webprojects.cloud\/wordpress\/splatco\/#website","url":"https:\/\/webprojects.cloud\/wordpress\/splatco\/","name":"SPLat Controls","description":"OEM Embedded Machine Controllers","publisher":{"@id":"https:\/\/webprojects.cloud\/wordpress\/splatco\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/webprojects.cloud\/wordpress\/splatco\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/webprojects.cloud\/wordpress\/splatco\/#organization","name":"SPLat Controls","url":"https:\/\/webprojects.cloud\/wordpress\/splatco\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/webprojects.cloud\/wordpress\/splatco\/#\/schema\/logo\/image\/","url":"https:\/\/webprojects.cloud\/wordpress\/splatco\/wp-content\/uploads\/2024\/10\/logo.svg","contentUrl":"https:\/\/webprojects.cloud\/wordpress\/splatco\/wp-content\/uploads\/2024\/10\/logo.svg","caption":"SPLat Controls"},"image":{"@id":"https:\/\/webprojects.cloud\/wordpress\/splatco\/#\/schema\/logo\/image\/"}}]}},"_links":{"self":[{"href":"https:\/\/webprojects.cloud\/wordpress\/splatco\/wp-json\/wp\/v2\/spl_knowledgebase\/3847","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/webprojects.cloud\/wordpress\/splatco\/wp-json\/wp\/v2\/spl_knowledgebase"}],"about":[{"href":"https:\/\/webprojects.cloud\/wordpress\/splatco\/wp-json\/wp\/v2\/types\/spl_knowledgebase"}],"author":[{"embeddable":true,"href":"https:\/\/webprojects.cloud\/wordpress\/splatco\/wp-json\/wp\/v2\/users\/1"}],"up":[{"embeddable":true,"href":"https:\/\/webprojects.cloud\/wordpress\/splatco\/wp-json\/wp\/v2\/spl_knowledgebase\/3814"}],"wp:attachment":[{"href":"https:\/\/webprojects.cloud\/wordpress\/splatco\/wp-json\/wp\/v2\/media?parent=3847"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}