forked from toursprung/iOS-Screenshot-Automator
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathinstallOnSimulator
executable file
·74 lines (65 loc) · 1.79 KB
/
installOnSimulator
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
#!/usr/bin/env osascript
on run argv
if count of argv < 2 then
logEvent("Usage: ./installOnSimulator PathToProject ProjectName iOSVersion(6.1,5.0)")
error number -128
end
set iOSVersion to item 3 of argv
set projectName to item 2 of argv
set projectPath to item 1 of argv
set posixProjectPath to (the POSIX path of projectPath)
tell application "Xcode"
open posixProjectPath
end tell
delay(20)
tell application "Xcode" to activate
try
tell application "System Events"
tell process "Xcode"
tell menu bar 1
tell menu bar item "Product"
tell menu 1
tell menu item "Scheme"
tell menu 1
-- Set the proper scheme if we're using workspaces (e.g. cocoapods)
click menu item projectName
end tell
end tell
end tell
end tell
end tell
end tell
tell process "Xcode"
tell menu bar 1
tell menu bar item "Product"
tell menu 1
tell menu item "Destination"
tell menu 1
-- Set the proper scheme if we're using workspaces (e.g. cocoapods)
click menu item ("iPhone " & iOSVersion & " Simulator")
end tell
end tell
end tell
end tell
end tell
end tell
tell process "Xcode"
tell menu bar 1
tell menu bar item "Product"
tell menu 1
click menu item "Run"
end tell
end tell
end tell
end tell
end tell
on error errMsg
logEvent ("Error: " & errMsg)
end try
end run
on logEvent(themessage)
-- All the recent events, results and error can be found at the give path
-- It can easily be opened with the regular "Console" app
set theLine to (do shell script "date +'%Y-%m-%d %H:%M:%S'" as string) & " " & themessage
do shell script "echo '" & theLine & "' >> ~/Library/Logs/AppleScript-events.log"
end log_event