GeezerVisonThe World Wide Web, restored to 800 pixels of glory. |
| Home|About|Gaming cabinet|Archives|How it works|Starter sites |
GeezerVison is showing github.com — ExtendScript/ExtendScript.py at develop · runegan/ExtendScript Expand file tree/ Copy pathExtendScript.pyMore file actions 99 lines (73 loc) · 2.77 KB / Copy pathExtendScript.pyFile metadata and controls99 lines (73 loc) · 2.77 KB 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 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 import os import sys import fileinput import re import shutil import subprocess import sublime import sublime_plugin class ExtendScriptCommand(sublime_plugin.TextCommand): def init(self): self.currentFile = self.view.file_name() self.currentPath = os.path.dirname(self.currentFile) self.settings = sublime.load_settings("ExtendScript.sublime-settings") def copyToSoftwareFolder(self, softwarePath): # Changing the extension scriptFolderPath = self.settings.get(softwarePath + '_path') file_name = re.sub(r'.*/(.*)\..*$', r'\1.jsx', self.currentFile) self.destination_file = scriptFolderPath + file_name # Copying the file to desination shutil.copyfile(self.currentFile, self.destination_file) def compileEsFile(self): file_handle = open(self.destination_file, 'r') file_string = file_handle.read() file_handle.close() file_output = "" for line in file_string.splitlines(): file_output = file_output + '\n' + self.makeReplacements(line) file_handle = open(self.destination_file, 'w') file_handle.write(file_output) file_handle.close() def makeReplacements(self, line): output = line if self.settings.get('compile_includes'): if re.match(r'.*#include', line): output = self.replaceIncludes(line) if self.settings.get('set_debug_false'): if re.match(r'.*debug = .*', line): output = self.replaceDebug(line) return output def replaceIncludes(self, line): path = re.sub(r'.*#include \"(.*)\";?', r'\1', line) path = self.currentPath + "/" + path with open(os.path.abspath(path)) as f: fileContent = f.read() return fileContent def replaceDebug(self, line): return re.sub(r'debug = true', r'debug = false', line) class BuildForIndesign(ExtendScriptCommand): def run(self, edit): self.init() self.copyToSoftwareFolder('id') self.compileEsFile() class BuildForIllustrator(ExtendScriptCommand): def run(self, edit): self.init() self.copyToSoftwareFolder('ai') self.compileEsFile() class BuildForPhotoshop(ExtendScriptCommand): def run(self, edit): self.init() self.copyToSoftwareFolder('ps') self.compileEsFile() class BuildForAfterEffects(ExtendScriptCommand): def run(self, edit): self.init() self.copyToSoftwareFolder('ae') self.compileEsFile() class OpenEstk(ExtendScriptCommand): def run(self, edit): self.init() subprocess.call( 'open -a "ExtendScript Toolkit" '+self.currentFile, shell=True) |
| You are visitor 01402520 — GeezerVison does not store the pages you look up. Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required. |