SHELL and Path File

Hi everybody. I Need some help. I’m not a real coder: I mean, I just know a bit of C/AL. The problem seems to be really silly but I still can’t solve it. Shortly: every teacher(vendor) must bring his training aid for every class, no matter the file extension. I had then to link a File Path to the Item card; I’ve created a new field (Text) an I let the user browse and select the file. I do this trough the OCX Common Dialog.This is the Code I’ve used: [i]OCcommonDialog.InitDir(PathToFind); OCcommonDialog.Filter(’.’); OCcommonDialog.ShowOpen; NomeFile := OCcommonDialog.FileName; which returns the File Name. So The DB field contains a value like \servername\Project\ClassRoom\MaterialStuff.pdf Well: the system must let the user open this file whenever he want… but I don’t know how to use the SHELL o HIPERLINK command properly. If I simply pass the field value I get an Error message like your operating system cannot open the program “\servername\Project\ClassRoom\MaterialStuff.pdf” Please Ensure that the program is installed and can be run… Does anyone know how to work it out? Thanks in advance. Fab.

I forgot: the problem is to open the file no matter the kind of file chosen, without mapping every file extension to launch a different .exe . I mean: is there a way to avoid coding like CASE TypeFile OF… and pass a different program + file ‘c:\Program Files\Microsoft Office\Office11\WINWORD’+’‘stuff.dot’) ‘c:\Program Files\Microsoft Office\Office11\WINPROJ’+’ ‘c:\Program Files\Microsoft Office\Office11\EXCEL’+’ Thanks!

Well, if you want to use the SHELL command, then you have to specify the program you want to execute to open a specific file, e.g. SHELL('"C:\Program Files\Adobe\Acrobat\Reader\AcroRd32.exe"', '\\servername\Project\ClassRoom\MaterialStuff.pdf'); Using the HYPERLINK command just opens/runs a file with the associated program, e.g. HYPERLINK('\\servername\Project\ClassRoom\MaterialStuff.pdf'); should open the file with “Acrobat Reader” - if this is the in Windows associated program.

Jou can use automation… In C/Al Globals shellEx → date Type-Automation; subtype - ‘Microsoft Shell Controls And Automation’.Shell In code CREATE(shellEx); shellEx.Open(fullFileName); CLEAR(shellEx); Regards.

quote:

I forgot: the problem is to open the file no matter the kind of file chosen, without mapping every file extension to launch a different .exe . I mean: is there a way to avoid coding like CASE TypeFile OF… and pass a different program + file ‘c:\Program Files\Microsoft Office\Office11\WINWORD’+’‘stuff.dot’) ‘c:\Program Files\Microsoft Office\Office11\WINPROJ’+’ ‘c:\Program Files\Microsoft Office\Office11\EXCEL’+’ Thanks!
Originally posted by fmanzella - 2005 May 25 : 14:32:32

I’m trying to do something similar, so I tested both the suggestions. Both seem to work greatly with local files (C:\Program Files…), but none works with a server name. [:(] When the path is something like \servername\Project\ClassRoom\Document.doc, HYPERLINK tries to launch Internet Explorer which fails; the Shell automation does nothing. [V] Did you have any better luck? Anna

Try this: HYPERLINK(‘file:\aserver\afile.txt’);

The Microsoft Shell Controls And Automation.Shell works properly, thanks a lot. P.S. Anna: even with a server path!!

quote:

The Microsoft Shell Controls And Automation.Shell works properly, thanks a lot. P.S. Anna: even with a server path!!
Originally posted by fmanzella - 2005 May 27 : 10:06:15

So why isn’t it working for me? What’s the installed OCX? Anna

quote:

Try this: HYPERLINK(‘file:\aserver\afile.txt’);
Originally posted by PeterD - 2005 May 27 : 09:38:03

It says C/SIDE hyperlinking requires Windows 95 or NT 4.0. I have XP! [V] Anna

quote:

quote:
Try this: HYPERLINK(‘file:\aserver\afile.txt’);
Originally posted by PeterD - 2005 May 27 : 09:38:03

It says C/SIDE hyperlinking requires Windows 95 or NT 4.0. I have XP! [V] Anna
Originally posted by Anna Perotti - 2005 May 27 : 15:52:06

MY FAULT, MY FAULT, MY FAULT!!![:I] Anna

I have WINXP and no problem with hyperlinking.

quote:

I have WINXP and no problem with hyperlinking.
Originally posted by PeterD - 2005 May 27 : 16:14:16

Yeah! I was trying to open a file which did no exist. [8)] Sorry. Anna

Rather than code this, you really should look at the Matriks doc AddOn, I recommend this to every client I have worked with. (I don’t get a comission though [V] ) http://www.matriks.com/

quote:

Rather than code this, you really should look at the Matriks doc AddOn, I recommend this to every client I have worked with. (I don’t get a comission though [V] ) http://www.matriks.com/
Originally posted by David Singleton - 2005 Jun 06 : 20:03:58

I agree! [:)] I showed that to my customer long ago. He said it was a wonderfull tool then asked me to do something similar… I not even could disengage myself by telling him it couldn’t be done! [}:)] Maybe I’ll give you my customer’s address, should you succeed in selling Matriksdoc to him, you’ll surely get a commission by me! [:D] Anna

I don’t need a commission, I’ve been selling it now for 9 or 10 years, and it save me so much time on every installation, that I don’t need any thing more. I really believe it to be the best Navision Add-On ever.