forked from toursprung/iOS-Screenshot-Automator
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathHelper.js
executable file
·30 lines (25 loc) · 835 Bytes
/
Helper.js
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
function captureLocalizedScreenshot(prefix, name)
{
var target = UIATarget.localTarget();
var model = target.model();
var rect = target.rect();
if (model.match(/iPhone/))
{
if (rect.size.height > 480) model = "iphone5";
else model = "iphone";
}
else
{
model = "ipad";
}
var orientationName = "portrait";
if (rect.size.height < rect.size.width) orientationName = "landscape";
var language = target.frontMostApp().preferencesValueForKey("AppleLanguages")[0];
var parts = [language, model, name];
var imageName = prefix + parts.join("-");
//using application frame to generate screenshots without the status bar.
var application = target.frontMostApp();
var applicationFrame = application.rect();
target.captureRectWithName(applicationFrame, imageName);
//target.captureScreenWithName(imageName);
}