Deprecated: Function get_magic_quotes_gpc() is deprecated in /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php on line 99

Deprecated: The each() function is deprecated. This message will be suppressed on further calls in /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php on line 619

Warning: Cannot modify header information - headers already sent by (output started at /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php:99) in /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php on line 1169

Warning: Cannot modify header information - headers already sent by (output started at /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php:99) in /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php on line 1176

Warning: Cannot modify header information - headers already sent by (output started at /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php:99) in /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php on line 1176

Warning: Cannot modify header information - headers already sent by (output started at /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php:99) in /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php on line 1176

Warning: Cannot modify header information - headers already sent by (output started at /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php:99) in /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php on line 1176

Warning: Cannot modify header information - headers already sent by (output started at /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php:99) in /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php on line 1176

Warning: Cannot modify header information - headers already sent by (output started at /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php:99) in /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php on line 1176

Warning: Cannot modify header information - headers already sent by (output started at /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php:99) in /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php on line 1176

Warning: Cannot modify header information - headers already sent by (output started at /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php:99) in /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php on line 1176

Warning: Cannot modify header information - headers already sent by (output started at /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php:99) in /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php on line 1176

Warning: Cannot modify header information - headers already sent by (output started at /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php:99) in /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php on line 1176

Warning: Cannot modify header information - headers already sent by (output started at /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php:99) in /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php on line 1176

Warning: Cannot modify header information - headers already sent by (output started at /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php:99) in /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php on line 1176

Warning: Cannot modify header information - headers already sent by (output started at /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php:99) in /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php on line 1176

Warning: Cannot modify header information - headers already sent by (output started at /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php:99) in /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php on line 1176

Warning: Cannot modify header information - headers already sent by (output started at /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php:99) in /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php on line 1176

Warning: Cannot modify header information - headers already sent by (output started at /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php:99) in /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php on line 1176

Warning: Cannot modify header information - headers already sent by (output started at /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php:99) in /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php on line 1176

Warning: Cannot modify header information - headers already sent by (output started at /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php:99) in /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php on line 1176

Warning: Cannot modify header information - headers already sent by (output started at /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php:99) in /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php on line 1176

Warning: Cannot modify header information - headers already sent by (output started at /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php:99) in /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php on line 1176

Warning: Cannot modify header information - headers already sent by (output started at /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php:99) in /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php on line 1176
8000 Contributed Scripts 4 · autokey/autokey Wiki · GitHub
Nothing Special   »   [go: up one dir, main page]

Skip to content

Contributed Scripts 4

Elliria edited this page Oct 10, 2025 · 4 revisions

Contents

Create a phrase from a script:

  • Author: Elliria
  • Purpose This script creates a phrase. If its name already exists, a new phrase is created by the same name with a number appended to it. This script was successfully tested in AutoKey 0.95.10.
    # Store the phrase folder in a variable (the default name is My Phrases):
    folder = engine.get_folder("My Phrases")
    # Store the phrase name in a variable:
    phrase_name = "New phrase"
    # Store the phrase contents in a variable:
    phrase_contents = "hello world"
    # Create the new phrase:
    engine.create_phrase(folder, phrase_name, phrase_contents)
    # Display a closing dialog:
    dialog.info_dialog("Info", "Done. Close and reopen AutoKey to see the phrase.")

Create one or more phrases from a CSV file:

  • Author: Elliria
  • Purpose This script reads the contents of the specified CSV file row by row and creates a new phrase from each row while ignoring empty rows. This script was successfully tested in AutoKey 0.95.10.
  • Note Customize the script by replacing the example file_path and folder locations with those you'd like to use.
    # Import the CSV module:
    import csv
    # Try to open the CSV file and create one or more phrases from it:
    try:
        # Store a starting value for the row_count variable:
        row_count = 0
        # Store the path to the CSV file in a variable:
        file_path = "/home/elliria/Desktop/example.csv"
        # Store the folder that the phrases are in in a variable:
        folder = engine.get_folder("My Phrases")
        # Open the CSV file:
        with open(file_path,'r') as csvfile:
            for row in csv.reader(csvfile):
                # If the row isn't empty after stripping:
                if str(row).strip():
                    # Add 1 to the line_count value:
                    row_count += 1
                    # Store a phrase name that uses the current row_count:
                    phrase_name = f"Phrase{row_count}"
                    # Create the new phrase:
                    engine.create_phrase(folder, phrase_name, str(row))
            # Display a closing dialog:
            dialog.info_dialog("Info", "Done. Close and reopen AutoKey to see them.")                
    # If the file doesn't exist:
    except FileNotFoundError:
        # Display an error dialog:
        dialog.info_dialog("Error", f"File not found: {file_path}")
        # Exit without continuing the script:
        exit()

Create one or more phrases from a text file:

  • Author: Elliria
  • Purpose This script reads the contents of the specified text file line by line and creates a new phrase from each line while ignoring empty lines. This script was successfully tested in AutoKey 0.95.10.
  • Note Customize the script by replacing the example file_path and folder locations with those you'd like to use.
    # Try to open the text file and create one or more phrases from it:
    try:
        # Store a starting value for the line_count variable:
        line_count = 0
        # Store the path to the text file in a variable:
        file_path = "/home/elliria/Desktop/example.txt"
        # Store the folder that the phrases are in in a variable:
        folder = engine.get_folder("My Phrases")
        # Open the file:
        with open(file_path, "r") as f:
            for line in f:
                # If the line isn't empty after stripping:
                if line.strip():
                    # Add 1 to the line_count value:
                    line_count += 1
                    # Store a phrase name that uses the current line_count:
                    phrase_name = f"Phrase{line_count}"
                    # Create the new phrase:
                    engine.create_phrase(folder, phrase_name, line)
        # Display a closing dialog:
        dialog.info_dialog("Info", "Done. Close and reopen AutoKey to see them.")
    # If the file doesn't exist:
    except FileNotFoundError:
        # Display an error dialog:
        dialog.info_dialog("Error", f"File not found: {file_path}")
        # Exit without continuing the script:
        exit()
Clone this wiki locally
0