GithubHelp home page GithubHelp logo

0x4133 / snaklonger Goto Github PK

View Code? Open in Web Editor NEW
1.0 1.0 0.0 32 KB

a text expander, replacing predefined abbreviations with their corresponding expansions as you type.

Python 76.22% PowerShell 23.78%
nothing-to-see-here python text-expander

snaklonger's Introduction

Text Expander

This is a Python script that acts as a text expander, replacing predefined abbreviations with their corresponding expansions as you type. The script uses the pynput library to monitor keyboard input and automatically expands abbreviations in real-time.

Features

  • Monitors keyboard input for predefined abbreviations.
  • Replaces abbreviations with their expanded forms.
  • Loads abbreviations and expansions from an external file.
  • Simulates natural typing of the expanded text.

Requirements

  • Python 3.x
  • pynput library
  • pyperclip library

Installation

  1. Clone the repository or download the script files.

  2. Install the required libraries using pip:

    pip install pynput pyperclip
  3. Create an expansions.txt file in the same directory as the script with the following format:

    abbreviation:expansion
    

    Example expansions.txt:

    brb:be right back
    omw:on my way
    idk:I don't know
    smh:shaking my head
    btw:by the way
    

Usage

  1. Save the script to a file, for example, text_expander.py.

  2. Run the script from your terminal:

    python text_expander.py
  3. The script will start monitoring your keyboard input. When you type an abbreviation followed by a space or enter, it will replace the abbreviation with the expanded text.

Script Explanation

  • load_expansions(file_path): This function reads the abbreviations and expansions from the specified file and returns a dictionary.
  • on_press(key): This function is called every time a key is pressed. It appends the typed characters to a buffer and processes the text when a space or enter key is detected.
  • process_typed_text(): This function processes the typed text, checks if it matches any abbreviation, and replaces it with the expanded text by simulating backspace and typing the expanded text.

Customization

  • To add or modify abbreviations and their expansions, edit the expansions.txt file.
  • Adjust the typing speed by modifying the sleep duration in the process_typed_text() function.

Contributing

Contributions are welcome! Feel free to submit a pull request or open an issue to discuss improvements and enhancements.

License

This project is licensed under the MIT License. See the LICENSE file for details.

Acknowledgements

  • This script uses the pynput library to monitor keyboard input and simulate key presses.
  • The pyperclip library is used for clipboard operations.

Disclaimer: This script is provided as-is. Use it at your own risk. The author is not responsible for any potential issues caused by the usage of this script.

Instructions for Use

snaklonger's People

Contributors

0x4133 avatar duracell-a-3 avatar

Stargazers

 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.