- cherry: orofacial/TMD PPTX presentations + 음악가 구강건강 가이드 - papa: sinus/infraoccluded PPTX, garden-monitor Arduino, MIDI files - databases: PCSP scraper, translation scripts, vision benchmark, batch JSONs - web-ui: code.js/companion.py/styles.css major updates, autostart installer - src: ollama-client, session, LLMProvider, ollama-adapter patches - .gitignore: add claude-key, SQLite WAL/SHM, __pycache__, nohup.out Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
69 lines
2.0 KiB
Python
69 lines
2.0 KiB
Python
#!/usr/bin/env python3
|
|
"""
|
|
Windows 로그인 시 companion.py 자동시작 등록/제거
|
|
실행: python install_autostart.py
|
|
"""
|
|
import os
|
|
import sys
|
|
|
|
def main():
|
|
if sys.platform != 'win32':
|
|
print('이 스크립트는 Windows 전용입니다.')
|
|
input()
|
|
return
|
|
|
|
script_dir = os.path.dirname(os.path.abspath(__file__))
|
|
companion_path = os.path.join(script_dir, 'companion.py')
|
|
|
|
startup_dir = os.path.join(
|
|
os.environ['APPDATA'],
|
|
'Microsoft', 'Windows', 'Start Menu', 'Programs', 'Startup'
|
|
)
|
|
vbs_path = os.path.join(startup_dir, 'python_companion.vbs')
|
|
|
|
# pythonw.exe 경로 (콘솔 창 없이 실행)
|
|
pythonw = os.path.join(os.path.dirname(sys.executable), 'pythonw.exe')
|
|
if not os.path.exists(pythonw):
|
|
pythonw = sys.executable # fallback
|
|
|
|
print('=' * 50)
|
|
print('Python Companion 자동시작 설치')
|
|
print('=' * 50)
|
|
print(f'companion.py : {companion_path}')
|
|
print(f'pythonw : {pythonw}')
|
|
print(f'시작프로그램 : {vbs_path}')
|
|
print()
|
|
|
|
if os.path.exists(vbs_path):
|
|
print('[이미 등록됨]')
|
|
choice = input('재설치 하시겠습니까? (y/n): ').strip().lower()
|
|
if choice != 'y':
|
|
return
|
|
|
|
vbs_content = (
|
|
'Set WS = CreateObject("Wscript.Shell")\n'
|
|
f'WS.Run "{pythonw} ""{companion_path}""", 0, False\n'
|
|
)
|
|
|
|
with open(vbs_path, 'w', encoding='utf-8') as f:
|
|
f.write(vbs_content)
|
|
|
|
print()
|
|
print(f'[완료] 자동시작 등록됨')
|
|
print('다음 Windows 로그인 시 자동으로 실행됩니다.')
|
|
print()
|
|
print('제거: 아래 파일 삭제')
|
|
print(f' {vbs_path}')
|
|
print()
|
|
|
|
choice = input('지금 바로 실행하시겠습니까? (y/n): ').strip().lower()
|
|
if choice == 'y':
|
|
import subprocess
|
|
subprocess.Popen([pythonw, companion_path])
|
|
print('실행됨 (트레이 아이콘 확인)')
|
|
|
|
input('\n[Enter] 종료...')
|
|
|
|
if __name__ == '__main__':
|
|
main()
|