Skip to main content
apuwdm2
Inspiring
November 16, 2019
Answered

Hiding the .fm extension in variables

  • November 16, 2019
  • 11 replies
  • 1630 views

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

This topic has been closed for replies.
Correct answer frameexpert

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

11 replies

Barb Binder
Community Expert
Community Expert
October 29, 2020

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. 

 

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 

~Barb at Rocky Mountain Training
Inspiring
October 29, 2020

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. 

Inspiring
October 30, 2020

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!

Bob_Niland
Community Expert
Community Expert
October 29, 2020

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


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.

frameexpert
Community Expert
frameexpertCommunity ExpertCorrect answer
Community Expert
November 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

apuwdm2
apuwdm2Author
Inspiring
November 20, 2019

Hi Rick,

 

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

 

Thanks for your help,

 

Regards

 

Apurva

Bob_Niland
Community Expert
Community Expert
November 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 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).

apuwdm2
apuwdm2Author
Inspiring
November 20, 2019

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

apuwdm2
apuwdm2Author
Inspiring
November 17, 2019

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

 

 

apuwdm2
apuwdm2Author
Inspiring
November 17, 2019

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

 

Bob_Niland
Community Expert
Community Expert
November 17, 2019

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.

frameexpert
Community Expert
Community Expert
November 16, 2019

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;

 

apuwdm2
apuwdm2Author
Inspiring
November 16, 2019

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)?

Regards,
Apurva

Barb Binder
Community Expert
Community Expert
November 16, 2019

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

~Barb at Rocky Mountain Training