Inventsable / bombino-commands

Adobe CEP utility commands to supercharge dev workflow available through Node scripts or via terminal
5 stars 4 forks source link

Illustrator plugin based on Bombino not calling JSX on Windows #16

Open plugisto opened 1 year ago

plugisto commented 1 year ago

Hi Tom,

Illustrator: there is a problem with my plugin on Windows (as it seems). When trying to call jsx files with evalScript nothing happens. On Mac it works fine.

The plugin is based on Bombino (by @Tom Scharstein). I am using CEP 9, Node 16.0.0. Changing/setting PlayerDebugMode does not help.

Obvisiously I am missing something. Any idea what could be the issue here?

This is my package.json (hope that helps):

{
  "name": "omata-bomb",
  "version": "0.9.9",
  "private": true,
  "scripts": {
    "serve": "vue-cli-service serve",
    "build": "vue-cli-service build",
    "lint": "vue-cli-service lint",
    "help": "bombino-cmd help",
    "register": "bombino-cmd register",
    "sign": "bombino-cmd sign",
    "switch": "bombino-cmd switch",
    "update": "bombino-cmd update"
  },
  "dependencies": {
    "brutalism": "^2.3.2",
    "cep-spy": "^1.3.4",
    "chroma-js": "^2.4.2",
    "clamp": "^1.0.1",
    "cluecumber": "^0.1.1",
    "core-js": "^3.1.2",
    "gehenna": "^1.1.4",
    "lodash.throttle": "^4.1.1",
    "starlette": "^1.0.7",
    "tinycolor2": "^1.6.0",
    "vue": "^2.6.10",
    "vue-popperjs": "^2.3.0",
    "vue-router": "^3.1.6",
    "vue-smooth-dnd": "^0.8.1",
    "vue-split-panel": "^1.0.4",
    "vuex": "^3.3.0"
  },
  "devDependencies": {
    "@vue/cli-plugin-babel": "^4.0.0",
    "@vue/cli-plugin-eslint": "^4.0.0",
    "@vue/cli-service": "^4.0.0",
    "autoprefixer": "^9.8.8",
    "babel-eslint": "^10.0.1",
    "bombino-commands": "^1.0.4",
    "boxen": "^4.1.0",
    "chalk": "^2.4.2",
    "eslint": "^5.16.0",
    "eslint-plugin-vue": "^5.0.0",
    "fs-extra": "^8.1.0",
    "inquirer": "^7.0.0",
    "make-runnable": "^1.3.6",
    "ora": "^4.0.2",
    "postcss": "^7.0.39",
    "shelljs": "^0.8.3",
    "tailwindcss": "npm:@tailwindcss/postcss7-compat@^2.2.17",
    "types-for-adobe": "^1.5.0",
    "vue-template-compiler": "^2.6.10"
  },
  "eslintConfig": {
    "root": true,
    "env": {
      "node": true
    },
    "extends": [
      "plugin:vue/essential",
      "eslint:recommended"
    ],
    "rules": {},
    "parserOptions": {
      "parser": "babel-eslint"
    }
  },
  "postcss": {
    "plugins": {
      "tailwindcss": {},
      "autoprefixer": {}
    }
  },
  "browserslist": [
    "> 1%",
    "last 2 versions"
  ]
}
Inventsable commented 1 year ago

Hi Eugen, your dependencies are all up to date so the issue isn't specifically a brutalism/bombino one, but rather the filepaths being untreated in your App.vue file during the loadScript function and paths not being POSIX:

    loadScript(path) {
      path = path.replace(/\\/gm, "/"); // POSIX

      // Correctly loads a script regardless of whether Animate or regular CEP app
      if (!/FLPR/.test(spy.appName))
        this.csInterface.evalScript(`try {$.evalFile('${path}')} catch(err) {
          alert(err)
        }`);
      else
        this.csInterface.evalScript(
          `fl.runScript(FLfile.platformPathToURI("${path}"))`
        );
    },

