PoshCode Archive  Artifact [1d35654c6f]

Artifact 1d35654c6ff060a8e9b6d1280ca976ef86756fb7a4cb0496cfea75addd728f00:

  • File Import-Instapaper.ps1 — part of check-in [043b58d825] at 2018-06-10 13:12:50 on branch trunk — Search and browse to url in an instapaper csv. (user: Adminian size: 1670)

# encoding: ascii
# api: powershell
# title: Import-Instapaper
# description: Search and browse to url in an instapaper csv.
# version: 0.1
# type: script
# author: Adminian
# license: CC0
# function: Get-FileName
# x-poshcode-id: 2588
# x-archived: 2016-11-14T08:19:10
# x-published: 2011-03-27T18:24:00
#
#
   #                                           
  # #   #####  #    # # #    # #   ##   #    # 
 #   #  #    # ##  ## # ##   # #  #  #  ##   # 
#     # #    # # ## # # # #  # # #    # # #  # 
####### #    # #    # # #  # # # ###### #  # # 
#     # #    # #    # # #   ## # #    # #   ## 
#     # #####  #    # # #    # # #    # #    # 

## It's a quick little script to search instapaper csv


Function Get-FileName($initialDirectory)
{   
 [System.Reflection.Assembly]::LoadWithPartialName("System.windows.forms") |
 Out-Null

 $OpenFileDialog = New-Object System.Windows.Forms.OpenFileDialog
 $OpenFileDialog.ShowHelp = $true
 $OpenFileDialog.initialDirectory = $initialDirectory
 $OpenFileDialog.filter = "All files (*.*)| *.*"
 $OpenFileDialog.ShowDialog() | Out-Null
 $OpenFileDialog.filename
}

## Get the CSV File
$fileName = Get-FileName -initialDirectory "~"

$csv = Import-Csv $fileName

## I use this for a broad search or topic search
$search = Read-Host "Search Topic: "
$csv | Where-Object {$_.Title -like "*" + $search + "*"} | ft title

## This is the refined search that will open IE
$search = Read-Host "Open Title: "
$result = $csv | Where-Object {$_.Title -like "*" + $search + "*"}
$ie = New-Object -comobject "InternetExplorer.Application"
$ie.visible = $true
$ie.navigate($result.url)