and im now setting up the rigging to get this working. This is the cleanup of the CSV part that im working on since FIT to CSV is already provided. This is written in windows powershell by me, just now with some ripping off of the select-file function and time conversion. It will read the garmin converted CSV and output it into normal looking stuff on the screen in the command window. I'll have it output to a file, im just getting through proof of concept now.
My intended workflow is this... Plug garmin directly into PC. Take the .FIT files and drag + drop them onto a shortcut, out comes nicely formatted text file with all the information i need. this isnt quite there yet... but its pretty dang close.
*edit*
made it output to file (that you name) and you can batch select multiple files at once. Now onto getting the fit to csv workflow going to have this a 1 step operation.
*EDIT*
This should be pretty complete now. Can batch select many sessions and convert them all to readable txt as well as CSV (keeps both copies in "results" folder)
My intended workflow is this... Plug garmin directly into PC. Take the .FIT files and drag + drop them onto a shortcut, out comes nicely formatted text file with all the information i need. this isnt quite there yet... but its pretty dang close.
*edit*
made it output to file (that you name) and you can batch select multiple files at once. Now onto getting the fit to csv workflow going to have this a 1 step operation.
Code:
cls
Add-Type -AssemblyName System.Windows.Forms
function Select-File {
[CmdletBinding()]
param(
[Parameter(ParameterSetName="Single")]
[Parameter(ParameterSetName="Multi")]
[Parameter(ParameterSetName="Save")]
[string]$StartingFolder = [environment]::getfolderpath("mydocuments"),
[Parameter(ParameterSetName="Single")]
[Parameter(ParameterSetName="Multi")]
[Parameter(ParameterSetName="Save")]
[string]$NameFilter = "All Files (*.*)|*.*",
[Parameter(ParameterSetName="Single")]
[Parameter(ParameterSetName="Multi")]
[Parameter(ParameterSetName="Save")]
[switch]$AllowAnyExtension,
[Parameter(Mandatory=$true,ParameterSetName="Save")]
[switch]$Save,
[Parameter(Mandatory=$true,ParameterSetName="Multi")]
[Alias("Multi")]
[switch]$AllowMulti
)
if ($Save) {
$Dialog = New-Object -TypeName System.Windows.Forms.SaveFileDialog
} else {
$Dialog = New-Object -TypeName System.Windows.Forms.OpenFileDialog
if ($AllowMulti) {
$Dialog.Multiselect = $true
}
}
if ($AllowAnyExtension) {
$NameFilter = $NameFilter + "|All Files (*.*)|*.*"
}
$Dialog.Filter = $NameFilter
$Dialog.InitialDirectory = $StartingFolder
[void]($Dialog.ShowDialog())
$Dialog.FileNames
}
$fit = (Select-File -StartingFolder "C:\" -NameFilter "Garmin FIT Files (*.fit)|*.fit" -AllowMulti)
copy $fit .\fit_Temp
$fit_temp = get-childitem -Path .\fit_temp | select-object fullname
foreach ($fitfile in $fit_temp)
{
$fit3 = $fitfile.fullname
$fit2 = "`"$fit3`""
start-process -filepath '.\java\fittocsv.bat' -argumentlist $fit2 -wait
}
move-item -path .\fit_temp\*.csv -destination .\results\
$csv1 = import-csv (get-childitem -Path .\Results\*.csv)
$customarray = @()
foreach ($csv in $csv1)
{
$time = (([System.DateTimeOffset]::FromUnixTimeSeconds($time_hack)).DateTime.ToLocalTime()).ToString("s")
$type = $csv.type
$localnumber = $csv."local number"
if ($type -eq "Data" -and $localnumber -eq "3")
{
$min = ($csv."Value 2" / 304.79999025)
$max = ($csv."Value 3" / 304.79999025)
$average = ($csv."Value 4" / 304.79999025)
$shots = $csv."Value 6"
$time_hack=$csv."Value 1"
$extreme_spread= ($max - $min)
Write-host "Session Time/Date:", $time
Write-host "# of Shots:", $shots
Write-host " "
Write-host "Min:", $min
Write-host "Max:", $max
Write-host "Average:", $average
Write-host "Extreme Spread:", $extreme_spread
write-host " "
write-host " "
write-host " "
$Session_name = Read-Host -Prompt "Enter Session Name"
Write-output "Session Time: $time" | out-file -filepath .\Results\$Session_name.txt -Append
Write-output "# of Shots: $shots" | out-file -filepath .\Results\$Session_name.txt -Append
Write-output "Min: $min" | out-file -filepath .\Results\$Session_name.txt -Append
Write-output "Max: $max" | out-file -filepath .\Results\$Session_name.txt -Append
Write-output "Average: $average" | out-file -filepath .\Results\$Session_name.txt -Append
Write-output "Extreme Spread: $extreme_spread" | out-file -filepath .\Results\$Session_name.txt -Append
Write-output " " | out-file -filepath .\Results\$Session_name.txt -Append
}
# $customarray = @()
# $line = "" | select min,max,average,sessiontime,time,velocity,shotnum
# $line.min = $min
# $line.max = $max
# $line.average = $average
# $line.sessiontime = $time
# $line.shotnum = $shot_num
# $line.time = $time1
# $line.velocity = ($speed / 304.79999025)
if ($type -eq "Data" -and $localnumber -eq "4")
{
$shot_num = $csv.'Value 3'
$speed = ($csv.'Value 2' / 304.79999025)
$time_hack1=$csv."value 1"
$time1 = (([System.DateTimeOffset]::FromUnixTimeSeconds($time_hack1)).DateTime.ToLocalTime()).ToString("s")
Write-output " " | out-file -filepath .\Results\$Session_name.txt -Append
Write-output "Shot #: $shot_num" | out-file -filepath .\Results\$Session_name.txt -Append
Write-output "Speed: $speed" | out-file -filepath .\Results\$Session_name.txt -Append
Write-output "Time of Shot: $time1" | out-file -filepath .\Results\$Session_name.txt -Append
Write-output " " | out-file -filepath .\Results\$Session_name.txt -Append
}
}*EDIT*
This should be pretty complete now. Can batch select many sessions and convert them all to readable txt as well as CSV (keeps both copies in "results" folder)

