Skip to content

Commit

Permalink
v1.2.5, added support for D-ATIS errors, move window to view status
Browse files Browse the repository at this point in the history
  • Loading branch information
glott committed May 13, 2024
1 parent 2e6f875 commit 283c4bb
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 19 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

_by Josh Glottmann_

**Version 1.2.4** - 05/04/2024
**Version 1.2.5** - 05/12/2024

Fetches and loads AIRNC D-ATISs for use with [vATIS](https://vatis.clowd.io/) by [Justin Shannon](https://github.com/JustinShannon)

Expand Down
22 changes: 13 additions & 9 deletions vATISLoad.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -227,6 +227,9 @@
"\n",
" atis_info, code = [], ''\n",
" atis_data = json.loads(requests.get(url).text)\n",
" if 'error' in atis_data:\n",
" return [], ''\n",
" \n",
" for n in range(0, len(atis_data)):\n",
" datis = atis_data[n]['datis']\n",
" if atis_type == 'C' and n == 0:\n",
Expand Down Expand Up @@ -312,10 +315,10 @@
"source": [
"# Center command prompt\n",
"for win in gw.getAllWindows():\n",
" if 'py.exe' in win.title: \n",
" if 'py.exe' in win.title or win.title == 'vATIS': \n",
" screen_dim = [win32api.GetSystemMetrics(0), \\\n",
" win32api.GetSystemMetrics(1)]\n",
" win.moveTo(int((screen_dim[0] - win.size[0]) / 2), \\\n",
" win.moveTo(int((screen_dim[0] - win.size[0]) / 2) - 60, \\\n",
" int((screen_dim[1] - win.size[1]) / 2))\n",
"\n",
"# Profile selection\n",
Expand Down Expand Up @@ -406,12 +409,13 @@
" atis, code = get_atis(ident)\n",
" \n",
" # Enter ARPT COND\n",
" click_xy([200, 250], win)\n",
" pyautogui.hotkey('ctrl', 'a')\n",
" pyautogui.press('backspace')\n",
" pyperclip.copy(atis[0])\n",
" pyautogui.hotkey('ctrl', 'v')\n",
" click_xy([40, 295], win)\n",
" if len(atis) > 0:\n",
" click_xy([200, 250], win)\n",
" pyautogui.hotkey('ctrl', 'a')\n",
" pyautogui.press('backspace')\n",
" pyperclip.copy(atis[0])\n",
" pyautogui.hotkey('ctrl', 'v')\n",
" click_xy([40, 295], win)\n",
" \n",
" # Enter NOTAMS\n",
" if len(atis) > 1:\n",
Expand All @@ -422,7 +426,7 @@
" pyautogui.hotkey('ctrl', 'v')\n",
" click_xy([415, 295], win)\n",
" \n",
" if len(atis[0]) == 0:\n",
" if len(code) == 0 or len(atis[0]) == 0:\n",
" print(f'{ident.upper()} - UN')\n",
" continue\n",
" \n",
Expand Down
22 changes: 13 additions & 9 deletions vATISLoad.py
Original file line number Diff line number Diff line change
Expand Up @@ -210,6 +210,9 @@ def get_atis(ident):

atis_info, code = [], ''
atis_data = json.loads(requests.get(url).text)
if 'error' in atis_data:
return [], ''

for n in range(0, len(atis_data)):
datis = atis_data[n]['datis']
if atis_type == 'C' and n == 0:
Expand Down Expand Up @@ -287,10 +290,10 @@ def add_profile(facility, airports):

# Center command prompt
for win in gw.getAllWindows():
if 'py.exe' in win.title:
if 'py.exe' in win.title or win.title == 'vATIS':
screen_dim = [win32api.GetSystemMetrics(0), \
win32api.GetSystemMetrics(1)]
win.moveTo(int((screen_dim[0] - win.size[0]) / 2), \
win.moveTo(int((screen_dim[0] - win.size[0]) / 2) - 60, \
int((screen_dim[1] - win.size[1]) / 2))

# Profile selection
Expand Down Expand Up @@ -381,12 +384,13 @@ def add_profile(facility, airports):
atis, code = get_atis(ident)

# Enter ARPT COND
click_xy([200, 250], win)
pyautogui.hotkey('ctrl', 'a')
pyautogui.press('backspace')
pyperclip.copy(atis[0])
pyautogui.hotkey('ctrl', 'v')
click_xy([40, 295], win)
if len(atis) > 0:
click_xy([200, 250], win)
pyautogui.hotkey('ctrl', 'a')
pyautogui.press('backspace')
pyperclip.copy(atis[0])
pyautogui.hotkey('ctrl', 'v')
click_xy([40, 295], win)

# Enter NOTAMS
if len(atis) > 1:
Expand All @@ -397,7 +401,7 @@ def add_profile(facility, airports):
pyautogui.hotkey('ctrl', 'v')
click_xy([415, 295], win)

if len(atis[0]) == 0:
if len(code) == 0 or len(atis[0]) == 0:
print(f'{ident.upper()} - UN')
continue

Expand Down

0 comments on commit 283c4bb

Please sign in to comment.