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

File path script...

Explorer ,
May 28, 2018 May 28, 2018

Copy link to clipboard

Copied

I'm looking for a script that i can use in a text variable that returns the File Path of the document i'm working on which ONLY shows the FOLDER that the file is in. Any help would be appreciated. Thanks in advance.

TOPICS
Scripting

Views

1.7K

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
Community Expert ,
May 28, 2018 May 28, 2018

Copy link to clipboard

Copied

I have played with a new text variable that:

1) Includes the entire path

2) Manually converting the variable to text

3) Running a GREP find/change to isolate only the parent directory one level back from the saved InDesign file

I can’t script, but is this the sort of thing that you wish to automate? Obviously the problem of converting a variable to text is that it is no longer live.

So, changing step 2 and 3 to using a GREP paragraph style, rather than find/change will retain the live variable and automatically adjust the path so that only the parent folder is shown. The GREP just needs to be changed as there is no longer a change, only a find component (however this is proving to be easier said than done and I have hit a brick wall so far)…

Is this the kind of result that you are looking for?

How many different parent folder paths will there be and will there be further ones added in the future? Do you have full examples of the paths?

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
Explorer ,
May 29, 2018 May 29, 2018

Copy link to clipboard

Copied

Hi, Stephen. Thanks for your response. I cannot code either, but i was looking for something that would just give me the folder that the file resided in, not the whole path.

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
Community Expert ,
May 29, 2018 May 29, 2018

Copy link to clipboard

Copied

I understand, however I believe that you have not understood my posts. Follow the link in my 1st post to the solution that I offered in the other topic thread. I am not aware of a variable or easy method to just display the parent directory of the saved InDesign file. The full path is simply a means to an end, the GREP will automatically remove the unwanted path content, leaving the parent folder. The GREP will depend on your path structures, how they vary etc – as well as whether one uses a find/replace or find in a style.

Do you want to keep the variables “live” or is it OK to convert them to text?

Can you provide examples of the full paths, how they vary and how similar they are?

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
Explorer ,
May 29, 2018 May 29, 2018

Copy link to clipboard

Copied

I need the path to be live.

eg of full path

afp://Attilio.Attilio.local/Studio Data/DESIGN Z3 - PRIMARY/FOLDER SETUPS/concepts

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
Community Expert ,
May 29, 2018 May 29, 2018

Copy link to clipboard

Copied

Great! GREP is all about finding patterns… So can you share another 2 or 3, as what works for one may fail for another. This is not such a big deal as the GREP Style can contain multiple search conditions, however the ideal is a single search pattern to manage all possibilities.

EDIT: So the end result should be the bit in bold red, is that correct?

afp://Attilio.Attilio.local/Studio Data/DESIGN Z3 - PRIMARY/FOLDER SETUPS/concepts

__________________________

It’s not elegant (there are likely many better ways to get to the same result) – however this works for the single example provided so far:

grepstyle.png

The character style would be changed from magenta, to use a fill of none, and a font point size of 0.1pt to “hide” the unwanted text, perhaps with a large negative tracking value to try to tighten up the resulting unwanted space at the left hand side of the text frame.

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
Explorer ,
May 29, 2018 May 29, 2018

Copy link to clipboard

Copied

afp://Attiilio.Attilio.local/Attilio/Studio Z3/Time-sheets/2018/06 JUNE/Attilioafp://AZIMUTH01.Azimuth.local/Studio Data/DESIGN Z3 - TERTIARY/FONTS/Always packs

#yiv2119476322 * #yiv2119476322 a #yiv2119476322 body {font-family:Helvetica, Arial, sans-serif;}#yiv2119476322 h1, #yiv2119476322 h2, #yiv2119476322 h3, #yiv2119476322 h4, #yiv2119476322 h5, #yiv2119476322 h6, #yiv2119476322 p, #yiv2119476322 hr {}#yiv2119476322 .yiv2119476322button td {}

|

Adobe Community

|

File path script...

reply from Stephen_A_Marsh in InDesign Scripting - View the full discussionGreat! GREP is all about finding patterns… So can you share another 2 or 3, as what works for one may fail for another. This is not such a big deal as the GREP Style can contain multiple search conditions, however the ideal is a single search pattern to manage all possibilities.

Reply to this message by replying to this email, or go to the message on Adobe Community

Start a new discussion in InDesign Scripting by email or at Adobe Community

Following File path script... in these streams: Inbox

This email was sent by Adobe Community because you are a registered user.

You may unsubscribe instantly from Adobe Community, or adjust email frequency in your email preferences |

|

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
Community Expert ,
May 29, 2018 May 29, 2018

Copy link to clipboard

Copied

Thank you, please confirm or provide more detail on the following 2 questions:

1) Are the required directories to be extracted from the full path always the second last entry shown in red below?

afp://Attilio.Attilio.local/Studio Data/DESIGN Z3 - PRIMARY/FOLDER SETUPS/concepts

afp://Attiilio.Attilio.local/Attilio/Studio Z3/Time-sheets/2018/06 JUNE/Attilio

afp://AZIMUTH01.Azimuth.local/Studio Data/DESIGN Z3 - TERTIARY/FONTS/Always packs

FOLDER SETUPS

06 JUNE

FONTS

2) Using these examples, it appears that the target directory may be anywhere from 3, 4, 5 directory levels deep from the left hand side of the full path, is that correct (but always one back from the right)?

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
Community Expert ,
May 30, 2018 May 30, 2018

Copy link to clipboard

Copied

LATEST

attil  wrote

I need the path to be live.

eg of full path

Hi,

that would be done with an eventlistening mechanism hooked perhaps on an idleTask.

See this example by Loic: Re: Custom text variable from javascript

Also this: Re: Partial Filename Text Variable

Regards,
Uwe

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
Community Expert ,
May 28, 2018 May 28, 2018

Copy link to clipboard

Copied

This script may also be an option with some tweaks:

Add highly customized Text Variables to InDesign | Ozalto

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