It looks like you're new here. Sign in or register to get started.
postsaurav wrote: Hi, Here is that it can be done. I created a Form where i created a button and Onpush of that button i call a function that executes the program. RVal := RunExeFromNAV('notepad.exe',1,TRUE); Where RVal - ReturnValue From Function (GlOBAL Integer Variable). RunExeFromNAV Is Function. Here is the Function - PROCEDURE RunExeFromNAV@1102153000(CompletePath@1102153000 : Text[1024];WindowStyle@1102153001 : Integer;EOC@1102153002 : Boolean) OintReturnValue : Integer; VAR Laut@1102153005 : Automation "{F935DC20-1CF0-11D0-ADB9-00C04FD58A0B} 1.0:{72C24DD5-D70A-438B-8A42-98424B88AFB8}:'Windows Script Host Object Model'.WshShell"; ('Windows Script Host Object Model'.WshShell) Lint@1102153004 : Integer; BEGIN CREATE(Laut); OintReturnValue := Laut.Run(CompletePath,WindowStyle,EOC); CLEAR(Laut); END;
mohana_cse06 wrote: Did you check Automation 'Windows Script Host Object Model'.WshShell?
ObjectPath := '\\Servername\tmp\Debug\File.exe'; RunModally := FALSE; DummyInt := 1; CREATE(WshShell,FALSE,TRUE); WshShell.Run(ObjectPath,DummyInt,RunModally); CLEAR(WshShell);
OBJECT Codeunit 50125 Test Process { OBJECT-PROPERTIES { Date=14.08.13; Time=07:20:59; Modified=Yes; Version List=; } PROPERTIES { OnRun=BEGIN Process := Process.Process; ProcessStartInfo := ProcessStartInfo.ProcessStartInfo('c:\Windows\notepad.exe'); ProcessStartInfo.Arguments := 'c:\temp\SalesPurchDocRenumering.txt'; Process.Start(ProcessStartInfo); END; } CODE { VAR Process@1000000000 : DotNet "'System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'.System.Diagnostics.Process" RUNONCLIENT; ProcessStartInfo@1000000001 : DotNet "'System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'.System.Diagnostics.ProcessStartInfo" RUNONCLIENT; EVENT Process@1000000000::OutputDataReceived@89(sender@1000000001 : Variant;e@1000000000 : DotNet "'System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'.System.Diagnostics.DataReceivedEventArgs"); BEGIN END; EVENT Process@1000000000::ErrorDataReceived@90(sender@1000000001 : Variant;e@1000000000 : DotNet "'System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'.System.Diagnostics.DataReceivedEventArgs"); BEGIN END; EVENT Process@1000000000::Exited@91(sender@1000000001 : Variant;e@1000000000 : DotNet "'mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'.System.EventArgs"); BEGIN END; EVENT Process@1000000000::Disposed@92(sender@1000000001 : Variant;e@1000000000 : DotNet "'mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'.System.EventArgs"); BEGIN END; BEGIN END. } }
Comments
Here is that it can be done.
I created a Form where i created a button and Onpush of that button i call a function that executes the program.
RVal := RunExeFromNAV('notepad.exe',1,TRUE);
Where
RVal - ReturnValue From Function (GlOBAL Integer Variable).
RunExeFromNAV Is Function.
Here is the Function -
PROCEDURE RunExeFromNAV@1102153000(CompletePath@1102153000 : Text[1024];WindowStyle@1102153001 : Integer;EOC@1102153002 : Boolean) OintReturnValue : Integer;
VAR
Laut@1102153005 : Automation "{F935DC20-1CF0-11D0-ADB9-00C04FD58A0B} 1.0:{72C24DD5-D70A-438B-8A42-98424B88AFB8}:'Windows Script Host Object Model'.WshShell"; ('Windows Script Host Object Model'.WshShell)
Lint@1102153004 : Integer;
BEGIN
CREATE(Laut);
OintReturnValue := Laut.Run(CompletePath,WindowStyle,EOC);
CLEAR(Laut);
END;
Thanks & Regards,
Saurav Dhyani
Do you Know this About NAV?
Connect - Twitter | Facebook | Google + | YouTube
Follow - Blog | Facebook Page | Google + Page
Hi postsaurav,
thanks for the sharing
any txt file that i can test in my own?
there is no SHELL anymore
according this link --> http://msdn.microsoft.com/en-us/library/dd355282.aspx
only for 2009
-Mohana
http://mohana-dynamicsnav.blogspot.in/
https://www.facebook.com/MohanaDynamicsNav
now can execute
=D>
but is there a way if i want to send parameter (company name for example) ??
where should i put parameter?
Gunnar Gestsson
Microsoft Certified IT Professional
Dynamics NAV MVP
http://www.dynamics.is
http://Objects4NAV.com