Skip to content

Instantly share code, notes, and snippets.

@Lightfire228
Last active September 22, 2020 16:08
Show Gist options
  • Save Lightfire228/d9a37e440801a9121cbeeee8df2bf80a to your computer and use it in GitHub Desktop.
Save Lightfire228/d9a37e440801a9121cbeeee8df2bf80a to your computer and use it in GitHub Desktop.
Launch ALL the programs!
# v4.5
# https://gist.github.com/Lightfire228/d9a37e440801a9121cbeeee8df2bf80a
from pywinauto.application import Application
from pywinauto import keyboard
import pyperclip
import subprocess
import time
def clipboard_manager(func):
def wrapper():
clipboard = pyperclip.paste()
func()
pyperclip.copy(clipboard)
return wrapper
@clipboard_manager
def main():
set_node()
open_terminals()
open_vscode()
def open_terminals():
commands = [
['bapi', 'nrd', ''],
['bapp', 'nrd', ''],
[ 'api', 'nrd', ''],
[ 'app', 'nrd', ''],
['bapi', ''],
['bapp', '']
]
for command in commands:
terminals = open_terminal(command, '\n')
def set_node():
subprocess.run(['powershell.exe', '-command', 'nvm use 5.11.1'])
def open_vscode():
and_ = ' && '
code = 'code .'
and_code = and_ + code
code_windows = [
'bapi' + and_code,
'bapp' + and_code,
' api' + and_code,
' app' + and_code,
'misc-dh' + and_code,
'exit\n',
]
open_terminal(code_windows, and_)
def open_terminal(commands, joinStr):
Application().start('C:\\Program Files\\Git\\git-bash.exe', create_new_console=True, wait_for_idle=False)
pyperclip.copy(joinStr.join(commands))
time.sleep(1.5)
keyboard.send_keys('+{INS}')
if __name__ == "__main__":
main()
@Lightfire228
Copy link
Author

Lightfire228 commented Jul 9, 2020

Requires pywinauto and pyperclip

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment