Need help with alternate to SHELL

lombie
Member Posts: 15
Hi Everyone,
I have created a .Net application that creates a PDF for a MSSQL reporting services report we have created and expects 5 parameters.
I can successfully run it whit the standard Nav SHELL comand as below:
Ret := SHELL(ApplicationString, ReportId, RunMode, FORMAT(inSalesInvoiceRec."Sell-to Customer No."), FORMAT(inSalesInvoiceRec."No."), YearTxt);
Typically this would translate to something like this:
Ret := SHELL('\\someshare\myapp.exe', 'PDFINVOICE', '1', '1234', 'INV123456', '2012');
This works really well except for the untrusted application message. As I need to run this application 100s of times per run from a code unit I need bypass this message.
I have tried to use a 'Microsoft Shell Controls And Automation'.Shell object but I get error message attached. I've read multiple posts on this topic and I'm still hitting my head up against a brick wall. ](*,) ](*,) ](*,)
I have included my code below.
What am I missing???
Cheers
I have created a .Net application that creates a PDF for a MSSQL reporting services report we have created and expects 5 parameters.
I can successfully run it whit the standard Nav SHELL comand as below:
Ret := SHELL(ApplicationString, ReportId, RunMode, FORMAT(inSalesInvoiceRec."Sell-to Customer No."), FORMAT(inSalesInvoiceRec."No."), YearTxt);
Typically this would translate to something like this:
Ret := SHELL('\\someshare\myapp.exe', 'PDFINVOICE', '1', '1234', 'INV123456', '2012');
This works really well except for the untrusted application message. As I need to run this application 100s of times per run from a code unit I need bypass this message.
I have tried to use a 'Microsoft Shell Controls And Automation'.Shell object but I get error message attached. I've read multiple posts on this topic and I'm still hitting my head up against a brick wall. ](*,) ](*,) ](*,)
I have included my code below.
What am I missing???
Cheers
VAR global WSHShellObj@1000000001 : Automation "{F935DC20-1CF0-11D0-ADB9-00C04FD58A0B} 1.0:{72C24DD5-D70A-438B-8A42-98424B88AFB8}:'Windows Script Host Object Model'.WshShell"; VAR local Ret@1100011 : Integer; ShellString@1100012 : Text[256]; WinStyle@1100013 : Variant; IF ISCLEAR(WSHShellObj) THEN CREATE(WSHShellObj); ShellString := ApplicationString + ',' + ReportId + ',' + RunMode + ',' + FORMAT(inSalesInvoiceRec."Sell-to Customer No.") + ',' + FORMAT(inSalesInvoiceRec."No.") + ',' + YearTxt; WinStyle := 1; WSHShellObj.CurrentDirectory := PDFGenCtrlRec."Console Applcation Folder"; ret := WSHShellObj.Run(ShellString, WinStyle); CLEAR(WSHShellObj);
0
Comments
-
When using WSHShell.Run you should do something like this:
Result := WshShell.Run("C:\My Folder\MyApp.exe" PutAllParametersHere, WindowStyle, WaitForFinish);
Frank Dickschat
FD Consulting0 -
Thank you Frank that did the trick sort of. This removed the NAV untrusted warning but now I get the Windows untrusted warning (see attached image). To get around this we had to add our file share to a trusted local intranet site in internet explorer.
=D> \:D/VAR global WSHShellObj@1000000001 : Automation "{F935DC20-1CF0-11D0-ADB9-00C04FD58A0B} 1.0:{72C24DD5-D70A-438B-8A42-98424B88AFB8}:'Windows Script Host Object Model'.WshShell"; VAR local Ret@1100011 : Integer; ShellString@1100012 : Text[256]; WinStyle@1100013 : Variant; WaitForFinish@1100014 : Boolean; IF ISCLEAR(WSHShellObj) THEN CREATE(WSHShellObj); ShellString := ApplicationString + ' ' + ReportId + ' ' + RunMode + ' ' + FORMAT(inSalesInvoiceRec."Sell-to Customer No.") + ' ' + FORMAT(inSalesInvoiceRec."No.") + ' ' + YearTxt; WinStyle := 1; WaitForFinish := TRUE; WSHShellObj.CurrentDirectory := PDFGenCtrlRec."Console Applcation Folder"; ret := WSHShellObj.Run(ShellString, WinStyle, WaitForFinish); CLEAR(WSHShellObj);
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