Constructing File Names From Variables


I’m working with a SNAP-PAC-R2-W (Update 9.4b) which is the brain of the quality control testing machine at my workplace. That system works fine, but we’re in the process of expanding its functionality so that it will write the results of the tests to files. I want each test’s data to be written to different files, with the date/time of the test as the title, so that it’s easy to find one specific test, and we don’t end up with one immense file.

After adding the command to write these dynamic file names, I got a syntax error at the following line, at or around “Station0_Data_File”, which is the Communication Handle.

Station0_Data_File = “file:w,sdcard0/station0/” + DateReadout + " - " + TimeReadout + “.csv”;

So my question is twofold,

  1. Is it actually possible to write file names in this manner? I’ve heard there is an 8 char limit, but I’ve also heard that newer firmware versions do not have this limitation.
  2. If so, what is the correct format for writing file names in this manner? I cannot identify the syntax error that PAC Control is upset with, and I’ve never tried to do this before.

Any insight is much appreciated.

To get rid of the syntax error, you’ll for sure need to use the Communication command called: SetCommunicationHandleValue (the direct assignment you did there only works with strings, not comm handles). I think you’ll need another / just before the sdcard0/… too, but you’re so close, on the right track. Also don’t forget that our support is free! (best to email,