Skip to main content

I am looking at how Comment Functionality works for different File types as Redline?

currently I have defined “doc” as view and “docx” as Redline type and expect to open comment with MS Word. however I still manually change the Redline copy from “Doc” to “Docx”.

The errorI get is “Can not start external Viewer application”.

This is just one example, I am trying to find out how Redline app works for each individual file type.

for example for a word file,Excel or Autocad?

Thanks,

Aida.

Do you have an external viewer application specified under your User Settings in document basic for redline documents?

 

Generally I think it works off the File Types tab under EDM Basic.  If the type is registered there and under your Windows machine, it should just open in its native application.  I would leave the External Application fields blank under User Settings and make sure you register those CAD and Office extensions in File Types.


Although it was not the intended way of working when the comment file functionality was designed a long time ago, it is possible to have a comment file for, say, and AutoCAD drawing (DWG), using Word (DOC). However, it can require some careful tweaking to get working. I once did an experiment where the External Redline Application (under User Settings in Docman) was set to a script (.cmd file). This script gets a file name sent in. I then had some logic in this script that opened Word. I also remember I had to do some file renaming to get it all to work. The comment file functionality expects files to be named in a very strict way, to work. For this to work at all, you need to have Word files (DOC or DOCX) setup as Document Type = Redline under Edm Basic. That might not be what you want, since you might also use those file types as originals. It might work though, but it was a long time since I tested.

If I find some time I might have a go at this again. If I do, it would be good if you could write more about your exact use case. What files are involved? What applications? Why? How would you use it? Etc.


Hi again,

I found my old hack. Please find it below. This is totally unsupported, of course. If it works, good for you, if not, bad luck… :)

Read the comments in the script carefully.

You will save the code below as redline_hack.cmd and save it somewhere on your PC.

@echo off

REM When debugging the script, put a REM before the line above so that

REM you can see what is happening.

REM **********************************************************************

REM

REM  This is a really ugly workaround to one of our comment file

REM  handling limitations, but it seems to work okay. It makes it

REM  possible to use the same application for redlining as you use for

REM  creating documents. This file has only been tested with Word as

REM  the comment application, but it should work for others as well.

REM

REM  HOW IT WORKS:

REM

REM  Main idea: You will use this script as the redline application

REM  defined in User Settings. Yes, it sounds crazy, but trust me, it

REM  works. The script will then take care of opening the correct

REM  application.

REM

REM  First it looks at the filename to see if it is a View or Edit

REM  comment file operation.

REM

REM  If it is Edit, then the script start the application with the

REM  copy of the original (Docman makes this copy), and then waits for

REM  the application to finish. When the application finish, the

REM  script makes a copy of the file the user saves (the one he

REM  comments) to a "fake" comment file (fake in the sense that it is

REM  only the original file, but with another name). This can then be

REM  checked in with Comment -> Check In (the file extension has to be

REM  registered of course).

REM

REM  For view, the script ignores the "order" of opening the original

REM  copy and instead renames the comment file and opens that. Hihi!

REM

REM  PREREQUISITES AND USAGE: 

REM

REM  1.

REM

REM  Register a file type named XCM in EDM Basic and set Document Type

REM  to REDLINE. If you do not want to use XCM as comment file

REM  extension you have to change it in the code below (in two places)

REM  to something else. The extension does not really matter; it

REM  happens to be that XCM is the comment file extension used in

REM  RxHighlight which our comment file functionality is designed

REM  around.

REM

REM  2.

REM

REM  Set this script (c:\...\redline_hack.cmd) as the redline

REM  application under User Settings.

REM 

REM  That's it, basically. Now you can do RMB -> Comment -> Edit on a

REM  document, get it opened in its original application, make

REM  comments there (like with the Review tools in Word) and save

REM  it. The script will then create a copy of the file into a comment

REM  file. This will then be checked in using RMB -> Comment -> Check

REM  In in Docman. Afterwards the comment file can be opened by doing

REM  RMB -> Comment -> View. The script will take care of renaming the

REM  comment file so that it can be opened in the original

