system API
These API methods are available in all environments.
This class is invoked as the “system” class in AutoKey scripts. For example, the “autokey.scripting.System.create_file()” method documented below is called as “system.create_file()” in an AutoKey script.
- class autokey.scripting.System[source]
Simplified access to some system commands.
- static create_file(file_name, contents='')[source]
Create a file with contents
Usage:
system.create_file(fileName, contents="")- Parameters:
file_name – full path to the file to be created
contents – contents to insert into the file
- static exec_command(command, getOutput=True)[source]
Execute a shell command
Usage:
system.exec_command(command, getOutput=True)Set getOutput to False if the command does not exit and return immediately. Otherwise AutoKey will not respond to any hotkeys/abbreviations etc until the process started by the command exits.
- Parameters:
command – command to be executed (including any arguments) - e.g. “ls -l”
getOutput – whether to capture the (stdout) output of the command
- Raises:
subprocess.CalledProcessError – if the command returns a non-zero exit code