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

Hiding the .fm extension in variables

Participant ,
Nov 16, 2019 Nov 16, 2019

Copy link to clipboard

Copied

Hi All,

 

Requesting a solution for a query that has been discussed earlier, but I am not able to fully understand the replies.

 

I have a book in FM 2019 with around 100 documents. Each document has a table, whose Table Title should be the same as the Document Title.

  • Does a variable exist that has only the document title without the .fm extension? For example, I have a document called Oil Pump.fm that has a table that should have the same name, but without the .fm extension. I have tried to use <$chaptertitlename> or <$filename> variable but the inserted text is always "Oil Pump.fm" and not the desired "Oil Pump."
  • Is it possible to create a variable that uses the file/document name without adding the .fm extension?
  • If I can't have a variable free of the .fm extension, is there a method of 'Find and Replace' that will replace the "Oil Pump.fm" text in the Table Title with just "Oil Pump"?

 

Thanks in advance for your help.

 

Regards


Apurva

TOPICS
Formatting and numbering , Scripting

Views

731

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

correct answers 2 Correct answers

Community Expert , Nov 17, 2019 Nov 17, 2019

A filename extension (.fm, .book) is not strictly necessary. If your document file, for example, is just named "sample", you can right-click open it in FM, and the system variable Filename (Short) will render as "sample". If you insist on having a file to work with that has the .fm extension, I tested this with FM2019 & Win7/64p:

  1. In Windows Explorer (file manage), right-click
    new
    » Adobe Framemaker Document

  2. Edit default name [New Adobe FrameMaker Document.fm]
    to [sample] with no extension
    ignore warn

...

Votes

Translate

Translate
Community Expert , Nov 17, 2019 Nov 17, 2019

The ExtendScript Toolkit SHOULD install with FrameMaker but if it doesn't, you can download it from Adobe's website.

https://helpx.adobe.com/download-install/kb/creative-cloud-apps-download.html

Votes

Translate

Translate
Participant ,
Nov 16, 2019 Nov 16, 2019

Copy link to clipboard

Copied

Replying to my own question with a wish to help someone who has a similar query.
The answer probably lies in not in using Variables but inserting a Cross-Reference to a Paragraph Style that contains the <$paratext> - the document's name. Still working on a perfect solution that works for all files in the book, but the results look encouraging.

 

Regards,

 

Apurva

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 ,
Nov 16, 2019 Nov 16, 2019

Copy link to clipboard

Copied

I think a cross-reference is the solution. The other option is to create a user variable but if the file name changes, you will need to update the variable definition to reflect the new filename.

 

~Barb

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 ,
Nov 16, 2019 Nov 16, 2019

Copy link to clipboard

Copied

Another hack is to have the FM document file name lack the .fm extension. You can create a shortcut (symlink) with the same name, and author via that, but the Filename (Short) variable will not have a .fm extension.

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
Participant ,
Nov 16, 2019 Nov 16, 2019

Copy link to clipboard

Copied

Hi Barb,

 

How do I automate the cross-reference in the Table Title field? Is there a variable/cross-reference/code that I can add in the Autonumber Paragraph>Fomat window of Table Title paragraph style that will automatically copy the document's title (without the .fm)?snip.png

Regards,
Apurva

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 ,
Nov 16, 2019 Nov 16, 2019

Copy link to clipboard

Copied

Hi Apurva,

This looked like a fun challenge so I made a short video (about 10 minutes) explaining how I might do this. It requires some scripting but the script could be applied automatically by making it into a "Notification" script. The code that I demonstrated is below.

http://www.rickquatro.com/resources/FileNameInTableTitle.mp4 

#target framemaker

var doc, file;

doc = app.ActiveDoc;
file = new File (doc.Name).name;
file = File.decode (file);
file = file.replace (/\.fm$/i, "");

doc.SectionNumStyle = Constants.FV_NUMSTYLE_TEXT;
doc.SectionNumText = file;

 

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
Participant ,
Nov 16, 2019 Nov 16, 2019

Copy link to clipboard

Copied

Hi Rick,

 

Thanks for explaining your solution through this great video.

 

How do I get the scripting tool that you are using? And my knowlege of coding is very rudimentary and I don't have any tools on computer except Notepad and Notepad++.

 

Regards


Apurva

 

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
Participant ,
Nov 16, 2019 Nov 16, 2019

Copy link to clipboard

Copied

Hi Bob,

 

Thanks for your reply. Request you to show implementation your solution in a step-by-step manner. I have only Framemaker 2019 on my computer, do I need to get any other utilities?

 

Regards

 

Apurva

 

 

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 ,
Nov 17, 2019 Nov 17, 2019

Copy link to clipboard

Copied

The ExtendScript Toolkit SHOULD install with FrameMaker but if it doesn't, you can download it from Adobe's website.

https://helpx.adobe.com/download-install/kb/creative-cloud-apps-download.html

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
Participant ,
Nov 20, 2019 Nov 20, 2019

Copy link to clipboard

Copied

Hi Rick,

 

