Exe file is not running from Navision Classic Client
 
            
                
                    Aravindh_Navision                
                
                    Member Posts: 258                
            
                        
            
                    Hi Friends,
I need to run an rece1.exe file (from Navision) which fetches a text file and sends to another application. For that I used the SHELL command in menuitem's OnPush() trigger and tried to run it. It just runs the command prompt's and it is not trigerring the rece1.exe file. I have given the variable and code used below. Can anyone help me where I am going wrong?
Thanks in advance,
Aravindh
                I need to run an rece1.exe file (from Navision) which fetches a text file and sends to another application. For that I used the SHELL command in menuitem's OnPush() trigger and tried to run it. It just runs the command prompt's and it is not trigerring the rece1.exe file. I have given the variable and code used below. Can anyone help me where I am going wrong?
Name          DataType          Subtype	
---------------------------------------------------------------------------------
varShell          Automation          'Microsoft Shell Controls And Automation'.Shell	
OnPush()
---------
CREATE(varShell);
varShell.Open('C:\Program Files\WSFEV1\rece1.exe');
CLEAR(varShell);
Thanks in advance,
Aravindh
0                
            Comments
- 
            Why can't you just use C\AL SHELL macros?[ReturnCode]:= SHELL(Name [, Param, ...]) Sincerely yours, GRIZZLY
 Follow my blog at http://x-dynamics.blogspot.com0
- 
            Thanks for your reply Grizzly. Am very new to Shell concept. Can you please explain me more in detail?0
- 
            Take a look at the built-in help:
 SHELL
 Use this function to execute external programs and operating system commands from C/AL programs. You can run this function modally or non-modally, depending on whether or not you include the return value from the external program in your code.
 [ReturnCode]:= SHELL(Name [, Param, ...])
 ReturnCode
 Data type: integer
 ReturnCode is used for two different purposes:
 First, if ReturnCode is used, the external program will be run modally, while it will be run non-modally if ReturnCode is not used. For instance, if you want to go to the operating system and get a directory listing and then bring that information back into the system, include ReturnCode. Omit ReturnCode if you want to run the external program non-modally. For instance, if all you want to do is pass information (such as a name and address) to a standardized letter that is set up in a word processor, you would omit the ReturnCode.
 Second, ReturnCode can contain the return value of the external program. Since external programs can return different codes to reflect whether errors occurred during the execution of the program, the values stored in ReturnCode depend on the external program.
 Name
 Data type: text or code
 The path and name of the command. When you enter the path, keep in mind these shortcuts:
 You can...
 If the command is located...
 Omit the drive designation
 On the current drive
 Omit the full path
 In the current directory
 Enter only the subdirectory name
 In a subdirectory of the current directory
 Param,...
 Data type: text or code
 One or more optional arguments sent with the external program or command.
 The parameter(s) cannot be passed as part of the Name argument. The Name argument must be filled in and it must not contain any parameters except for the executable. The parameter information must be hard coded into the system as a text constant or as a variable.
 The SHELL function has been designed so that each user can create a list of trusted executables. This list is maintained in the user’s zup file. The way this function works depends on whether the executable is given as a text constant or as a variable.
 Text Constant
 If the name of the executable is passed to the SHELL function as a text constant the executable is trusted and the user is not prompted to confirm that they trust the executable. This is also the case when the executable (text constant) is called with a number of other arguments that have been assigned manually.
 Variable
 If the name of the executable is passed to the SHELL function as a variable the executable is not trusted and the user is prompted to confirm whether or not they trust the executable the first time it is called. Once the user has confirmed that they trust the executable it can be called again at any time without their having to confirm that they trust it.
 Microsoft Dynamics NAV Application Server
 The SHELL function can only be used with a text constant on Microsoft Dynamics NAV Application Server.
 Example
 OBJECT Codeunit 98123 SHELL ex
 {
 OBJECT-PROPERTIES
 {
 Date=30-08-04;
 Time=14:12:57;
 Modified=Yes;
 Version List=;
 }
 PROPERTIES
 {
 OnRun=BEGIN
 // The following is NOT trusted and will give a warning:
 ExecName := 'C:\windows\notepad.exe';
 param := 'C:\MyFile.txt';
 ret := SHELL(ExecName, param);
 // The following IS trusted and will not give a warning:
 param := 'C:\MyFile.txt';
 ret := SHELL(TEXT000, param);
 //The following is not possible - will only give an error
 //message during runtime. This is also if it's a TextConst:
 ExecName := 'C:\windows\notepad.exe C:\MyFile.txt';
 ret := SHELL(ExecName);
 END;
 }
 CODE
 {
 VAR
 ret@1000 : Integer;
 param@1001 : Text[30];
 TEXT000@1002 : TextConst 'ENU=C:\windows\notepad.exe';
 ExecName@1003 : Text[30];
 BEGIN
 END.
 }
 }
 Documentation FeedbackSincerely yours, GRIZZLY
 Follow my blog at http://x-dynamics.blogspot.com0
Categories
- All Categories
- 73 General
- 73 Announcements
- 66.6K Microsoft Dynamics NAV
- 18.7K NAV Three Tier
- 38.4K NAV/Navision Classic Client
- 3.6K Navision Attain
- 2.4K Navision Financials
- 116 Navision DOS
- 851 Navision e-Commerce
- 1K NAV Tips & Tricks
- 772 NAV Dutch speaking only
- 617 NAV Courses, Exams & Certification
- 2K Microsoft Dynamics-Other
- 1.5K Dynamics AX
- 323 Dynamics CRM
- 111 Dynamics GP
- 10 Dynamics SL
- 1.5K Other
- 990 SQL General
- 383 SQL Performance
- 34 SQL Tips & Tricks
- 35 Design Patterns (General & Best Practices)
- 1 Architectural Patterns
- 10 Design Patterns
- 5 Implementation Patterns
- 53 3rd Party Products, Services & Events
- 1.6K General
- 1.1K General Chat
- 1.6K Website
- 83 Testing
- 1.2K Download section
- 23 How Tos section
- 252 Feedback
- 12 NAV TechDays 2013 Sessions
- 13 NAV TechDays 2012 Sessions
