I have the following Inno Setup script, and I'm getting this error on the SaveStringToFile
line:
Type Mismatch
Can anybody spot my mistake?
Thank you!
var
ErrorCode: Integer;
begin
ShellExec(
'open', 'taskkill.exe', '/f /im procterm.exe', '', SW_HIDE,
ewWaitUntilTerminated, ErrorCode);
SaveStringToFile(
'c:\program data\myapp\innolog.txt',
'Error code for procterm was: ' + ErrorCode, True);
end;
The problem is that you are trying to "sum" a string with a number (an integer):
'Error code for procterm was: ' + ErrorCode
That's not possible in Pascal/Pascal Script.
You have to convert the number/integer to a string with the IntToStr
function:
'Error code for procterm was: ' + IntToStr(ErrorCode)
Or use the Format
function like:
Format('Error code for procterm was: %d', [ErrorCode])
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With