diff --git a/GraphicExport.as b/GraphicExport.as index 45c7a03..09edae0 100644 --- a/GraphicExport.as +++ b/GraphicExport.as @@ -111,8 +111,7 @@ private function WrapperData(e:ProgressEvent) { var data:String = wrapper.readUTF(); - DispatchCommand(com.adobe.serialization.json.JSON.decode(data)); - SendCommand({command:"done"}); + DispatchCommand(com.adobe.serialization.json.JSON.decode(data)); } private function DispatchCommand(msg) @@ -122,11 +121,17 @@ var cmd = msg.command; switch (cmd) { + case "job": + + break; case "quit": Log("Quitting"); fscommand("quit"); NativeApplication.nativeApplication.exit(); break; + case "log": + Log(cmd.string); + break; default: Log("Sent command: " + com.adobe.serialization.json.JSON.encode(msg)); break; diff --git a/GraphicExport.as b/GraphicExport.as index 45c7a03..09edae0 100644 --- a/GraphicExport.as +++ b/GraphicExport.as @@ -111,8 +111,7 @@ private function WrapperData(e:ProgressEvent) { var data:String = wrapper.readUTF(); - DispatchCommand(com.adobe.serialization.json.JSON.decode(data)); - SendCommand({command:"done"}); + DispatchCommand(com.adobe.serialization.json.JSON.decode(data)); } private function DispatchCommand(msg) @@ -122,11 +121,17 @@ var cmd = msg.command; switch (cmd) { + case "job": + + break; case "quit": Log("Quitting"); fscommand("quit"); NativeApplication.nativeApplication.exit(); break; + case "log": + Log(cmd.string); + break; default: Log("Sent command: " + com.adobe.serialization.json.JSON.encode(msg)); break; diff --git a/exporter.py b/exporter.py index 3bcd3c0..d565b65 100755 --- a/exporter.py +++ b/exporter.py @@ -127,9 +127,14 @@ return {"type": args["type"] if "type" in args else 1, \ "scale": args["scale"] if "scale" in args else 1} +num_jobs_sent = 0 def send_cmd(conn, base_cmd, in_file): + global num_jobs_sent + num_jobs_sent += 1 cmd = dict(base_cmd) + cmd["command"] = "job" cmd["input"] = in_file + cmd["job_num"] = num_jobs_sent send_msg(conn, cmd) def send_msg(conn, msg): @@ -174,6 +179,10 @@ if cmd == "print" and "string" in msg: sys.stdout.write(msg["string"]) sys.stdout.flush() + if cmd == "done" and "job_num" in msg: + job_num = int(cmd["job_num"]) + if job_num == num_jobs_sent: + quit = True buf = "" quit = False