PDA

View Full Version : file.copy error after 7.0.2.0 update


parallon
03-03-2005, 05:57 PM
I just installed the update to 7.0.2.0 which fixed that problem with the %DAOPath% and the %CommonFiles% thing. Now I am having a problem with a script that is supposed to copy manuals to a predefined place assuming all criteria are met.

Here is how it works... If the user is installing from a CD, then After Install, the script sees that DriveType == 5 and then will prompt the user to install the manuals if they want to and present them with a default path. If they choose to, then when they click on Next, it should copy the manuals to the %ManualDir% and then show a dialog box stating that the manuals were copied to %ManualDir%. If the user clears the path, then the install will just go to the 'Install Complete' screen. Well, now, I get the option to copy the manuals, but when I click Next, it just goes to the Install Complete screen and never copies the manuals.

Here is the code for the After Install screen:

ON PRELOAD:

if SessionVar.Expand"%DriveType%" == "5" then -- If DriveType is a CD/DVD Rom then prepare to copy manuals.

-- calculate the amount of space required for the installation
_SpaceRequired = SetupData.CalculateRequiredSpace();

-- format it as a string with an appropriate unit of measurement (e.g. "0 bytes")
local strSpaceRequired = String.GetFormattedSize(_SpaceRequired);

-- store the string in a session variable so it can be used in the screen text
SessionVar.Set("%SpaceRequired%", strSpaceRequired);

-- from _SUF70_Global_Functions.lua:
-- update the 'Space required:' message (expands any session variables in it)
g_UpdateStaticTextCtrl(CTRL_STATICTEXT_SPACEREQUIR ED, "IDS_CTRL_STATICTEXT_SPACEREQUIRED");

else
Screen.Jump("Finished Install");
end


ON NEXT:

--// If the user chooses to copy User Manuals (from CD only) to the hard drive,
--// the following will copy the manuals to the location stored in the %ManualDir% variable.

if SessionVar.Expand"%ManualDir%" ~= "" and SessionVar.Expand"%DriveType%" == "5" then -- If %ManualDir% is not empty, then...

File.Copy(SessionVar.Expand"%SourceFolder%\\Docs\\Manuals\\*.pdf", SessionVar.Expand"%ManualDir%", true, true, false, true, nil);

Dialog.Message ("Manuals Copied", "Manuals have been copied to: " .."'" ..SessionVar.Expand("%ManualDir%") .."'" , MB_OK, MB_ICONINFORMATION);
else
end

Any ideas???

Thanks in advance,

Parallon

csd214
03-04-2005, 12:04 AM
My first thought: You are missing the parenthesis. The correct syntax is:
if SessionVar.Expand("%DriveType%") == "5" then

But I experienced that SUF70 accepts SessionVar.Expand"%DriveType%"; and the code is working as expected on my side.

Are you sure, has %DriveType% the correct value? Add a statement to test the value (debug/log/message); for instance:
Dialog.Message("", "The drive type is "..SessionVar.Expand("%DriveType%"));

parallon
03-04-2005, 03:04 PM
I finally figured it out. I noticed in the release notes for the update for 7.0.2.0 that they changed the actions for Screen.End, Screen.Next, etc. so that the script from which the action is called stops executing after that action is performed, instead of running through it like 7.0.1.0. Well, wouldn't you know it, in the On Next tab, I had it do a Screen.Next after validation of path, which would go to the Install Complete screen, and at the same time copy the manuals to the proper place. Well, with this change, it never ran the rest of my script. Actually, this is better because now the Install Complete screen won't show up until the file.copy process is complete. I guess there are both pros and cons to upgrading, huh? :)

Thanks,

Parallon