delphiscript

Difficulties with ShellExecute() in DelphiScript


So, here's my code:

Procedure exec;
uses
    ShellApi;
begin
try
ShellExecute( 0, 'Open', 'C:\ParamReport.Txt', nil,nil, SW_NORMAL);
except
ShowMessage('failed');
end;
end;

I am attempting to execute an external program, (regardless of type), within Altium Designer 2013 (13.3).

There is a basic editor within this program that I am using. Apparently, out of all of it's scripting documentation, it fails to mention which version of DelphiScript it uses in its editor. This is frustrating because as I copy and paste (working) code into the editor and try to run it - I run into many errors.

On the current code I get this error: "Undeclared Identifier: SW_NORMAL"

also, I desire to use the ".Split()" command. However, this apparently requires a "PChar" - which throws this error:"Undeclared Identifier: PChar"

I am running Windows 7 Pro 64

Please help. Thank you!

* EDIT *

I have already attempted "SW_SHOWNORMAL" - this produce same error.

* EDIT #2 *

I changed:

ShellExecute( 0, 'Open', 'C:\ParamReport.Txt', nil,nil, SW_NORMAL);

to:

ShellExecute( 0, 'Open', 'C:\ParamReport.Txt', nil,nil, 1);  

via Andreas Rejbrand's recommendation and I found that a new error was thrown.

"Undeclared Identifier: ShellExecute"

Now im really confused.


Solution

  • It looks very much as though DelphiScript does not support calls to the Windows API using ShellAPI. In which case your code cannot ever work. I suggest that you request technical support from Altium.