Permalink
Cannot retrieve contributors at this time
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
27 lines (18 sloc)
743 Bytes
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import sys, getopt | |
# blog post about this here: | |
# https://currentkey.com/2020/05/11/advanced-tutorial-running-a-python-script-on-room-changes/ | |
# proof of concept python script. | |
# this script should be in your user's root directory | |
# this basic script is going to write a file with the | |
# active Room name as its contents | |
# the file should appear in the user's root directory (cd ~) | |
from os.path import expanduser | |
home = expanduser("~") | |
with open(home + '/somefile.txt', 'w') as the_file: | |
# join all subsequent arguments | |
# (spaces in Room names will make them seem like separate arguments) | |
if len(sys.argv) > 2: | |
the_file.write(" ".join(sys.argv[1:])) | |
else: | |
the_file.write(sys.argv[1]) | |
the_file.close() |