# encoding: ascii
# api: powershell
# title: Start-Selected
# description: Usuallay I use this to start my browser with a URL in some PowerShell Script or retrieved by some Powershell Script. This is an ISE-Extension.
# version: 0.1
# type: function
# author: Bernd Kriszio
# license: CC0
# function: Start-Selected
# x-poshcode-id: 1297
# x-archived: 2016-04-19T06:39:44
# x-published: 2010-08-28T07:19:00
#
#
#Hightlight the name of a file or URL and this will opened or shown in browser
if ($PSVersionTable.BuildVersion.build -le 7000)
{
    # PowerShell V2 CTP3
    function Start-Selected
    {
        $ed = $psise.CurrentOpenedFile.Editor
        start $ed.SelectedText
    }
}
else
{
    # PowerShell W7 
    function Start-Selected
    {
        $file = $psIse.CurrentPowerShellTab.Output.SelectedText
        if ($file -eq '')
        {
            $file = $psise.CurrentFile.Editor.SelectedText
        }
        if ($file)
        {
            start $file
        }    
    }
}
#Set-CustomMenu "Start Selected" {Start-Selected} 'Ctrl+Shift+S'
