Until recently, this code worked perfectly:
SelectedChannels = "'Metric Values/Metrics', 'Metric Values/Values'" DataFileName = PicPath & "\" & DataSetName & ".csv" T1 = "<filename>" & DataFileName & "</filename><decimalpoint>.</decimalpoint><delimiter>,</delimiter>" Call DataFileSaveSel(T1, "CSV", SelectedChannels)
It would save a CSV file containing the two channels I wanted, and with a full-stop decimal point and a comma delimiter. However, I now have a new laptop and have moved from Windows 7 to Windows 10 and onto which I have installed my old faithful DIAdem 2011. Now, the above code doesn't work and I get an error message saying 'Cannot create storage target'. Weirdly, it also changes the filename to 'delimiter', even though it doesn't save.
Are the <filename>, <decimalpoint> and <delimiter> keywords particular to DIAdem or do other applications use the same language? I cannot find anything on the internet that refers to the use of these keywords, other than DIAdem help pages. That said, the DIAdem help files themselves don't refer to them at all.
If I just use DataFileName in DataFileSaveSel then it works perfectly. However, I then don't get the delimiter that I want. This suggests that it's the keywords that are the problem, or the way I'm using them.
Does anyone have any clues as to why this extremely useful piece of code doesn't work anymore?
I can imagine the frustration that your code is no longer working! I just wanted to let you know that I'm going to try to replicate the issue you've been seeing on my machine. Do I only need this script or is there anything dependent on it that I require?
I thought I should also mention that DIAdem 2011 is not officially supported on Windows 10 (National Instruments Product Compatibility for Microsoft Windows 10). This could be contributing to the issue you've been having, however, it may well be that it could work just fine, even without official support.
Thanks for volunteering to have a go at the problem. As to whether there is anything else you need, not as far as I'm aware. Although, that is possibly the point - there may be some difference between the two laptops that I'm not aware of and that is causing the problem.
I have discovered some extra information about the problem - maybe it will help someone to solve it.
By accident I was reading about xml files and low and behold the file structure uses tagged markup of the form <filename> for start tags and </filename> for end tags. Perhaps it is xml that is being used in DIAdem scripts to modify the output of files saved using DataFileSaveSel??
I checked the error message that I was receiving and the log file and they both show that DIAdem is changing the forward slash in the end tag for a backward slash, and thus confusing it for a filename.
The logfile message is:
283 15:45:54 Error:
Error in <Parking Effort.VBS> (Line: 595, Column: 1):
Cannot create storage target.
File: <filename>C:\Users\blah_bah\SPE Sample_proc.csv<\filename><decimalpoint>.<\decimalpoint><delimiter>,<\delimiter>
The error message is the same:
But, the line of code in my script is:
T1 = "<filename>" & DataFileName & "</filename><decimalpoint>.</decimalpoint><delimiter>,</delimiter>"
Note the change in slash direction in each end tag!
Is there some strange setting in DIAdem that I've missed when installing it on my new laptop?
Can it be Windows that is interfering?
normally expects a filepath.
The <filename> allows to pypass some parameters to the plugin used to store.
This wasn't active for all DIAdem version.
please check your DIAdem version.
Important is to have the same DIAdem Version number and a equal or newer NI-USI version.
Please check the version numbers on your original machine. I assume there are differences. However I do not know when this config option was introduces.
Thanks for the response. Both machines had DIAdem installed from the same disc and should be identical installations. I don't have the old machine anymore so can't prove the version numbers, but here's what I have from the new machine:
Weirdly, pressing System Info... reveals:
I expected that to say Windows 10 Pro!
I am using a full path in DataFileSaveSel.
I'm afraid I don't know what you mean by saying that <filename> allows you to bypass some parameters to the plugin. Are you suggesting I should avoid using the <filename> tag and just use <decimalpoint> and <delimiter> in DataFileSaveSel?
The XML like string is an option to create user specific CSV files since a long time.
I am not sure when it was introduced but it is not related to the Operating system.
In your case your DIAdem does not realize the tags inside the string. It just assumes it is a path.
If excactly this script worked on your old machine the DIAdem versions is definitively different.
Is the script really identical?
In DIAdem 2018, we introduced the CSVExportParameter to allow an easier to understand way.
As far as I can tell, the script is identical (I wrote it only a few months ago and have simply reused it on the new laptop) and so is the installation.
In an earlier reply, you referred to versions of DIAdem and NI-USI. Are mine ok?
I have tried various combinations of string within DataFileSaveSel and they all produce the same result. You can see from my first post that the string T1 is correct when created and not correct in the error report. Thus, this problem is not due to the script.
Option Explicit dim selChns : selChns = "'/', '/'" dim filePath : filePath = TmpDrv & "save_custom_csv.csv" dim paramString : paramString = "<filename>" & replace(filePath, "&", "&") & "</filename><decimalpoint>.</decimalpoint><delimiter>,</delimiter>" Call DataFileSaveSel(paramString, "CSV", selChns)
works with DIAdem 2015 which is the oldest version I have.
If it does not work on yur machine and worked before, there has been a different version installed.
P.S.: If you path conatins an & this would also cause issues and needs to be escaped.