Package lib :: Module scripting :: Class System
[hide private]
[frames] | no frames]

Class System

source code

Simplified access to some system commands.

Instance Methods [hide private]
 
exec_command(self, command, getOutput=True)
Execute a shell command
source code
 
create_file(self, fileName, contents='')
Create a file with contents
source code
Method Details [hide private]

exec_command(self, command, getOutput=True)

source code 

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

create_file(self, fileName, contents='')

source code 

Create a file with contents

Usage: system.create_file(fileName, contents="")

Parameters:
  • fileName - full path to the file to be created
  • contents - contents to insert into the file