mibuso.com

Microsoft Business Solutions online community
It is currently Tue May 21, 2013 12:13 am

All times are UTC + 1 hour [ DST ]




Post new topic Reply to topic  [ 20 posts ]  Go to page 1, 2  Next
Author Message
 Post subject: Shell Command with warning message
PostPosted: Fri May 20, 2005 11:34 am 
Offline

Joined: Thu Apr 29, 2004 5:50 am
Posts: 30
Location: SG
Country: Singapore (sg)
Dear All,

Regarding to the shell command which execute the external application.

SHELL('C:\Program Files\Microsoft Office\OFFICE11\WINWORD.EXE');

But I really confused about the warning message which display when shell command will be called.
The warning message is...

"You are about to run the following executeable for the first time:
Executable:C:\Program Files\Microsoft Office\OFFICE11\WINWORD.EXE
Parameter:
Please be aware that you may be running an executable that could potentially harm your computer.
Do you trust this executable and its parameter?"

I knows it will be display only at the first time, but I don't want it pop up anyway. How can I blocked this warnig message?????

Thank you in advance.


Top
 Profile  
 
 Post subject:
PostPosted: Fri May 20, 2005 3:54 pm 
Offline

Joined: Thu Dec 02, 2004 12:31 pm
Posts: 31
Location: Münster
Country: Germany (de)
hi uto,

i found no way to solve this problem directly. the used commands are recorded in the zup-file, every command that is commited will not produce a warning until you delete the zup-file.

the problem increases if you work with varying parameters, e.g. doc names for word. the warning will appear once for every new shell string and client.

we did a workaround by using an ocx, which reveices and executes the command. :?


Top
 Profile  
 
 Post subject:
PostPosted: Fri May 20, 2005 5:00 pm 
Offline

Joined: Thu Dec 02, 2004 12:31 pm
Posts: 31
Location: Münster
Country: Germany (de)
hi again,

maybe you can download it from here on monday (depending on the velocity of our best webmaster).

the download is named "oyster". (it all tasts like shells :D )


Top
 Profile  
 
 Post subject:
PostPosted: Fri May 20, 2005 5:35 pm 
Offline

Joined: Fri Feb 28, 2003 5:53 pm
Posts: 275
Location: Dordrecht
Country: Netherlands (nl)
Hi

Dont know why this 1-time message bothers you but well here is a way to circumvent, create this function in Navision and use it instead of the standard shell function:

Code: Select all
MyShell(Application : Text[1024])
CREATE(lclsShell);
lclsShell.Run(Application);
CLEAR(lclsShell);


lclsShell is a local variable of type automation and subtype 'Windows Script Host Object Model'.WshShell

Jan-Pieter


Top
 Profile E-mail  
 
 Post subject:
PostPosted: Tue May 24, 2005 10:17 am 
Offline

Joined: Thu Apr 29, 2004 5:50 am
Posts: 30
Location: SG
Country: Singapore (sg)
Hi Toene & Janpieter

Thank you for your help. But I still stucked in this problem. I'm waiting for your OCX , Toene. And I had tried to code follow Janpieter's sample, but it's not work properly. Maybe it is my misunderstand. :cry: Janpieter , can u explain me for more details?

MyShell(RunApplication : Text[1024])
CREATE(lclsShell);
lclsShell.Run(RunApplication);
CLEAR(lclsShell);

This is the function which created in the codeunit and the function is called by the command button (on form). When I press the button , it will displayed the following error message :

"This message is for C/AL programmers:

An exception was raised in method run. The OLE controls or Automation server has returned error(HRESULT) -2147352567.
The component did not provide the exception description."

So what is my misunderstand? ](*,) Please suggest.


Top
 Profile  
 
 Post subject:
PostPosted: Tue May 24, 2005 10:22 am 
Offline

Joined: Thu Dec 02, 2004 12:31 pm
Posts: 31
Location: Münster
Country: Germany (de)
if you send me an email with your email address, i'll send the ocx. i did upload it, but it hasn't appeared yet.


Top
 Profile  
 
 Post subject:
PostPosted: Tue May 24, 2005 1:19 pm 
Offline

Joined: Fri Feb 28, 2003 5:53 pm
Posts: 275
Location: Dordrecht
Country: Netherlands (nl)
dont know what is going wrong.

For example i can use:
Code: Select all
MyShell('NotePad.exe');


and this works fine.

Maybe you must experiment with other applications (it may be the application you use causing an error). Also look at how you use slashes and if the path excist etcetera.


Top
 Profile E-mail  
 
 Post subject:
PostPosted: Wed May 25, 2005 5:27 am 
Offline

Joined: Thu Apr 29, 2004 5:50 am
Posts: 30
Location: SG
Country: Singapore (sg)
Hi

