Automation Object

SuperSage77SuperSage77 Member Posts: 101
I want use an Automation Object "'Windows Script Host Object Model'.WshShell" in a Report but when I want to compile it I have the following error message " impossible to load the select library".

And when I run the report I have another error message"
The message is for C/AL programmers:
An execption was raised in method Run.The Automation as returned error(HRESULT)-2147352567.The component did not provide the execption description. I make my tests on a PC with Windows XP SP2.

Can you help me for this.


R.Weinling

My new e-mail adress is rudy.weinling@wanadoo.fr

Comments

  • AlbertvhAlbertvh Member Posts: 516
    Hi Rudy
    Have you done this
    Declare the variable

    Name DataType Subtype Length
    WsShell Automation 'Windows Script Host Object Model'.WshShell

    and in your code
    IF ISCLEAR(WsShell) then
    CREATE(WsShell);
  • AlbertvhAlbertvh Member Posts: 516
    Hi Rudy
    Thanks for the PM but better to post on the forum
    Hi Albertvh,

    Thank's for your answer but I have this code
    IF ISCLEAR(WsShell) then
    CREATE(WsShell);

    But I think that this error message appear only on my PC for Test (with XP SP2).In my customer the FileServer irun with 2000 Server and the Report run with no errror message.

    I would understand why ?

    Thank's

    What is the command that you are trying to run as I have created a report and do not get any errors. I am also running XP SP2.
  • kinekine Member Posts: 12,562
    There is one problem with Win2k - the WSShell class has another GUID as on XP.

    I am using this class on all systems: (Win2k, XP, Win2k3):
          Wsh : Automation "{F935DC20-1CF0-11D0-ADB9-00C04FD58A0B} 1.0:{F935DC22-1CF0-11D0-ADB9-00C04FD58A0B}:'Windows Script Host Object Model'.IWshShell_Class";
    

    Export your object into text, replace the variable definition with this GUID and Name and import it back.
    Kamil Sacek
    MVP - Dynamics NAV
    My BLOG
    NAVERTICA a.s.
  • SuperSage77SuperSage77 Member Posts: 101
    The code in the Report is following:


    IF ISCLEAR(AutWindowsShell_l) THEN BEGIN
    CREATE(AutWindowsShell_l);
    END;

    IntReturnValue_r := AutWindowsShell_l.Run(TxtCommand_p, IntWindowStyle_p, BoolWaitForEndOfCommand_p);


    Locals Variables

    Name DataType Subtype
    AutWindowsShell_l Automation 'Windows Script Host Object Model'.WshShell

    Parameters
    Var Name DataType Subtype Length
    Non TxtCommand_p Text 1024
    Non IntWindowStyle_p Integer
    Non BoolWaitForEndOfCommand_p Boolean

    Thank's for your help
Sign In or Register to comment.