PDA

View Full Version : Simple scripting question


marcusc
03-13-2007, 09:35 AM
Hello

Here's a script I wish to run at the "Ready to Install" stage to check some licensing parameters. The first few lines should get the value of the AppFolder, make sure that it does not already end with "\" or "/" and then add the rest of the path.

But... the variable substitution doesn't work. What am I doing wrong?

Also, where can I get a full list of variables such as "EXIT_REASON_USER_ABORTED"?

Thanks!


local Afolder = SessionVar.Get("%AppFolder%");

Afolder = String.TrimLeft(Afolder,"/\\");

local fullpath = SessionVar.Expand("%Afolder%\\etc\\progname\\progname.key");

Dialog.Message("Debug",fullpath);

if (File.DoesExist(fullpath))
then
local size=File.GetSize(fullpath);
-- Dialog.Message("Size",size);
if (size==999) then
Dialog.Message ("Warning","Progname is already installed as an evaluation version. Please contact your reseller for information on extending your evaluation or purchasing the Progname software license. For further information please see http://www.sitename.com/progname");
else
Dialog.Message ("Warning","A licensed version of Progname is already installed. Please contact your reseller for information on upgrading to the latest version. For further information please see http://www.sitename.com/progname");
end
Application.Exit(EXIT_REASON_USER_ABORTED)
else
-- Do something else here
end
-- These actions are performed before the screen is shown.

Eagle
03-13-2007, 10:19 AM
Hi there..

I think you solve things by using:

Afolder = SessionVar.Expand("%AppFolder%");

eg: Afolder = String.TrimRight(SessionVar.Expand("%AppFolder%"), "\\");
Afolder = String.TrimRight(SessionVar.Expand("%AppFolder%"), "/\\");

hth

marcusc
03-13-2007, 11:59 AM
Great, thanks!