function FontSniff() {
var fonts = [];
var allItems = app.project.items;
// for each item in the project
for (i=1; i <= allItems.length; i++) {
var curItem = allItems[i];
// check if this item is a composition
if (curItem instanceof CompItem) {
var allLayers = curItem.layers;
// for every layer in the composition
for (j=1; j <= allLayers.length; j++) {
var curLayer = allLayers[j];
// check if it is a text layer
if (curLayer instanceof TextLayer) {
// ok now just grab the font name and put it in the fonts array!
var textProp = curLayer.property("Source Text");
var textDocument = textProp.value;
fonts.push(textDocument.font);
}
}
}
}
if (fonts.length < 1) {
return false;
} else {
// we's got'z fontz!
return fonts;
}
}
alert(FontSniff());
{
var theTextLayer = app.project.activeItem.selectedLayers[0];
var HTTPFile = function (url,port) {
if (arguments.length == 1) {
url = arguments[0];
port = 80;
};
this.url = url;
this.port = port;
this.httpPrefix = this.url.match(/http:\/\//);
this.domain = this.httpPrefix == null ? this.url.split("/")[0]+":"+this.port :this.url.split("/")[2]+":"+this.port;
this.call = "GET "+ (this.httpPrefix == null ? "http://"+this.url : this.url)+" HTTP/1.0\r\nHost:" +(this.httpPrefix == null ? this.url.split("/")[0] :this.url.split("/")[2])+"\r\nConnection: close\r\n\r\n";
this.reply = new String();
this.conn = new Socket();
this.conn.encoding = "binary";
HTTPFile.prototype.getFile = function(f) {
var typeMatch = this.url.match(/(\.)(\w{3,4}\b)/g);
if (this.conn.open(this.domain,"binary")) {
this.conn.write(this.call);
this.reply = this.conn.read(9999999999);
this.conn.close();
} else {
this.reply = "NOTHING";
}
return this.reply.substr(this.reply.indexOf("\r\n\r\n")+4);;
};
}
var hyle = new HTTPFile("http://www.google.com");
//alert();
theTextLayer.property("Source Text").setValue(hyle.getFile());
}
var HTTPFile = function (url,port) {
if (arguments.length == 1) {
url = arguments[0];
port = 80;
};
this.url = url;
this.port = port;
this.httpPrefix = this.url.match(/http:\/\//);
this.domain = this.httpPrefix == null ? this.url.split("/")[0]+":"+this.port :this.url.split("/")[2]+":"+this.port;
this.call = "GET "+ (this.httpPrefix == null ? "http://"+this.url : this.url)+" HTTP/1.0\r\nHost:" +(this.httpPrefix == null ? this.url.split("/")[0] :this.url.split("/")[2])+"\r\nConnection: close\r\n\r\n";
this.reply = new String();
this.conn = new Socket();
this.conn.encoding = "binary";
HTTPFile.prototype.getFile = function(f) {
var typeMatch = this.url.match(/(\.)(\w{3,4}\b)/g);
if (this.conn.open(this.domain,"binary")) {
this.conn.write(this.call);
this.reply = this.conn.read(9999999999);
this.conn.close();
} else {
this.reply = "";
}
return this.reply.substr(this.reply.indexOf("\r\n\r\n")+4);;
};
}
var hyle = new HTTPFile("http://hyle.io/version");
alert(hyle.getFile());
var myFrameRate = parseFloat(prompt("Please enter the frame rate."));
myComp.frameRate = myFrameRate;