Highlighted

Invoking XSLT from Extendscript - where to put the XSLT file?

Explorer ,
Sep 27, 2018

Copy link to clipboard

Copied

I'm growing increasingly fond of invoking XSLT from FrameMaker Extendscript. I can now consolidate formerly multi-tool, multi-step workflows into a single Extendscript.

But ... in scripts for distribution to others, I don't know where to put the XSLT file. FrameMaker wants a fully-qualified path for the XSLT stylesheet. My AppData folder seems right for "me", but the path will vary with the user. And without a fully-qualified path, FrameMaker looks for the XSLT stylesheet in the FrameMaker application folder -- not really an option because of Windows filesystem protections.

I don't want to tell my customers to "edit the Extendscript to point to your copy of the XSLT stylesheet". I could set the location in a config file, but even that doesn't seem optimal. How have others handled this issue?

-Alan

--

Alan Houser

Group Wellesley, Inc.

Consultant and Trainer, Technical Publishing

arh on Twitter

412-450-0532

Hi Alan,

You can refer to the user's AppData folder like this:

$.getenv ('AppData');

On my system that gives me the path of the User's AppData/Roaming folder.

~Ian

TOPICS
Scripting

Views

447

Likes

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

Invoking XSLT from Extendscript - where to put the XSLT file?

Explorer ,
Sep 27, 2018

Copy link to clipboard

Copied

I'm growing increasingly fond of invoking XSLT from FrameMaker Extendscript. I can now consolidate formerly multi-tool, multi-step workflows into a single Extendscript.

But ... in scripts for distribution to others, I don't know where to put the XSLT file. FrameMaker wants a fully-qualified path for the XSLT stylesheet. My AppData folder seems right for "me", but the path will vary with the user. And without a fully-qualified path, FrameMaker looks for the XSLT stylesheet in the FrameMaker application folder -- not really an option because of Windows filesystem protections.

I don't want to tell my customers to "edit the Extendscript to point to your copy of the XSLT stylesheet". I could set the location in a config file, but even that doesn't seem optimal. How have others handled this issue?

-Alan

--

Alan Houser

Group Wellesley, Inc.

Consultant and Trainer, Technical Publishing

arh on Twitter

412-450-0532

Hi Alan,

You can refer to the user's AppData folder like this:

$.getenv ('AppData');

On my system that gives me the path of the User's AppData/Roaming folder.

~Ian

TOPICS
Scripting

Views

448

Likes

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
Sep 27, 2018 0
Enthusiast ,
Sep 27, 2018

Copy link to clipboard

Copied

Hi Alan,

You can refer to the user's AppData folder like this:

$.getenv ('AppData');

On my system that gives me the path of the User's AppData/Roaming folder.

~Ian

Likes

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
Reply
Loading...
Sep 27, 2018 2
Explorer ,
Sep 27, 2018

Copy link to clipboard

Copied

Ian,

Thank you! I should have asked if the standard FrameMaker environment variables are available in Extendscript. You've answered my question!

-Alan

Likes

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
Reply
Loading...
Sep 27, 2018 0
Enthusiast ,
Sep 27, 2018

Copy link to clipboard

Copied

Pleased to help. There's another way which may work, but I've had problems with previously...

When you use ExtendScript's File or Folder objects you can use a tilde to indicate the user's home directory like this:

~/MyAppFolder/ which, on my system, would map to C:\Users\Ian\MyAppFolder\

Ian

Likes

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
Reply
Loading...
Sep 27, 2018 1
Engaged ,
Sep 27, 2018

Copy link to clipboard

Copied

Alan,

you can also use properties of FrameMaker session object (app)

CurrentDir

BinDir

TmpDir

HomeDir

InitDir

SGMLDir

StructureDir

XmlDir

HelpDir

UserSettingsDir

UserHomeDir

UserHomeDir points to %appdata%/Adobe/FrameMaker/[version]

Not sure about UserSettingsDir, but I'm sure you'll find out

Hope this helps.

Markus

Likes

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
Reply
Loading...
Sep 27, 2018 1
Engaged ,
Sep 27, 2018

Copy link to clipboard

Copied

Thanks Ian,

wasn't Aware of that $.getenv function.

Will save me some time in future 🙂

Markus

Likes

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
Reply
Loading...
Sep 27, 2018 1