[Inno Setup] procedure BeforeInstall(); Not Working
Hello,
Another Inno problems of mine...
in my code section i have the following
VB Code:
:
[COLOR=Navy][Code]
[COLOR=DarkOrange]procedure BeforeInstall[/COLOR]();
begin
if FileExists('{userappdata}\MyApp\Settings.ini') then
if MsgBox('Your Settings seem to be Installed. Would you like to keep them?', mbConfirmation, MB_YESNO or MB_DEFBUTTON1) = IDNO then
begin
// Delete the directory and everything inside it
DelTree('{userappdata}\MyApp', True, True, True);
end;
end;[/COLOR]
And then i call the procedure like so..
VB Code:
[COLOR=Navy]
[INI]
Filename: {userappdata}\MyApp\Settings.ini; Section: Info; Key: Information; String: myapp; [/COLOR] [COLOR=DarkOrange]BeforeInstall: BeforeInstal[/COLOR]
Basically the problem is, when i install the application I dont see any MessageBox.
How can i get it to show..
Re: [Inno Setup] procedure BeforeInstall(); Not Working
To check it remove your if statements to see if you are getting there and just not finding what you think should be true.
Verify first....
Re: [Inno Setup] procedure BeforeInstall(); Not Working
Removed the If FileExists.. part. and i DO get a msgbox, but eventhough i Say NO, it doesnt seem to be deleteing the direcotry...
Re: [Inno Setup] procedure BeforeInstall(); Not Working
Re: [Inno Setup] procedure BeforeInstall(); Not Working
Quote:
post what you have now
VB Code:
[COLOR=DarkSlateBlue][Code]
procedure BeforeInstall();
begin
if MsgBox('Your Settings seem to be Installed. Would you like to keep them?', mbConfirmation, MB_YESNO or MB_DEFBUTTON1) = IDNO then
begin
// Delete the directory and everything inside it
DelTree('{userappdata}\MyApp\*', True, True, True);
end;
end;[/COLOR]
Re: [Inno Setup] procedure BeforeInstall(); Not Working
Did you verify that it does indeed fall thru to the DelTree line?
Re: [Inno Setup] procedure BeforeInstall(); Not Working
How do i verify it..?
Is there any step through code in Inno?? Like Vb has? things like debug.print
Re: [Inno Setup] procedure BeforeInstall(); Not Working
Put a messagebox just before the line that is supposed to delete to see if you are actually getting there.
Verify that you are getting there before assuming that the instruction doesn't work. One thing at a time...
Re: [Inno Setup] procedure BeforeInstall(); Not Working
OK i put another messagebox just beft the DelTree function and I do get it...
so it seems like the DelTree function isnt doing what its supposed to do...
Re: [Inno Setup] procedure BeforeInstall(); Not Working
Ok, try this
DelTree('{userappdata}\MyApp\', True, True, True);
Re: [Inno Setup] procedure BeforeInstall(); Not Working
Nope..
Same result..
I thikn im gona have to manully do an .Exe in vb to do the things i need Inno to do in its Code section... :(
I already have like 2 other separate .exe cos Inno wouldnt do things i need!! :(
Re: [Inno Setup] procedure BeforeInstall(); Not Working
It is possibly that parameters don't get replaced in the code section.
Check with Klienma to be sure. Send him a PM. He hangs out in the .Net Forum.
Re: [Inno Setup] procedure BeforeInstall(); Not Working
You may need to pass the '{userappdata}\MyApp\' as a parameter so that Inno Setup replaces it in the script before calling the code section.
Re: [Inno Setup] procedure BeforeInstall(); Not Working
Quote:
Originally Posted by some1uk03
How do i verify it..?
Is there any step through code in Inno?? Like Vb has? things like debug.print
you should be able to set breakpoints just like VB by clicking in the left margin (just like VB)
I recommend you use the latest version of INNO, I am not sure when they added in the debugging features.
As far as the issue, you need to pass in the value as a whole, you can't use INNOs values in the code section (as randem suggested above)
Go into the INNO help file, and look for the topic "Pascal Scripting: BeforeInstall and AfterInstall Parameters" (you can search that in the help search and it will come up)
it shows you how to do what you want, and also has some code examples.