First , I wanna say "Thank you" to you all.

I had tried for every suggestion. First , I tried to code follow Janpieter's suggest. I found something!!! #-o It's works propery for the short path parameter. Coz I tried to execute the application which stored in the "c:\front" and it's works. But for the same application which stored in the other folder (eg. "C:\Program Files\Microsoft Business Solutions-Navision\Front" ) It's still pop up the error msg as I told you. Then I tried to use the ocx's tonne , and now it's works propery for all paths. \:D/

Thank you, Janpieter & Tonne. =D>

uto


Top
 Profile  
 
 Post subject:
PostPosted: Wed May 25, 2005 8:13 am 
Offline

Joined: Tue Mar 15, 2005 10:07 am
Posts: 16
Location: Skanderborg
Country: Denmark (dk)
Hi all
May I add that perhaps the error message has nothing to do with Navision, but may come from firewall or virus protection programs running on the same system. :-k

Best Rgds
Torben


Top
 Profile  
 
 Post subject:
PostPosted: Thu May 26, 2005 6:57 am 
Offline

Joined: Thu Dec 09, 2004 6:06 am
Posts: 105
Country: Malaysia (my)
Hi uto, u can try coding below. But i don't whether work for u?


Pls define a automation variable called "laum_Shell",
Datatype = Automation
SubType = 'Microsoft Shell Controls And Automation'.Shell


Coding
=====
CREATE(laum_Shell);
laum_Shell.Open('C:\Program Files\Microsoft Office\OFFICE11\WINWORD.EXE');
CLEAR(laum_Shell);


Top
 Profile  
 
 Post subject:
PostPosted: Thu May 26, 2005 11:55 am 
Offline

Joined: Thu Apr 29, 2004 5:50 am
Posts: 30
Location: SG
Country: Singapore (sg)
Hi all,

Thank you for your help. I had tried to do follow bestianhow's code and it's works fine. I don't need to remove the execute to the others folder and regist the ocx. I think the customer should prefer this solution. (I also because it can reduce my works :lol: )
B.T.W. I think all solutions are good for the different situation. No one is the best but all are good.

Thank you for your helps. =D> =D> =D>

Uto


Top
 Profile  
 
 Post subject:
PostPosted: Wed Jun 22, 2005 12:32 pm 
Offline

Joined: Wed Jun 22, 2005 11:23 am
Posts: 4
Location: Hamm
Country: Germany (de)
Hi

The Code from bestianhow works fine but i have a problem with parameters after the exe.
It doesn't run.

Can everybody help.


HMR


Top
 Profile  
 
 Post subject: Late Changes documentation Navision 4.0
PostPosted: Wed Jun 22, 2005 5:21 pm 
Offline

Joined: Mon May 30, 2005 5:53 pm
Posts: 7
Location: Germany
Country: Germany (de)
Hello,

i find the follwoing note in the Late Changes documentation of Navision 4.0.
***

C/SIDE
The following changes have been made in C/SIDE:
SHELL Function
You use this C/AL function to execute external programs and operating
system commands.
The syntax for this function is:
[ReturnCode]:= SHELL(Name [, Param, ...])
In previous versions of Navision, you could pass the parameter(s) as part
of the Name argument – for example,
SHELL(“C:\Windows\Notepad.exe MyFile.txt”)
In Navision 4.0, you can no longer pass the parameter 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
now be hard coded into the system as a text constant or as a variable.
The SHELL function has been redesigned 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.
***

Hope this helps solving the problem.


Top
 Profile E-mail WWW  
 
 Post subject:
PostPosted: Thu Jun 30, 2005 11:53 am 
Offline

Joined: Wed Jun 22, 2005 11:23 am
Posts: 4
Location: Hamm
Country: Germany (de)
Hi,

thank you for your Message :) .

Can i eliminate the message "run at first time" ?.

Every parameters to send with the exe are different.

It's nerves every time to close the Message.


Can everybody help.


HMR


Top
 Profile  
 
 Post subject:
PostPosted: Mon Nov 14, 2005 6:59 pm 
Offline

Joined: Wed Feb 23, 2005 10:39 am
Posts: 37
Location: Altendiez
Country: Germany (de)
I have the same Problem - does anyboday have an solution ???

Hello HMR,

I had the same situation : Executing external Programs with different Parameters - and I solved it using "Oyster" from the Download-section


Last edited by aod on Wed Nov 16, 2005 9:05 am, edited 1 time in total.

Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 20 posts ]  Go to page 1, 2  Next

All times are UTC + 1 hour [ DST ]


Who is online

Users browsing this forum: No registered users and 8 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum


Search for:
Jump to: