[solved] Shell parameters

ccbryan63
Member Posts: 115
Hi folks. I am calling from Navision out to a program that I wrote in VB.NET. The VB program takes 2 parameters. The VB code that accepts the parameters is as follows:
Dim MyStartupArguments()
MyStartupArguments = System.Environment.GetCommandLineArgs
When I call it from Start > Run with the following syntax it works perfectly.
When the VB app starts in this way, the MyStartupArguments array looks like this:
MyStartupArguments(0) = 'e:\Costing_VBdotNET3\Costing.exe'
MyStartupArguments(1) = 'SHEET'
MyStartupArguments(2) = '10-3025'
However I am having trouble getting it to run from Navision with this syntax:
I keep getting a VB error telling me that "index is outside the bounds of the array" and referencing the line "MyStartupArguments = System.Environment.GetCommandLineArgs." Since the MyStartupArguments array is not of any predefined length, how is this happening? I can only think that Navision presents its parameters differently... in columns rather than rows? Any ideas?
Thanks,
Chandler
Dim MyStartupArguments()
MyStartupArguments = System.Environment.GetCommandLineArgs
When I call it from Start > Run with the following syntax it works perfectly.
e:\Costing_VBdotNET3\Costing.exe SHEET 10-3025
When the VB app starts in this way, the MyStartupArguments array looks like this:
MyStartupArguments(0) = 'e:\Costing_VBdotNET3\Costing.exe'
MyStartupArguments(1) = 'SHEET'
MyStartupArguments(2) = '10-3025'
However I am having trouble getting it to run from Navision with this syntax:
TypeVar := 'SHEET' ; Item := '10-3025' ; SHELL('e:\Costing_VBdotNET3\Costing.exe', TypeVar, Item);
I keep getting a VB error telling me that "index is outside the bounds of the array" and referencing the line "MyStartupArguments = System.Environment.GetCommandLineArgs." Since the MyStartupArguments array is not of any predefined length, how is this happening? I can only think that Navision presents its parameters differently... in columns rather than rows? Any ideas?
Thanks,
Chandler
0
Comments
-
Try
TypeVar := 'SHEET' ; Item := '10-3025' ; SHELL(STRSUBSTNO('e:\Costing_VBdotNET3\Costing.exe "%1" "%2"', TypeVar, Item));
1) The " around the variables makes sure the parameter is send to the exe as 1 parameter in case it has characters that would divide it.
2) I remember there was some bug with the SHELL of an older version of Navision, but I don't remember until which version. But 3.10 is in it.
You can also use this instead of SHELL : http://www.mibuso.com/forum/viewtopic.php?t=12417Regards,Alain Krikilion
No PM,please use the forum. || May the <SOLVED>-attribute be in your title!0 -
Thank you Kriki! Worked first time. Sorry for the double post.
Chandler0
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