• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

Script path with InDesign Server and jsx

New Here ,
Feb 16, 2017 Feb 16, 2017

Copy link to clipboard

Copied

I just started testing indesign server and my first noob question is how to get the path to my script for easier includes.

With a script in indesign I would do something like this:

var basePath = File(app.activeScript).parent + '/';

But app.activeScript is not defined in indesign server?

TOPICS
Scripting

Views

783

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
People's Champ ,
Feb 16, 2017 Feb 16, 2017

Copy link to clipboard

Copied

Perhaps $.filename?

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Feb 16, 2017 Feb 16, 2017

Copy link to clipboard

Copied

I get undefined.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
People's Champ ,
Feb 16, 2017 Feb 16, 2017

Copy link to clipboard

Copied

Sorry, typo: $.fileName

(Not sure if this works on Server, though).

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Feb 16, 2017 Feb 16, 2017

Copy link to clipboard

Copied

No error but no output. I wrote typeof($.fileName) to a file and it is a string but its empty.

I wrote this simple script that gives me a list of all values in an object and a strange/funny thing is that fileName changes after an $.evalFile() to the path of the included file. But if I run it without includes the string is empty.

output($);

function output( str ) {

  if( typeof( str ) == 'object') {

  var obj = str;

  var arr = [];

  for( param in obj ) {

  try {

  arr.push( param + ':\t' + obj[param] );

  } catch(e) {}

  }

  str = arr.join('\n');

  }

  var file = File('~/Desktop/output.txt');

  file.open('w');

  file.write(str);

  file.close();

}

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
People's Champ ,
Feb 17, 2017 Feb 17, 2017

Copy link to clipboard

Copied

LATEST

Funny enough the DOM for IDS stands app.activeScript is a valid property but when I try to use it I also get an error.

If you need to load libraries, you may need to use the full path if you can foresee it. Or rebuilt it dynamically using some base uri info that can be passed as argument to you indesign call.

FWIW

Loic

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines