# encoding: ascii
# api: powershell
# title: Get-TranscriptFilePath
# description: Get the name of the current (or last) transcription file used in the current session. Requires powershell v2.0. Some things to note: 
# version: 0.1
# type: function
# author: Oisin Grehan
# license: CC0
# function: Get-TranscriptFilePath
# x-poshcode-id: 2423
# x-archived: 2015-07-24T21:12:21
# x-published: 2011-12-27T08:02:00
#
# - it’s an empty string if you have not yet used transcription in the current session – if transcribing, it contains the current transcription file path – if you have previously transcribed and now stopped, it does not revert to an empty string
# On this last point, this means a non-empty transcript file path does not mean you are currently transcribing.
#
#requires -version 2.0

function Get-TranscriptFilePath {
    try {
      $externalHost = $host.gettype().getproperty("ExternalHost",
        [reflection.bindingflags]"nonpublic,instance").getvalue($host, @())
      $externalhost.gettype().getfield("transcriptFileName", "nonpublic,instance").getvalue($externalhost)
    } catch {
      write-warning "This host does not support transcription."
    }
}
