-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathapp.py
39 lines (30 loc) · 959 Bytes
/
app.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
from fastapi import FastAPI
import subprocess
import pygetwindow
import pyautogui;
app = FastAPI()
@app.get("/")
async def root():
return {"message": "Hello World"}
@app.get("/openApp/")
async def openApplication():
subprocess.Popen("C:\Program Files (x86)\BPJS Kesehatan\Aplikasi Sidik Jari BPJS Kesehatan\After.exe")
return {"message": "DONE"}
@app.get("/bringFront/{name}")
async def bringFront(name):
win=bringAppToFront(name)
writeSomeText('tes')
return {"message":win}
@app.get("/minApp/{name}")
async def miniApp(name):
win=minimizeApp(name)
return {"message":win}
def bringAppToFront(appName):
win =pygetwindow.getWindowsWithTitle(appName)[0]
return win.activate()
def minimizeApp(appName):
# win =pygetwindow.getWindowsWithTitle('jjl_pygetwindow.py - python - Visual Studio Code')[0]
win =pygetwindow.getWindowsWithTitle(appName)[0]
return win.minimize()
def writeSomeText(text):
pyautogui.write(text, interval=1)