PDA

View Full Version : Can I please at least get an answer on this?


Sheritlw
03-18-2007, 12:42 AM
Why do I get an error from the bolded and red line? It says Line 20 (bolded and red line): `=' expected near `bresult'

local bresult = false;
local bsql = false;
bresult = File.DoesExist("%TempFolder%\\SQLEXPR32.exe");
SessionVar.Expand(bresult);
If bresult then
bsql = File.Run(_TempFolder.."\\SQLEXPR32.exe", "", "", SW_SHOWNORMAL, true);
end

I have tried multiple combinations excluding and including expand etc.
I have to have this done by tomorrow.

pww
03-18-2007, 03:56 AM
I guess the error actually comes from the above line -
SessionVar.Expand(bresult);
bresult holds true or false so there is nothing to expand, and it's a local and not a session variable.
Remove this line as it does not seem to do anything.

Also you may need to expand %TempFolder% in the line
bresult = File.DoesExist("%TempFolder%\\SQLEXPR32.exe");

Another thing is that File.Run returns a number (the process exit code - 0 if all OK, otherwise an error number, but only if WaitForReturn is set to true - otherwise it always returns 0 as there is no way to get the exit code), not a boolean true/false value. So I would remove local bsql = false;

Sheritlw
03-18-2007, 02:51 PM
I had just put in the sessionvar.expand to see if I was getting the error because on needed to expand the variable. I use the latest version of sf 7

This is in the Pre-Load function of Select Install Folder
-- Create a local variable and assign a boolean value to it

local bresult = false;
local bsql = false;
bresult = File.DoesExist(_TempFolder"\\SQLEXPR32.exe");
--If bresult == false then
-- bsql = File.Run(_TempFolder.."\\SQLEXPR32.exe", "", "", SW_SHOWNORMAL, true);
--end

pww
03-19-2007, 03:51 AM
maybe just a typo, but in the third line you missed the ".." for string concatenation. It should be
bresult = File.DoesExist(_TempFolder .. "\\SQLEXPR32.exe");

Next, the IF condition actually says 'run the file if it does not exist' . I guess you should change it to
If bresult == true then

Adam
03-19-2007, 10:12 AM
If bresult then

should be

if bresult then

Our scripting is case sensitive so that could be why it is not making it through the compiler.

Adam Kapilik

Sheritlw
03-19-2007, 04:01 PM
Adam, thank you, that was it.

Adam
03-19-2007, 04:11 PM
No problem. All reserved words in our language are case sensitive and always lower case:

if
for
then
do
while
end
else
elseif

Basically any that turns blue in the script editor.

Adam Kapilik