<# .SYNOPSIS Search a downloaded Lithuanian aircraft register database for an aircraft registation and if found, return the aircraft model .DESCRIPTION First, create a subdirectory 'LY' in this script's parent folder. Next, download the Lithuanian aircraft register database (see links section), unzip it and move the PDF file to the 'LY' folder. Now run this script with an aircraft registration as its only parameter (see examples section). The script cannot read the PDF file directly, so the PDF file needs to be converted to plain text first. The script will look for a GhostScript installation on the computer, and if found, uses the following command to convert the PDF file to plain text: "C:\Program Files\gs\gs\bin\gswin64c.exe" -sDEVICE=txtwrite -o Lietuvos-Respublikoje-registruotu-orlaiviu-sarašas.txt Lietuvos-Respublikoje-registruotu-orlaiviu-sarašas.pdf NOTE: If you download a new PDF file, make sure to either run this script with the -ConvertPDF switch or manually delete the old TEXT file! The script will search for a line that starts with the registration. If a match is found, the model will be in the same line, more to the right. The script will display a tab-delimited string with the registration and the aircraft model (). If the script was started by another PowerShell script, the calling PowerShell script may also read the model from the variable $Model, passed on by this script. If the script was started by a batch file, the calling batch file can use 'FOR /F' on this PowerShell script's screen output to find the model. Get-Help './AirRegLYCmd.ps1' -Examples will show 2 examples of this script being called by another script. .PARAMETER Registration A valid Lithuanian aircraft registration, i.e. LY-xxx (where each x is a single character) .PARAMETER ConvertPDF Force conversion of the latest PDF file to plain text; use this switch once after downloading a new PDF file. .PARAMETER Quiet Ignore all errors and do not display any error messages; in case of errors, just terminate with return code 1. .PARAMETER Help Show the script's help screen .PARAMETER Version Show this script's version number; if combined with -Verbose show full script path, version number and last/modified/release date .PARAMETER Debug Show some progress messages .OUTPUTS A tab-delimited string and model is also stored in output variable $Model. .EXAMPLE . ./AirRegLYCmd.ps1 "LY-LAM" Will return tab-delimited string "LY-LAMTIGER MOTH Replika", and set variable $Model to "TIGER MOTH Replika" .EXAMPLE "LY-LAM" | . ./AirRegLYCmd.ps1 Will also return tab-delimited string "LY-LAMTIGER MOTH Replika", and set variable $Model to "TIGER MOTH Replika" .EXAMPLE . ./AirRegLYCmd.ps1 "LY-LAM" -Debug This will return: Started search for local database (text format) in folder ".\LY" at