-
- Posts: 65
- Joined: Mon May 30, 2011 1:40 pm
I'm trying to program a macro for Chemstation to automatically set the name of the sequence directories as: date01 (e.g. 12033101 for 31st March 2012), date2, etc.
I have written this macro based on the macro from Cyril Messager (C) (http://cyril.messager.free.fr/index.php ... macro.html). I have problems because I cannot obtain the names as I would really like, I can only obtain names as: 2033101 (maximum 7 characters).
Does anyone know why it is not possible to get directories as mentioned before (e.g. 1203311, etc.), with 8 characters (the limiting length for names in Chemstation...)?
Here is the macro:
Name MYSTSBDR
!******************************************************************************
! It updates automatically the data subdirectory.
! When the sequence starts a blank subdir field will
! trigger a start at date01; e.g. "2033101"
! (20331 refer to 31st March 2012)
! If date01 exists, it sets the subdir to date02, etc.
!
! Based on the macro from Cyril Messager (C), cyril.messager@wanadoo.fr
!******************************************************************************
Local Counter, CurDate$
CurDate$ = Date$()
!It isn't posible to create more than 09 directories if date is written as below
!although the total number of characters would be 8 for 99 sequences (?).
!CurDate$ = CurDate$[7:8] + CurDate$[1:2] + CurDate$[4:5]
CurDate$ = CurDate$[8:8] + CurDate$[1:2] + CurDate$[4:5]
counter = 1
WHILE(FileStat(Mode,_DataPath$ + CurDate$ + "0" + Val$(counter)) = 2) DO
counter = counter + 1
If counter = 10 then
WHILE(FileStat(Mode,_DataPath$ + CurDate$ + Val$(counter)) = 2) DO
counter = counter + 1
ENDWHILE
EndIf
ENDWHILE
If counter <10
MkDir _DataPath$ + CurDate$ + "0" + Val$(counter)
_DATASEQSUBDIR$ = CurDate$ + "0" + Val$(counter)
Else
MkDir _DataPath$ + CurDate$ + Val$(counter)
_DATASEQSUBDIR$ = CurDate$ + Val$(counter)
EndIf
SaveSeqParams
EndMacro
SetHook "PreSeq", "MYSTSBDIR"