| T O P I C R E V I E W |
| kaiousama |
Posted - 09/09/2004 : 04:21:37 AM I'd like to rename a worksheet according to the name of the file i imported in it. I have the filename with its full path obtained from the opendialog in %A variable:
FDLog.get[%A,1];
Is there a way to parse the filename without its path & file extension? (for instance i have "c:\test\MyFile.abf" in %A and i want to parse the substring "MyFile" from it)
Thanks.
Origin Version : 6.0 Operating System: winXP |
| 4 L A T E S T R E P L I E S (Newest First) |
| kaiousama |
Posted - 09/09/2004 : 12:16:43 PM Automating renaming is an option avaible for ASCII import but i have to import .abf Axon files. |
| Mike Buess |
Posted - 09/09/2004 : 10:14:52 AM Thanks for correction. But why not use automatic renaming?
Mike Buess Origin WebRing Member |
| kaiousama |
Posted - 09/09/2004 : 09:16:40 AM Thanks Mike, your code had a couple of imprecisions but the basic principle works like a charm ;) I've attached the corrected code if someone else need it:
FDLog.get(%A,1); for(i=%[%A];i>1;i--) {if("%[%A,i:i]"=="\") break}; // Find last slash position %A=%[%A,>i+1]; // Parse file name %A=%[%A,'.']; // Strip extension win -r %H %A; // Rename worksheet
|
| Mike Buess |
Posted - 09/09/2004 : 07:15:54 AM That can be done automatically through ASCII Options... click the Other Options button and check 'Rename Worksheet to Data File Name'.
If for some reason that doesn't work you can do this...
for(i=%[%A];i>1;i--) {if("%[%1,i:i]"=="\") break}; %A=%[%A,>i+i]; // file name %A=%[%A,'.']; // strip extension
Mike Buess Origin WebRing Member |