cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Flitskikker
Level 4

How to cancel setup using InstallScript?

Hello,

My InstallScript has an check included to check for an installation. If it doesn't exist, it must cancel the setup. How do I do this?

Kind regards,
Flitskikker
Labels (1)
0 Kudos
(6) Replies
RobertDickau
Flexera Alumni

For a pure InstallScript project, the abort keyword should do it. For InstallScript in a custom action, returning ERROR_INSTALL_FAILURE from the action is a way to do it.
0 Kudos
ChandanOmkar
Level 8

You can use abort to terminate the setup. It will redirect to the Finish Dialog box.
0 Kudos
Flitskikker
Level 4

Thank you! I tried a lot of words (end, stop, quit, break; but I didn't think about abort 😛 ).

Now I have one other question, how to use my ID strings for messages?

MessageBox (ID_STRING_FILENOTFOUND, SEVERE);


This doesn't work. Putting { } around it neather.

Again thanks in advance!

Kind regards,
Flitskikker
0 Kudos
ChandanOmkar
Level 8

Put the @ before ID String variable.

e.g. : MessageBox (@ID_STRING_FILENOTFOUND, SEVERE);
0 Kudos
Flitskikker
Level 4

Thank you very much, again! 😄

One last question... :rolleyes:

During my setup, two AskDestPath dialogs are displayed. One for TARGETDIR, the other for my string sBackupDir.

I want to run a backup progress during the installation, so I chose BackupMyFiles at OnInstalling for the DefaultFeature.

export prototype BackupMyFiles();

function BackupMyFiles()
NUMBER nResult;
begin
nResult = CopyFile (TARGETDIR ^ "Settings.ini", ?????);
end;


Here am I stuck. How do I get my sBackupDir value in this function? Just placing it as ' sBackupDir ^ "Settings.ini" ' doesn't work. :confused:

Thanks in advance!

Kind regards,
Flitskikker
0 Kudos
Johannes_T
Level 6

Aren't you aware of the concepts of local & globel variables, scopes, etc. etc.?!
2 ways to solve this:
1. Pass sBackupDir as a function parameter to BackUpMyFiles(), be sure that the variable in available in the calling function.
2. make sBackupDir global, the you can use it the way you mentioned (Just placing...)

More people may answer, when you start a new thread for a new question.

Greetings,
Johannes
0 Kudos