"Shelling out" problem

ccbryan63
Member Posts: 115
Hello gentlefolk,
I am having trouble getting the Role Tailored client to run an outside program. Here is the error I am getting:
"This message is for C/AL programmers. The call to member Run failed: The system cannot find the file specified. (Exception from HRESULT: 0x80070002)."
The RTC is set up with the client on the workstation and the other two tiers on a single server. Here is the code in question. A couple of things to note: first, this same code runs without a hitch on the Classic side in NAV 2009. Secondly, if I point Docfile to a bogus path, I get the "EXE not found" confirm window.
So it's a NAV error saying it can't find the file, but I know it CAN find the file because if I point it elsewhere it gives me the confirm window. I confess I am puzzled. Any ideas? Thanks in advance...
I am having trouble getting the Role Tailored client to run an outside program. Here is the error I am getting:
"This message is for C/AL programmers. The call to member Run failed: The system cannot find the file specified. (Exception from HRESULT: 0x80070002)."
The RTC is set up with the client on the workstation and the other two tiers on a single server. Here is the code in question. A couple of things to note: first, this same code runs without a hitch on the Classic side in NAV 2009. Secondly, if I point Docfile to a bogus path, I get the "EXE not found" confirm window.
DocFile := 'F:\Old Storage Drive\Payroll_import\Payroll_Import.exe'; DocComp := ' "'+CONVERTSTR(COMPANYNAME,'.','_')+'"'; IF FILE.EXISTS(docfile) THEN BEGIN IF ISCLEAR(wShExec) THEN CREATE(wShExec,FALSE,TRUE); WshMode := 0; WaitForEndOfCommand := FALSE; ReturnCode := wShExec.Run(docfile + DocComp,WshMode,WaitForEndOfCommand); END ELSE IF CONFIRM('EXE Not FOUND!') THEN CurrPage.UPDATE(FALSE); END;
So it's a NAV error saying it can't find the file, but I know it CAN find the file because if I point it elsewhere it gives me the confirm window. I confess I am puzzled. Any ideas? Thanks in advance...
0
Comments
-
i don't think that your combination of your docfile + doccomp will find an existing file...
based on your code, it would be
F:\Old Storage Drive\Payroll_import\Payroll_Import.exe"mycompanyname"
and such a file can't exist...
i think your code is not correct, hereReturnCode := wShExec.Run(??docfile + DocComp??,WshMode,WaitForEndOfCommand);
0 -
Thanks Belias, I'll investigate that right away. But... the code as written works fine in NAV 2009 Classic... is there a difference in the way RTC passes instructions to the shell?0
-
I changed the code slightly so I could be certain of what the RUN command was working with:
docfile := 'F:\Payroll_import\Payroll_Import.exe'; docComp := ' "'+CONVERTSTR(COMPANYNAME,'.','_')+'"'; //THIS ONE WORKS WITH SHELL() cmdString := docfile + docComp; IF FILE.EXISTS(docfile) THEN BEGIN IF ISCLEAR(wShExec) THEN CREATE(wShExec,FALSE,ISSERVICETIER); WshMode := 0; WaitForEndOfCommand := FALSE; ReturnCode := wShExec.Run(cmdString,WshMode,WaitForEndOfCommand);
At the point of the Run, Nav debugger shows the value of cmdstring as "F:\Payroll_import\Payroll_Import.exe "Company Name, Inc_""
If I go to Start/Run and enter F:\Payroll_import\Payroll_Import.exe "Company Name, Inc." it works perfectly. "Company Name, Inc_" is correctly passed as a parameter. If I run this same code in NAV Classic it works just fine. The problem insn't in the syntax, unless RTC requires a different syntax. That's what I don't know... does anyone?
Thanks...0 -
oh, companyname is a parameter of the exe #-o
where's the exe file? i think on the client machine. if so, the service tier cannot read it. you have to put the exe file in a place accessible from service tier. (and with the correct path).0 -
That might be the problem... the path difference from the service tier. That gets immensely confusing, the whole 'where's the file?" thing. At this client it's crazy. For instance, on the server, the directory where the executable lives is "F:\Old Storage Drive\Payroll_Import\" but the client workstations are mapped directly to Old Storage Drive so for them the path is "F:\Payroll_Import". So I'm forever switching the path back and forth whenever I develop or deploy. But the service tier lives on the server, so maybe I need to go back to the 'Old Storage Drive' path... but of course that won't work for the Classic client. Sheesh.
Thanks man!0 -
ccbryan63 wrote:That might be the problem... the path difference from the service tier. That gets immensely confusing, the whole 'where's the file?" thing. At this client it's crazy. For instance, on the server, the directory where the executable lives is "F:\Old Storage Drive\Payroll_Import\" but the client workstations are mapped directly to Old Storage Drive so for them the path is "F:\Payroll_Import". So I'm forever switching the path back and forth whenever I develop or deploy. But the service tier lives on the server, so maybe I need to go back to the 'Old Storage Drive' path... but of course that won't work for the Classic client. Sheesh.
Thanks man!0
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
- 320 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