Without the regex above, you'll get IOErrors in scripting on Windows showing the paths don't exist likely due to Windows treatment of \ characters in filepaths like C:\Users which become faulty strings of C:Users:

ice_screenshot_20230504-185421

With the modified loadScript snippet above Omata works as expected on Win10x64, AI 2022, CEP 11, Node 16.13.1 on my machine:

ice_screenshot_20230504-185757

ice_screenshot_20230504-185802

plugisto commented 1 year ago

Hi Tom,

I also wanted to thank you this way, too! That really solved it for me. Really great!

Just something I came across recently (maybe it helps you to improve bombino): When signing I always get an error message that the signing service did not work. I went in node_modules > bombino_commands and updated the lines with this service:

-tsa http://timestamp.digicert.com http://timestamp.digicert.com/

After that signing worked again.

Affected lines starting at 212: console.log( ${utils.osPrefix}ZXPSignCmd -sign ./${path}-tmp ./${rootpath}/archive/${path}.zxp ./${rootpath}/archive/temp1.p12 ${password} -tsa http://timestamp.digicert.com/ ); shell.exec( ${utils.osPrefix}ZXPSignCmd -sign ./${path}-tmp ./${rootpath}/archive/${path}.zxp ./${rootpath}/archive/temp1.p12 ${password} -tsa http://timestamp.digicert.com/ );

  if (includeZip)
    setTimeout(() => {
      shell.exec(
        `${utils.osPrefix}ZXPSignCmd -sign ./${path}-tmp ./${rootpath}/archive/${path}.zip ./${rootpath}/archive/temp1.p12 ${password} -tsa http://timestamp.digicert.com/`
      );
    }, 1000);

If it helps you I can post an issue on Github. Let me know!

Best, Eugen

P.S.: Have you seen my other plugin “OMATA AI”? https://exchange.adobe.com/apps/cc/109684/omata-ai https://exchange.adobe.com/apps/cc/109684/omata-ai

It is similar to KlutzGPT. I started working on it in January. Justin Taylor was bit quicker than me with KlutzGPT. I remember that you mentioned on the Bolt Discord that may Illustrator users would be interested in this. It is not bad for writing scripts :)

On 5. May 2023, at 04:09, Tom Scharstein @.***> wrote:

Hi Eugen, your dependencies are all up to date so the issue isn't specifically a brutalism/bombino one, but rather the filepaths being untreated in your App.vue file during the loadScript function and paths not being POSIX:

loadScript(path) {
  path = path.replace(/\\/gm, "/"); // POSIX

  // Correctly loads a script regardless of whether Animate or regular CEP app
  if (!/FLPR/.test(spy.appName))
    this.csInterface.evalScript(`try {$.evalFile('${path}')} catch(err) {
      alert(err)
    }`);
  else
    this.csInterface.evalScript(
      `fl.runScript(FLfile.platformPathToURI("${path}"))`
    );
},

Without the regex above, you'll get IOErrors in scripting on Windows showing the paths don't exist likely due to Windows treatment of \ characters in filepaths like C:\Users which become faulty strings of C:Users:

https://user-images.githubusercontent.com/37279677/236364413-4e937e4c-acc2-4a07-bcce-73a022d3fef5.png With the modified loadScript snippet above Omata works as expected on Win10x64, AI 2022, CEP 11, Node 16.13.1 on my machine:

https://user-images.githubusercontent.com/37279677/236364517-fde62d37-f075-4162-8d62-4a65a7e334f3.png https://user-images.githubusercontent.com/37279677/236364520-66c3d689-6421-48b1-b6a9-ae3fd0ace6a2.png — Reply to this email directly, view it on GitHub https://github.com/Inventsable/bombino-commands/issues/16#issuecomment-1535610066, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAADIUZ2XSMYP53SIR2JSW3XERONTANCNFSM6AAAAAAXWFL63E. You are receiving this because you authored the thread.