# encoding: ascii
# api: powershell
# title: Test-Transcribing
# description: Start-Transcript and Stop-Transcript will start and stop a file-based transcription log. However, there is no way to tell (afaik) if the current host is actually transcribing. Test-Transcribing will return $true if we are transcribing, $false if not.
# version: 0.1
# type: function
# author: Oisin Grehan
# license: CC0
# function: Test-Transcribing
# x-poshcode-id: 1500
# x-archived: 2017-05-22T03:21:13
# x-published: 2010-12-01T09:07:00
#
# UPDATE: typo fixed – doh.
# (powershell.exe consolehost only – ISE does not suport transcription)
#
#requires -version 2.0

function Test-Transcribing {
	$externalHost = $host.gettype().getproperty("ExternalHost",
		[reflection.bindingflags]"NonPublic,Instance").getvalue($host, @())

	try {
	    $externalHost.gettype().getproperty("IsTranscribing",
		[reflection.bindingflags]"NonPublic,Instance").getvalue($externalHost, @())
	} catch {
             write-warning "This host does not support transcription."
         }
}
