Last active
September 22, 2020 16:08
-
-
Save Lightfire228/d9a37e440801a9121cbeeee8df2bf80a to your computer and use it in GitHub Desktop.
Launch ALL the programs!
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
# 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() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Requires
pywinauto
andpyperclip