I appreciate your inputs and links. Will definitely try the scripting approach to numbering very soon.

 

Thanks for your help,

 

Regards

 

Apurva

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 ,
Nov 17, 2019 Nov 17, 2019

Copy link to clipboard

Copied

A filename extension (.fm, .book) is not strictly necessary. If your document file, for example, is just named "sample", you can right-click open it in FM, and the system variable Filename (Short) will render as "sample". If you insist on having a file to work with that has the .fm extension, I tested this with FM2019 & Win7/64p:

  1. In Windows Explorer (file manage), right-click
    new
    » Adobe Framemaker Document

  2. Edit default name [New Adobe FrameMaker Document.fm]
    to [sample] with no extension
    ignore warning about change file type
    Notice that the directory view loses the FM icon, and file association for file "sample".

  3. Right-click New » Shortcut
    Location of item:
    Browse to (in my case) {drive}:\...path...\Adobe\FrameMaker\Tests\sample
    [Next]
    Type a name for this {new} shortcut:
    sample.fm
    Notice that it also has no association (and can't be given one).

  4. Right-click sample.fm with FM.

  5. View » Master pages
    In header text frame,
    Insert
    » Variables » Filename (Short)
    Notice that it's just "sample", with no extension.

Personally, I don't do this. I've always used a user variable to define the document name. In a prior assignment, file names were part numbers (e.g. 123-456.fm), and we wanted to show the p/n in the docs, but not the .fm extension.

 

For a current project (a .book), the document name, and indeed all the layouts, formats, color, conditions, etc. are actually defined in a separate file (template.fm). All the book component files are easily kept in sync by doing an import » formats from the template file.

 

This filename extension annoyance is likely a lingering effect of FM’s roots on Unix, which never really had a filename extension concept (relying instead on “magic numbers” for file typing). Indeed, FM didn't even have a convention for it on Windows until FM4 or so (I was using .mkr until Adobe decide to use .fm).

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
Participant ,
Nov 20, 2019 Nov 20, 2019

Copy link to clipboard

Copied

Hi Bob,

 

I appreciate the detailed reply to my query. Due to pressure of delivery, I copied the filename via manual cross-referencing, but definitely will try your method in the next job, due very soon. Thanks once again.

 

Regards


Apurva

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 ,
Oct 29, 2020 Oct 29, 2020

Copy link to clipboard

Copied

Can you show the structure of a user created variable that would add the document name to the header? I tried to follow the steps above and my document has no file extension showing in Windows Explorer but does show the .fm in the header of the template I am working on. 

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 ,
Oct 30, 2020 Oct 30, 2020

Copy link to clipboard

Copied

I actually found an easier way fo doing this by renaming the file in the book menu of FrameMaker. When viewing the filename it shows the .fm extension. I removed. the .fm from the filename from that menu and the .fm dropped off the document name in the system variable. Thank you for the suggestions!

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 ,
Oct 30, 2020 Oct 30, 2020

Copy link to clipboard

Copied

LATEST

Hi Dustin,

 

When you did this in the book, you actually changed the file name. When you want to open this file in FrameMaker double-clicking will not work. Windows relies on this extension to select the appropriate application. You can probably still open the file from the book.

 

Best regards

 

Winfried

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 ,
Oct 29, 2020 Oct 29, 2020

Copy link to clipboard

Copied

Dustin Fleming: Can you show the structure of a user created variable that would add the document name to the header?

I'm not sure which prior remark this is in response to, but strictly speaking a User Variable, of arbitrary name, would contain any arbitrary text you desired. The variable could then be inserted in a header frame on desired Master Pages, and would appear on all Body pages that map any of those MPs.

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 ,
Oct 29, 2020 Oct 29, 2020

Copy link to clipboard

Copied

Hi @Dustin Fleming:

 

Can you show the structure of a user created variable that would add the document name to the header? 

To add the filename to the running head, use the <$filename> building block as shown below. example.png

 

I recognize that this post is about not showing the extension in the running head (like Bob, I prefer to show extensions). Do note that if you want to hide the extension in the running head, you will need to follow the steps that Bob laid out to rename your files.

 

my document has no file extension showing in Windows Explorer but does show the .fm in the header of the template I am working on.

As a default, Windows will hide extensions for known file types. And Windows will recognize the .fm if FrameMaker is installed, and therefore will hide it in Explorer unless you change this default (see link below). Just because Windows is hiding the extension does not mean that it isn't part of the file name. 

https://www.howtogeek.com/205086/beginner-how-to-make-windows-show-file-extensions/ 

 

~Barb 

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 ,
Oct 30, 2020 Oct 30, 2020

Copy link to clipboard

Copied

Hi Dustin,

 

When your file names do not have an extension in Windows Explorer, then the option Hide extensions for known file types is activated. When this option is activated, your file names in Windows Explorer will also show the extensions.

FrameMaker always shows the file name extension in its filename variable.

When you want to hide the file name extension in FrameMaker, you would need an ExtendScript or FrameScript script to do this.

 

Best regards

 

Winfried

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