This repository has been archived by the owner on May 8, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathAutoCydiaImpactor.scpt
111 lines (96 loc) · 3.4 KB
/
AutoCydiaImpactor.scpt
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
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
#@matsuo3rd 2019
#inspired from AutoImpactor v2.0 / https://github.com/Shmadul/AutoImpactor
# Download ClicClick at https://github.com/BlueM/cliclick
# Download SleepDisplay at https://github.com/bigkm/SleepDisplay/zipball/master
set AppleUsername to "APPLE_ID_EMAIL"
set ApplePassword to "APPLE_ID_PASSWORD"
set IPAPath to POSIX path of "IPA_PATH"
set DeviceLabel to "DEVICE_LABEL"
set CliClickPath to "CLICLICK_PATH"
set SleepDisplayPath to "SLEEPDISPLAY_PATH"
set targetDevice to null
# Wakeup Screen - if Screen is Sleeping / cliclick (selecting target device) will not work
if SleepDisplayPath is not null then
log "Wakeup Display"
do shell script SleepDisplayPath & " -wake"
end if
log "Launching Impactor"
tell application "Impactor" to activate
# Search for TargetDevice in Devices Combo Box
log "Looking for Device " & DeviceLabel
tell application "System Events" to tell process "Impactor"
click button 1 of combo box 2 of window "Cydia Impactor"
delay 0.25
set devices to (text fields of list 1 of scroll area 1 of combo box 2 of window "Cydia Impactor")
set devicesCount to (count devices)
if devicesCount ≥ 1 then
repeat with device in devices
set deviceName to value of device
if deviceName = DeviceLabel then
set targetDevice to device
exit repeat
end if
end repeat
end if
# Get TargetDevice position in Combo Box
log "Looking for Device's dropdown list x,y position"
if targetDevice is not null then
log "Device Found"
tell targetDevice
set {xPosition, yPosition} to position of targetDevice
set {xSize, ySize} to size
end tell
set {realXPosition, realYPosition} to {(xPosition + (xSize div 2)) as string, (yPosition + (ySize div 2)) as string}
else
log "Device Not Found"
display dialog "Could not find Target Device " & DeviceLabel
error number -128
end if
end tell
# Click Target Device
log "Clicking on Device at m:" & realXPosition & "," & realYPosition & " dc:" & realXPosition & "," & realYPosition
tell application "System Events" to tell process "Impactor"
click button 1 of combo box 2 of window "Cydia Impactor"
end tell
do shell script CliClickPath & " m:" & realXPosition & "," & realYPosition & " dc:" & realXPosition & "," & realYPosition
delay 0.25
log "Launching Install Package... menu"
tell application "Impactor" to activate
tell application "System Events"
tell process "Impactor"
click menu item "Install Package..." of menu 1 of menu bar item "Device" of menu bar 1
end tell
end tell
delay 0.25
# Select IPA file
log "Entering IPA file " & IPAPath
#tell application "System Events"
tell application "System Events" to tell process "Impactor"
keystroke "G" using {shift down, command down}
delay 0.5
keystroke IPAPath
delay 0.5
keystroke return
delay 2
keystroke return
delay 2
end tell
#"Apple ID Username"
log "Entering Apple ID Username " & AppleUsername
tell application "System Events" to tell process "Impactor"
set value of text field 1 of window "Apple ID Username" to AppleUsername
click button "OK" of window "Apple ID Username"
end tell
delay 1
#"Apple ID Password"
log "Entering Apple ID Password"
tell application "System Events" to tell process "Impactor"
set value of text field 1 of window "Apple ID Password" to ApplePassword
click button "OK" of window "Apple ID Password"
end tell
# Wait for IPA sideload to complete and quit Cydia Impactor
log "Waiting before quitting Impactor"
delay 60
tell application "Impactor"
quit
end tell