Skip to content

Commit

Permalink
Docs: Simplify readme
Browse files Browse the repository at this point in the history
  • Loading branch information
leojonathanoh committed May 22, 2021
1 parent 345b091 commit cd58680
Showing 1 changed file with 34 additions and 99 deletions.
133 changes: 34 additions & 99 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,114 +4,52 @@
[![github-release](https://img.shields.io/github/v/release/theohbrothers/Position-ExplorerWindow?style=flat-square)](https://github.com/theohbrothers/Position-ExplorerWindow/releases/)
[![powershell-gallery-release](https://img.shields.io/powershellgallery/v/Position-ExplorerWindow?logo=powershell&logoColor=white&label=PSGallery&labelColor=&style=flat-square)](https://www.powershellgallery.com/packages/Position-ExplorerWindow/)

Opens, resizes, and arranges multiple `Explorer` windows at specified paths in a grid fashion to fit a screen, or multiple screens.

Opens, resizes, and arranges multiple `Explorer` windows at specified paths in a *grid* fashion to fit a screen, or multiple screens.

## Requirements:
- Windows 7 and up
- Powershell v2

## Demo
![Demo](https://github.com/theohbrothers/Position-ExplorerWindow/raw/master/images/preview-demo.gif "Demo of Position-ExplorerWindow")

## Usage

### As a Module

1. [Install](https://msdn.microsoft.com/en-us/library/dd878350(v=vs.85).aspx) the `Position-ExplorerWindow.psm1` module into **any** of the following directories:
```powershell
%Windir%\System32\WindowsPowerShell\v1.0\Modules
%UserProfile%\Documents\WindowsPowerShell\Modules
%ProgramFiles%\WindowsPowerShell\Modules
```


2. Import the module, then pipe the config into the module:
```powershell
Import-Module Position-ExplorerWindow
# Build the params
$params = @{
'ModeEasy' = $ModeEasy
'Paths' = $Paths
'DestinationScreenWidth' = $DestinationScreenWidth
'DestinationScreenHeight' = $DestinationScreenHeight
'DestinationMonitor' = $DestinationMonitor
'Rows' = $Rows
'Cols' = $Cols
'OffsetLeft' = $OffsetLeft
'OffsetTop' = $OffsetTop
'Flow' = $Flow
'DebugLevel' = $DebugLevel
}
# Call with params splatting
Position-ExplorerWindow @params
```

## Advanced information
### Module Command line
```powershell
SYNTAX
Position-ExplorerWindow [[-ModeEasy] <Int32>] [-Paths] <String[]> [[-DestinationScreenWidth] <Int32>] [[-DestinationScreenHeight] <Int32>] [[-DestinationMonitor] <String>] [[-Rows] <Int32>] [[-Cols]
<Int32>] [[-OffsetLeft] <Int32>] [[-OffsetTop] <Int32>] [[-Flow] <String>] [[-DebugLevel] <Int32>] [<CommonParameters>]
PARAMETERS
-ModeEasy <Int32>
In this mode, most defaults are used.
-Paths <String[]>
The paths (folders) the Explorer windows should show.
-DestinationScreenWidth <Int32>
Width of resolution of the Destination Screen (think of this as block of pixels, and not necesarily a Monitor's resolution) where the Explorer windows will reside.
-DestinationScreenHeight <Int32>
Height of resolution of the Destination Screen (think of this as block of pixels, and not necesarily a Monitor's resolution) where the Explorer windows will reside.
-DestinationMonitor <String>
Physical position of the Destination Monitor where the Explorer windows will open
-Rows <Int32>
The number of rows of Explorer instances
-Cols <Int32>
The number of columns of Explorer instances
## Install

-OffsetLeft <Int32>
How many pixels left/right the Explorer instances should be shifted from the Top-Left Corner(0,0) of the Destination Monitor. Useful in the case of multiple-monitor setups.
Open [`powershell`](https://docs.microsoft.com/en-us/powershell/scripting/windows-powershell/install/installing-windows-powershell?view=powershell-5.1) or [`pwsh`](https://github.com/powershell/powershell#-powershell) and type:

-OffsetTop <Int32>
How many pixels up/down the Explorer instances should be shifted from the Top-Left Corner(0,0) of the Destination Monitor. Useful in the case of multiple-monitor setups.
-Flow <String>
Arrangement of Explorer Windows: Whether windows should flow left-to-right, or top-down fashion
```powershell
Install-Module -Name Position-ExplorerWindow -Repository PSGallery -Scope CurrentUser -Verbose
```

-DebugLevel <Int32>
Debug level
If prompted to trust the repository, hit `Y` and `enter`.

<CommonParameters>
This cmdlet supports the common parameters: Verbose, Debug,
ErrorAction, ErrorVariable, WarningAction, WarningVariable,
OutBuffer, PipelineVariable, and OutVariable. For more information, see
about_CommonParameters (https:/go.microsoft.com/fwlink/?LinkID=113216).
```
## Usage

### Capturing output
Because of the pipelining nature of `Powershell`, the `stdout` is used for returning objects.
To capture streams that output the script's progress, use `*>&1` operator when calling `Position-ExplorerWindow` as a *module*, or `>` when calling `Position-ExplorerWindow` as a *script*.
```powershell
# If using as a module
Position-ExplorerWindow -ConfigAsString $myConfig -Verbose *>&1 | Out-File -FilePath ./output.log
# If using as a script
Powershell .\Position-ExplorerWindow.ps1 > output.log
Import-Module Position-ExplorerWindow
# Build the params
$params = @{
'ModeEasy' = $ModeEasy
'Paths' = $Paths
'DestinationScreenWidth' = $DestinationScreenWidth
'DestinationScreenHeight' = $DestinationScreenHeight
'DestinationMonitor' = $DestinationMonitor
'Rows' = $Rows
'Cols' = $Cols
'OffsetLeft' = $OffsetLeft
'OffsetTop' = $OffsetTop
'Flow' = $Flow
'DebugLevel' = $DebugLevel
}
# Call with params splatting
Position-ExplorerWindow @params
```

Use `Get-Help Position-ExplorerWindow -Detailed` to see many good examples.

## FAQ

### WinNT
Q: System requirements?

- Windows 7 and up
- Powershell v2

Q: Help! When I right-click the script and click *'Run with Powershell'*, it opens and closes in a split second. What's going on?
- You probably are seeing a *red colored error message* in the window just before it disappears. You need to allow the execution of unverified scripts. Open Powershell as administrator, type `Set-ExecutionPolicy Unrestricted -Force` and press ENTER. Try running the script again. You can easily restore the security setting back by using `Set-ExecutionPolicy Undefined -Force`.

Expand All @@ -135,12 +73,9 @@ Q: Help! Upon running the script I am getting an error <code>'File C:\...Positio
Q: Help! Upon running the script I am getting an error <code>File C:\...Position-ExplorerWindows.ps1 cannot be loaded. The file C:\...\Position-ExplorerWindows.ps1 is not digitally signed. You cannot run this script on the current system. For more information about running scripts and setting execution policy, see about_Execution_Policies at http://go.microsoft.com/fwlink/?LinkID=135170.</code>
- You need to allow the execution of unverified scripts. Open Powershell as administrator, type <code>Set-ExecutionPolicy Unrestricted -Force</code> and press ENTER. Try running the script again. You can easily restore the security setting back by using <code>Set-ExecutionPolicy Undefined -Force</code>.


Q: Help! Upon running the script I am getting a warning <code>'Execution Policy change. The execution policy helps protect you from scripts that you do not trust. Changing the execution policy might expose you to the security risks described in the about_Execution_Policies help topic at http://go.microsoft.com/?LinkID=135170. Do you want to change the execution policy?</code>
- You need to allow the execution of unverified scripts. Type <code>Y</code> for yes and press enter. You can easily restore the security setting back opening Powershell as administrator, and using the code <code>Set-ExecutionPolicy Undefined -Force</code>.

## Known issues
- Nil

## Background

An `Explorer` window cannot be opened at a specified coordinate on the screen through its command line. Because the author could not find any working solution that could conveniently open multiple Explorer windows in specified folders arranged in a predictable and orderly fashion on the screen, there had to be a tool that could do this.

0 comments on commit cd58680

Please sign in to comment.