Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactor: Change -ModeEasy to a [switch] type #22

Merged
merged 1 commit into from
May 24, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 21 additions & 13 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,19 +23,27 @@ If prompted to trust the repository, hit `Y` and `enter`.
```powershell
Import-Module Position-ExplorerWindow

# Build the params
# Simply use -ModeEasy with a list of -Paths
Position-ExplorerWindow -ModeEasy -Paths 'C:/path/to/folder1', 'C:/path/to/folder2', 'C:/path/to/folder3', 'C:/path/to/folder4'
```

## Usage (advanced)

```powershell
Import-Module Position-ExplorerWindow

# Configure to your liking
$params = @{
'ModeEasy' = $ModeEasy
'Paths' = $Paths
'DestinationScreenWidth' = $DestinationScreenWidth
'DestinationScreenHeight' = $DestinationScreenHeight
'DestinationMonitor' = $DestinationMonitor
'Rows' = $Rows
'Cols' = $Cols
'OffsetLeft' = $OffsetLeft
'OffsetTop' = $OffsetTop
'Flow' = $Flow
'DebugLevel' = $DebugLevel
'Paths' = 'C:/path/to/folder1', 'C:/path/to/folder2', 'C:/path/to/folder3', 'C:/path/to/folder4', 'D:/path/to/folder1', 'D:/path/to/folder2', 'D:/path/to/folder3', 'D:/path/to/folder4'
'DestinationScreenWidth' = 1920
'DestinationScreenHeight' = 1080
'DestinationMonitor' = 'M'
'Rows' = 4
'Cols' = 2
'OffsetLeft' = 0
'OffsetTop' = 0
'Flow' = 'Y'
'DebugLevel' = 0
}
# Call with params splatting
Position-ExplorerWindow @params
Expand All @@ -54,7 +62,7 @@ Q: Help! When I right-click the script and click *'Run with Powershell'*, it ope
- 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`.

Q: I want to open multiple sets of windows quickly. How do I do that?
- Simply make a copy of this script for each set of *Explorer* windows you want to open. Configure each script with a set of `$Paths`. Keep the scripts on your Desktop. You can now easily run those scripts, by right-clicking and selecting *'Run with Powershell'*.
- Simply make a copy of the usage script above for each set of *Explorer* windows you want to open. Configure each script with a set of `$Paths`. Keep the scripts on your Desktop. You can now easily run those scripts, by right-clicking and selecting *'Run with Powershell'*.
Alternatively, as seen in this demo, you can *pin Powershell onto your Taskbar*, then *pin those scripts* by dragging and dropping over the Powershell on the Taskbar. Now you can easily run them by right-clicking on Powershell, and clicking the script.
![Pin Demo](https://github.com/theohbrothers/Position-ExplorerWindow/raw/master/images/pin-demo.gif "Demo of Position-ExplorerWindow")

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,7 @@ function Position-ExplorerWindow {

.PARAMETER ModeEasy
# Simple Mode. In this mode, most defaults are used.
# If you hate configurations, simply set this to 1 and you're done.
# Default: 0
# If you hate configurations, simply use this with -Paths

.PARAMETER DestinationScreenWidth
# 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.
Expand Down Expand Up @@ -140,7 +139,7 @@ function Position-ExplorerWindow {
[CmdletBinding()]
Param(
[Parameter(Mandatory=$False,Position=0)]
[int]$ModeEasy = 0
[switch]$ModeEasy
,
[Parameter(Mandatory=$True,Position=1)]
[String[]]$Paths
Expand Down