Windows To Drafts

Getting Started

  • Like the tagline says, where text starts. It is such a handy app and concept. But I spend a lot of time in Windows.
  • Get content from Windows into Drafts App
  • Get Windows command line output to Drafts. Wrapper scripts take commands and redirect output to a Dropbox file, overwriting previous content.
  • Copy the content from DropboxToDrafts.js to a Drafts action.
  • Or import from the Drafts Actions directory.

Ideas

  • Develop a process to create Drafts with content from existing files. This is useful with the iOS Workflow/Shortcuts app too. And iOS Shortcuts are easy to automate with Siri voice commands.
  • Instead of using one file, use a single purpose folder. Drafts checks all files. When the Drafts action imports the draft it will erase the content.

Problems

  • DOS file formats (CR/LF). I use a dos2unix function in the PowerShell profile to fix file format issues.
  • Drafts App is iOS and macOS beta only.

References

octocat

Powershell Profile

This is my Powershell profile.

Getting Started

  • Installation process: clone or copy to $env:USERPROFILE\Documents\WindowsPowerShell. Or just cherry pick pieces.

# run as administrator

Set-ExecutionPolicy RemoteSigned

  • Software dependencies: Windows 10, 8 or 7
  • Read about Posh-Git if you are a Git user – GitHub, Better Git with PowerShell - You’ve been Haacked
  • The Profile is a good place for command line aliases for commands not included in Powershell. Examples are like Windows cmd commands, shortened commands to save on typing.
  • For longer aliases or commands, Powershell functions work well. Look at Remove-Service in the Profile for an example of a missing Powershell command.
  • Keep in mind – if the Profile gets too bloated Powershell start up is slow. Running ngen.ps1 can shorten the PowerShell startup as well as other dotNet apps.
  • Approved Verbs for PowerShell Commands

Modules


# run Get-InstalledModule for a list of installed modules

Get-InstalledModule

# ######## sample output ########
#
# Version              Name                                Repository           Description
# -------              ----                                ----------           -----------
# 1.0.1.2              newtonsoft.json                     PSGallery            Serialize/Deserialize Json
# 2.0.223              oh-my-posh                          PSGallery            Theming capabilities
# 1.1.7.2              PackageManagement                   PSGallery            PackageManagement
# 0.7.1                posh-docker                         PSGallery            Powershell tab completion
# 0.7.3                posh-git                            PSGallery            Provides prompt with Git status
# 1.6.6                PowerShellGet                       PSGallery            PowerShell module with commands
#

# run Set-PSRepository to trust PSGallery

Set-PSRepository -Name PSGallery -InstallationPolicy Trusted

# run Install-Module to install the modules

Install-Module posh-git

# run to update modules

Update-Module PowerShellGet

Contribute

  • Provide feedback or suggestions.

octocat

Org-mode Capture from Drafts App

Features

  • Capture text from iOS Drafts app into Org-mode.
  • Add org-mode style tags from your Drafts tags.
  • Drafts keyboard macros to insert scheduled and deadline dates and code blocks.

Installation

  • Get the Drafts app for iPhone or iPad.
  • Get Org-mode capture action for Drafts from the iOS device.
  • Change the Dropbox (second) step to your target org file.

Dropbox (second step)


fileNameTemplate:   Test.inbox.org      # <<< change to your target org file
folderTemplate:     /Notes              # <<< change to your org folder on Dropbox
template:

            * [[title]]

            [[body]]
            :PROPERTIES:
            :Created:  [[[date]]] [[[time]]]
            :END:

writeType:          prepend

Usage

  • The Drafts app is great for quickly capturing any kind of text. Like the tagline says, Where Text Starts. Decide later whether it is email, text, tweet or whatever.
  • This action is for capturing text to Org-mode from iPhones and iPads.
  • The action converts Drafts tags to Org-mode style tags.
  • Drafts app is super useful for capturing text from almost any iOS app. This org-mode capture action is a quick step to getting it into the Org-mode workflow.

octocat

Posh Backup Dot Files

This is a PowerShell script to backup dot files and directories on Windows.

WARNING dot files can contain sensitive information. Do not clone to a public repo!

Usage

  • Clone this repo.
  • Edit the backup_list.txt file. Add your dot files.
  • Run posh_backup_dot_files.ps1

Details

  • The script copies dot files and directories to the ./backup subdirectory.
  • It checks for changes and uses git to add and commit the changes.
  • If your dot files contain sensitive information do not clone to a public repository.

Feedback and suggestions are welcome.

octocat

Check for locked files

Companies work from Excel, Word and other files on network shared folders. More than one user cannot usually work on these files at the same time. Time is lost tracking down who has the file locked.

It can be hard to see who has a file locked. Sometimes Excel or Word shows who. But not always. Other files like shared PDF’s and CAD file types do not help much.

One way to see who locked a file is from the Windows file server as Administrator. Not practical for security reasons.

This tool has two parts:

  • A watcher that checks for locked files. The watcher uses a search list for watched files and folders.
  • A web server that displays the locked files and who locked them. No need for special access. Just check a web page.

Quick setup

  • Clone or download and extract this Github repo to a folder on the file server.
  • Make sure NodeJS and npm are installed and on the PATH. Open a command line to the repo location and run npm install to initialize.
  • From the same command line start the web server – npm start. By default it runs on port 80 so if that is a problem edit package.json scripts/start. Visit http://fileserver-name.
  • In a separate command line start File lock watcher npm run watch [requires Administrator privledges]

screenshot

octocat