Expand my Community achievements bar.

Adding Links to Files (not url's)

Avatar

Former Community Member
I'm working on a manufacturing flow that will tell operators everything they need to know about the step they're working on. Most steps have a Word Document and an AutoCAD (.dwg) file associated with them. How can I link to these files in my form?



I can put the path there (C:\Documents\test.doc) which will work but that's exactly what will show up in the field. I need it to have alternate text. For examaple the field would say "Test Procedure" and link to the file above. Or say ASSY-SW1234 and link to a .dwg file.



Thanks in advance,

Justin
2 Replies

Avatar

Level 5
The only way I know to do this with files, is to use a trusted Function that is loaded as part of the client startup in the javascripts folder.



If your target files are available on a web server you can use app.launchURL without the trusted function.



To achieve the link, you can add a read only text field with any default text you like "Click here for drawing", etc.

In the mouseUp event for the field add your code:



FOR URL: app.launchURL("http://www.adobe.com/", true);



FOR LOCAL FILE: openDataFileP("file://C:/temp/MyFile.txt");



The local file requires the following Trusted Function:



// OPEN A FILE VIA URL

openDataFileP = app.trustedFunction(function (sURL) {

app.beginPriv();

try {

var nDoc = app.launchURL(sURL, true);

} catch (err) {

app.alert("Error: " + err);

}

app.endPriv();

});



Good Luck

Mark