REM  application.

REM

REM  IMPORTANT NOTE!!! If you run the application in another language,

REM  you might need to change "Redline" below to something else, and

REM  maybe also change the numbers used for the substring. For

REM  example, in Swedish/Svenska "Redline" should be replaced with

REM  "Kommentarsfil" and the number 7 below should be changed to 13.

REM

REM **********************************************************************

REM Put the filename into a variable, else the substring below will

REM not work (it seems.)

set filename=%~n1

REM Check if file name starts with "Redline". If it does, this is Edit

REM and not View.

IF /I "%filename:~0,7%" == "Redline" (

  echo Redline prefix found, which means this is Edit...

  echo Starting application...

  REM The WAIT parameter makes the script wait so that it can make a

  REM copy of the original file afterwards.

  start /WAIT "Starting application..." %1

  REM Copy the file the user saved into a comment file. The strange

  REM syntax with ~ and % and whatnot below is used to pick out the

  REM parts of the file name.

  copy /Y %1 "%~d1%~p1%~n1.XCM"

) ELSE (

    REM Must be Comment -> View operation

    echo No Redline prefix found, which means this is View...

    echo Renaming comment file...

    REM Delete original and rename the comment file so that it gets a

    REM normal extension that the application can open.

    del /Q /F %1

    move "%~d1%~p1%~n1.XCM" %1

    echo Starting application...

    start "Starting application..." %1

  )

)

REM Remove the comment from the pause below when you need to debug the

REM script.

REM pause

/Mathias

 

 

 


PS. The editor here in Community adds one extra empty line for each line of code. The script will still probably still work, but it might look fluffy…

 


You are an absolute legend Mathias,

I have just applied Apps 9 Update 16 into our test system (Currently on Update 10) and all of a sudden I am unable to attach documents due to an error relating to file types.

It seems that back in the 7.5 days my predecessor realised we could use a PDF program called Foxit Phantom PDF to redact documents so needed to use .PDF for both Original and Redline (which we aren’t supposed to be able to do) but he found that by creating an extension of ‘PDF ‘ (space at the end) he could bypass the logic and get away with using the PDF extension twice.

I can only assume this little hack was locked down between update 10 and 16 (Apps 9) as if I try to create a new extension with a space it gives me an error.


Now with your script I can modify the extensions in EDM_FILE from ‘PDF ‘ to ‘XCM’ and still give my users the ability to edit in Foxit and also have the ability to view/e-mail the documents in the correct format.

10/10


You are an absolute legend Mathias,

I have just applied Apps 9 Update 16 into our test system (Currently on Update 10) and all of a sudden I am unable to attach documents due to an error relating to file types.

It seems that back in the 7.5 days my predecessor realised we could use a PDF program called Foxit Phantom PDF to redact documents so needed to use .PDF for both Original and Redline (which we aren’t supposed to be able to do) but he found that by creating an extension of ‘PDF ‘ (space at the end) he could bypass the logic and get away with using the PDF extension twice.

I can only assume this little hack was locked down between update 10 and 16 (Apps 9) as if I try to create a new extension with a space it gives me an error.


Now with your script I can modify the extensions in EDM_FILE from ‘PDF ‘ to ‘XCM’ and still give my users the ability to edit in Foxit and also have the ability to view/e-mail the documents in the correct format.

10/10

Hi,

I’m glad to hear that the little hack worked :) And the “space trick” your predecessor used was a really ugly, and very “hidden” (it’s really hard to see a trailing space) hack that was meant to fail eventually.

So, you’re “faking” that you have an XCM file when you really have not (it’s really two PDF files), right?

If you have time, and for the benefit of others, perhaps you can provide some step-by-step details of your setup here? Just an idea.

@KristenGastaldo, can we have a Legend badge added to IFS Community, please? :)

/Mathias

 


That’s correct. 

My initial test seemed to work i.e. comment file shows text.xcm but when I edited it the batch file activated and opened it up in Foxit as the ORIGINAL was set to PDF allowing the user to then save as PDF to send to customer. I will hopefully run some further testing later today because I will want to run the batch file from a centralised network location rather than copying it to all local machines. Once I have it all proved out I will throw some details up.

 

