Skip to main content
This topic has been closed for replies.

2 replies

JJMack
Community Expert
Community Expert
May 5, 2018

I would not think a URL would work.  I remote access may also require each user ID have share access to the remote file and would definitely need a network connection.  I would not think using a UNC a network uneverasel access address a good thing to use in Photoshop scripts.

JJMack
SuperMerlin
Inspiring
May 5, 2018

This works for me.

N.B. the first line of you script MUST have #target photoshop; as this is used to find the begining of the script!

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 = "UTF-8";

          HTTPFile.prototype.getFile = function(f) {

                    var typeMatch = this.url.match(/(\.)(\w{3,4}\b)/g);

                    if (this.conn.open(this.domain,"UTF-8")) {

                              this.conn.write(this.call);

                              this.reply = this.conn.read(9999999999);

                              this.conn.close();

                    } else {

                              this.reply = "";

                    }

                    return this.reply.substr(this.reply.indexOf("#t")-1);

          };

}

var estkFile = new HTTPFile("http://www.yadayada.com/folder/fileName.jsx");

eval(estkFile.getFile());