DIAdem

cancel
Showing results for 
Search instead for 
Did you mean: 

Truncating a filename, replacing datasetcomment values

Hello,
 
I am realitvely new to Diadem (using v10) and vbscript and I am having a problem.   I have many .tdm files which need to be loaded, then data from the datasetcomments is to be read then saved in the new filename.  
 
The problem I am having is that I am using FileDlgName in the process of opening a dialog box to ask for a file.   If I then want to resave this file using that original FileDlgName, but without the last 4 letters (ie, without the .tdm extension) and then add a bit of info.   ie. original is text.tdm and the new saved file is currently the output gives text.tdm_a_bit_more.tdm, and I would like it to say text_a_bit_more.tdm...I'm not really sure what to do!
 
I have tried using:
 
'Dialog box for entering filename
Call FileNameGet("Navigator","FileRead", "*.TDM")
Call DATAFILELOAD(FileDlgName)  'loads whatever data file is selected
 
'then to remove the .tdm part
dim filename = [(FileDlgName)]                       'declares an array
dim nameOnly = Left(filename,Len(filename)-4) 
 
but this doesnt seem to work!  any ideas please?
 
 
I am also wondering if anyone knows how I can changed data from a dataset comment, eg. if datasetcomment(1) was 1-2-3, how would I replace the - with a _, ie so datasetcomment(1) read 1_2_3   , so I can then use this value in the filename.
 
I currently don't have any problems inputting the standard datasetcomment(1) into the filename.
 
Many thanks in advance for any help
0 Kudos
Message 1 of 5
(3,308 Views)

Hi sicla,

What you want to use is the variables "FileDlgDir" and "FileDlgFile" instead of the variable "FileDlgName".

Regards,
Brad Turpin
DIAdem Product Support Engineer
National Instruments

0 Kudos
Message 2 of 5
(3,296 Views)
many thanks, I got that part working now.
 
anyone any tips on replacing - in the file name with _ please (or a space with a _)?   I realise this has sort have been answered before, but I'm having difficulty finding the correct "replace" term to use with this FileDlgFile term.
 
thanks again 
0 Kudos
Message 3 of 5
(3,294 Views)

and do i need to use the - and _ in chr(number) form?

many thanks

0 Kudos
Message 4 of 5
(3,291 Views)
ive solved it myself, thanks
 
ps if anyone ever needs it, here's a good website - http://www.danbbs.dk/~erikoest/asciicc.htm, the numbers in the dec column are the chr numbers required
0 Kudos
Message 5 of 5
(3,289 Views)