-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathAlexa_Tokens.sh
74 lines (47 loc) · 2.1 KB
/
Alexa_Tokens.sh
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
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
#!/bin/bash
#This script is designed to be run
#from the other script in the Alexa_Autostart repo (start_alexa) which is
#modified from the script written by
#Misperry https://youtu.be/iwlQnRHX9Ms
#all credit to him for the other
#script, I've only made a few small edits.
# This script automates the process of
#logging in etc prior to pressing
#'spacebar' in Misperry's script.
#It also automates the spacebar keying at the end making the whole startup automated.
#THIS WILL NOT WORK ON A HEADLESS
#INSTALL - IT NEEDS A PHYSICAL MOUSE
#ATTACHED AND A MONITOR. I'M USING IT
#ON A SMART MIRROR WITH USB MOUSE
#HIDDEN BEHIND IT TO ALLOW THIS TO WORK
#I KNOW OF NO OTHER WORK AROUND AT THE MOMENT.
#Change coordinate numbers of each
#mouse move to suit where your
#windows pop up on the desktop.
#Moves mouse over the 'Yes' Button of the default browser request pop up.
xdotool mousemove --sync 1000 10
#mouse left click on 'Yes' Button.
xdotool click 1
#Waits for browser to open 30 seconds is enough time for my Pi Model 2 change as you see fit.
sleep 30
#Activates the window which contains search word 'Chromium' and places mouse in top corner of window. This means that if you move the default window location the rest of the script will still work in the future, if we use relative movements:
xdotool search “Chromium” windowactivate --sync mousemove
#Move curser relative to 0 0 (top corner of window) to the point where your log in button is -- save your login details manually so you only have to click the yellow log in button
xdotool mousemove_relative --sync 0 80
# clicks log in button
xdotool click 1
#wait for the log in and token approval
sleep 5
#Close chromium window down
xdotool windowkill `xdotool getactivewindow`
#activate the OK button window that initially popped up.
xdotool search “Information” windowactivate --sync mousemove
#Move mouse over OK button
xdotool mousemove_relative --sync 0 80
# clicks OK button
xdotool click 1
#Move to terminal
xdotool search “terminal” windowactivate --sync mousemove
sleep 2
#Press spacebar and finish auto start Alexa
xdotool key space