Wednesday, June 12, 2019

Naming script for CTD files - MichSave

The missive is a bat script that helps document your CTD samples (to download it use this link). .bat files, are simple text files with a series of instructions of the type you type in windows command line, to make a text file into a script all you need to do is change the file name extension from .txt to. bat. For basic operation, you can watch this screencast:

How to use MichSave

In this post I will explain how the script is used and how to change the script code to suit your need.
To run the script just place it on your disk and double click (you might get a warning message, we all know you trust me).
After clicking a black screen appears:
The MichSave script
CTD sampling are usually not stand alone operations, but they are a part of a scientific project. This is why the script asks you to select a project code from a list. Is your project is not in that list, you can enter a name manually or edit the script (as explained later in this post).
As each project usually includes more than one sampling station, after you enter the project code, the script will ask you for a station name. Type the name of the sampling station and ENTER.
Sea-save will be opened automatically (if not, look into how to change the Sea-Save location later in this post).
Once SeaSave is openned, from the top menu, press "real time data">start>"select output data file name" and then use paste (CTRL+V) and enter. The automatically generated name will now be your output data file name.


How to adjust the script to what I need?
In this section I will go over the script line by line and explain how to adjust the code for your needs. Microsoft notepad  is a software that every windows computer has and is suitable for .bat file editing. Since double clicking will run the script you will have to right click it and choose edit form the drop down list.

Adjusting the date format (lines 10 and 11):


set datetimef= %date:~10,4%%date:~4,2%%date:~7,2%-%time:~0,2%%time:~3,2%%time:~6,2%%time:~0,2%
echo %datetimef%

This line builds a string from the current date and time that will later be a part of the file name. They are depended on the way your system date is set up so you might have to tweak them a bit. This is best done by operating a command prompt (push the WIN key+R>type cmd>enter) then typing each of the parts that creates the script to see what is actually does.
Short screencast here showing how to edit the date

Adjusting the list of projects

line 14 prompts the user to type a number to select a project.


set param=%PROJCODE% 

echo Select project \1-RIME\2-RECO\3-CO Chemical ocean\ 4-OC ocean cruise\ 5-Shira dispersal Or type free text for Project codes line contains the description text of the list of projects


While line 15:

set /p PROJCODE=?


Indicates that once ENTER is pressed, the text the user typed will be stored in a 
variable named PROJCODE.
Next, lines 18 to 48 selects a project from the list of projects based on the number 
the user typed. If no number is typed, the name entered manually is stored in PROJCODE 
and becomes part of the file name.

set param=%PROJCODE%

echo %param%| findstr /r "^[1-9][0-9]*$">nul

if errorlevel 0 (
 if %PROJCODE%==1 goto :1 
 if %PROJCODE%==2 goto :2 
 if %PROJCODE%==3 goto :3 
 if %PROJCODE%==4 goto :4 
 if %PROJCODE%==5 goto :5 
)
set PROJ=%PROJCODE%
goto :selected

:1
set PROJ=RIME
goto :selected
:2
set PROJ=RECO
goto :selected
:3
set PROJ=CO
goto :selected
:4
set PROJ=OC
goto :selected
:5
set PROJ=SHIRA
goto :selected
set /p PROJCODE=now just paste the station name in seasave
:selected
So, if you want to change this section, all you have to do is change the text in line 
15 and the corresponding item on the list:]
line 15:




echo Select project \1-RIME\2-RECO\3-Some New Project.......

And the appropriate menu item:

:3
set PROJ=SomeNewProj
goto :selected

The last lines:


rem ### Run seasave
"C:\Program Files (x86)\Sea-Bird\SeasaveV7\Seasave.exe"

Are running SeaSave, Sometimes, the location of the seasave.exe file is different. In
this case you will have to edit the path to Seasave in the bat file.



1 comment:

  1. How to Make Your Iron-Belly-Spice Finishing - Tioga Downs
    These stainless titanium wood stoves steel steel blades can 오래된 토토 사이트 also be used to create titanium max trimmer the perfect titanium white wheels finishing surface for the Iron-Belly-Spice Finishing. oakley titanium glasses The Finishing

    ReplyDelete