PoshCode Archive  Artifact [345d921152]

Artifact 345d92115282ebfe5f75ad15454608473a182a0e0ecc22b88c1d53f1343b7699:

  • File Get-TranscriptFilePath.ps1 — part of check-in [f6e15ba5d6] at 2018-06-10 13:10:00 on branch trunk — Get the name of the current (or last) transcription file used in the current session. Requires powershell v2.0. Some things to note: (user: Oisin Grehan size: 1211)

# 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."
    }
}