'______________________________________________________
'
' NoExt$  - palauttaa tiedoston nimen ilman tarkenninta
' vl 27.10.1993
'______________________________________________________

Function NoExt$
  file$ = FileName$()
  p = InStr(1, file$, ".")
  If  p > 0 Then file$ = Left$(file$, p - 1)
  NoExt$ = file$
End Function

'______________________________________________________
'
' NoPath$  - palauttaa tiedoston nimen ilman polkua
' vl 27.10.1993
'______________________________________________________

Function NoPath$(opath$)
' Palauttaa jonon ilman polukuosaa
  path$ = opath$
  i = Len(path$)

  While  (Mid$(path$, i, 1) <> "\")
     i = i - 1
     If (i <= 0) Then Goto poisNoPath
  Wend
poisNoPath:
  NoPath$ = Mid$(path$, i + 1)
End Function

'------------------------------------------------------------
' Sammutetaan ikkunat, joissa .ERR
'______________________________________________________
Sub CloseAllWith(text$)
   filecount = CountWindows()
   textlen = Len(text$)
   For i = 1 To filecount
      name$ = FileNameFromWindow$(i)
      If (Right$(name$, textlen) = text$) Then
        WindowList i
        FileClose 2
      EndIf
    Next i
End Sub

'------------------------------------------------------------
' Sammutetaan edellinen virhe notepad
'______________________________________________________
Sub CloseApplication(command$)
  On Error Resume Next
  AppClose command$
End Sub

Sub MAIN
  a$ = NoExt$
End Sub