Skip to main content
Inspiring
January 24, 2025
Question

[Q] Can the VariableImporter script be triggered from ExtendScript?

  • January 24, 2025
  • 1 reply
  • 368 views

I am a huge fan of the VariableImporter script.

 

I was wondering whether I can trigger this script from ExtendScript. I'd be happy with running the default script, transposing the data and specifying the path to the CSV. I think I then need to be able to hit return twice for the script to run.

 

Background:

 

My workflow now is:

- generate an Illy file with ExtendScript

- run VariableImporter script manually to load a CSV

- run some post-processing on the Illy file

 

I guess I could write some ExtendScript code to load a CSV myself but I'm really happy with how VariableImporter works.

Any help appreciated.

1 reply

jduncan
Community Expert
Community Expert
January 26, 2025

You should just be able to evaluate the script file. Here's a helper function I use for executing other scripts from inside of a script. Let me know if this works for you? Cheers!

function runExternalScript(filePath) {
  f = new File(filePath);
  if (!f.exists) {
    alert("Script Not Found!\nThe script file was not found at the path\n" + filePath);
  } else {
    $.evalFile(f);
  }
}

 

Inspiring
February 4, 2025

Hi Duncan,

 

Great stuff, thank you very much. Would there also be ways to trigger the return button twice?

jduncan
Community Expert
Community Expert
February 5, 2025

Not from within the original script that calls the VariableImporter script... You could edit the VariableImporter script to skip any dialogs and just hardcode the values you want it to use. I'm not that familiar with it but it shouldn't be that hard.