EnableExplicit

CompilerIf #ctSSLayer_CompiledFeature_CD_AndOr_CDDA
  Procedure.s GetTrackNumber(FileName.s)
    Define.l xLong1
    Define.l xLong2
    Define.s GetTrackNumber
    
    xLong1 = Len(FileName) - 4
    While xLong2 < xLong1
      xLong2 = xLong2 + 1
      If Not FindString("0123456789", Mid(FileName, xLong2, 1), 1) = 0
        FileName = Mid(FileName, xLong2, Len(FileName) + 1 - xLong2)
        xLong1 = xLong1 - xLong2 + 2
        xLong2 = 1
        While xLong2 < xLong1
          xLong2 = xLong2 + 1
          If FindString("0123456789", Mid(FileName, xLong2, 1), 1) = 0
            Break
            EndIf
          Wend
        If Not xLong2 = 1
          GetTrackNumber = Left(FileName, xLong2 - 1)
          EndIf
        EndIf
      Wend
    ProcedureReturn GetTrackNumber
    EndProcedure
  CompilerEndIf


; IDE Options = PureBasic 4.51 (Windows - x86)
; CursorPosition = 3
; Folding = -
; DisableDebugger
; CompileSourceDirectory