Regards
Nathan


 

@KristenGastaldo, can we have a Legend badge added to IFS Community, please? :)

/Mathias

 

Legend is actually the top level of ranks, so I imagine it won’t be long until you’re there. Let me see what I can whip up in the meantime ;)


So, testing later today turned into 4 months later but I can confirm that I am now happy to go live with Update 16 with this fix in place. All testing shows it works and hasn’t fallen over yet!

Thanks again for the script @Mathias Dahl !


I’m glad it helped! :)

 


Just an FYI,

A small gotcha is that our users when using Foxit had their settings set to open PDF in a new tab and not a new window. The issue I found is that although the user closes the tab post-redaction the command window doesn’t shut as it’s expecting the application to close before it puts the changes into the XCM version so stays open.

It was only when they viewed a comment file later that the redactions hadn’t been added.

To get around this I have had the team update their settings in Foxit to ensure that each PDF opens in a new window.

Regards
Nathan


Just an FYI,

A small gotcha is that our users when using Foxit had their settings set to open PDF in a new tab and not a new window. The issue I found is that although the user closes the tab post-redaction the command window doesn’t shut as it’s expecting the application to close before it puts the changes into the XCM version so stays open.

It was only when they viewed a comment file later that the redactions hadn’t been added.

To get around this I have had the team update their settings in Foxit to ensure that each PDF opens in a new window.

Regards
Nathan

Ah, tricky one! Glad do you found the cause of the problem and a workaround.

So, did I understand it correctly that you are using a browser-based redlining/commenting software?

 


Just an FYI,

A small gotcha is that our users when using Foxit had their settings set to open PDF in a new tab and not a new window. The issue I found is that although the user closes the tab post-redaction the command window doesn’t shut as it’s expecting the application to close before it puts the changes into the XCM version so stays open.

It was only when they viewed a comment file later that the redactions hadn’t been added.

To get around this I have had the team update their settings in Foxit to ensure that each PDF opens in a new window.

Regards
Nathan

Ah, tricky one! Glad do you found the cause of the problem and a workaround.

So, did I understand it correctly that you are using a browser-based redlining/commenting software?

 

Not browser based, fully fledged program however it allows you to open multiple PDF’s in different tabs within the application (if that setting is switched on). 

All I did was switch that off forcing it to open a new instance of Foxit every time they open a PDF. That way it forces them to close the instance meaning the script can complete and write back to the XCM version successfully.

The other way round they would close the PDF tab but leave the application open meaning that it shuts down that particular PDF tab but as the others remain open so does the application. This in turn means that the script doesn’t detect the application closing so remains running and doesn’t copy the PDF update to the XCM file so when they check the redacted file it shows no redaction took place.

The workaround by turning off the tab setting is a small annoyance for one team but I wasn’t going to stop the Update 16 installation over a preference!

The only other issue is that some people just like closing open windows saying IMPORTANT - DO NOT CLOSE THIS WINDOW.

Regards
Nathan


Thanks, got it now.

It might have been possible to wait for the file not to be locked, instead of waiting for the application to close. But not all applications lock the files. So, a bit tricky to find a general solution perhaps.

Anyway, you found a solution that works for you, great!

The only other issue is that some people just like closing open windows saying IMPORTANT - DO NOT CLOSE THIS WINDOW.

LOL! If only people could “read what it says”, eh? :)

 


Thanks, got it now.

It might have been possible to wait for the file not to be locked, instead of waiting for the application to close. But not all applications lock the files. So, a bit tricky to find a general solution perhaps.

Anyway, you found a solution that works for you, great!

The only other issue is that some people just like closing open windows saying IMPORTANT - DO NOT CLOSE THIS WINDOW.

LOL! If only people could “read what it says”, eh? :)

 

Exactly! At the end of the day, it has worked with a bit of testing and training so 10/10 on this one Mathias. Thanks again!


Reply