Archive: How to create conditional Directory page?


How to create conditional Directory page?
I have installed my app in this path,

$PROGRAMFILES\myapp.

After that i want to check the free space for this drive.In my app wants at least 2GB free space. so i have used following command for checking,
Function MyFuncDir
${DriveSpace} "C:\" "/D=F /S=G" $R0
;$Ro
${If} $R0 >=2
MessageBox MB_OK "required free space is not available.select some other directory"
--Here I want to call page directory function--
${End}
FunctionEnd

In the first time install dont need Directory page.Because by default install location is C:\$PROGRAMFILES\myapp this path.
After free space if required is not available then only display directory page for selecting some other directory.
After selecting some other directory again wants check required free space is there,if available proceed to next page else again display directory page.

How to achieve this?


Use Directory page but in it's 'Pre' function do your calculations.

Use Abort command to skip the page (page will not be visible) and move to next page.


Thanks slappy.

Checking condition in pre function and either call directory page or not is not possible in my case.
Because Assume a case system contains 5 drives{C,D,E,F,G].In the fifth G drive only possible to install my app.How can i check ?
Based on your solution Insert page directory macro in 5 times.
!define MUI_PAGE_CUSTOMFUNCTION_PRE MyFuncDir
!insertmacro MUI_PAGE_DIRECTORY
!define MUI_PAGE_CUSTOMFUNCTION_PRE MyFuncDir
!insertmacro MUI_PAGE_DIRECTORY
!define MUI_PAGE_CUSTOMFUNCTION_PRE MyFuncDir
!insertmacro MUI_PAGE_DIRECTORY
!define MUI_PAGE_CUSTOMFUNCTION_PRE MyFuncDir
!insertmacro MUI_PAGE_DIRECTORY
------
------
This is not good for writing script.I think some looping concept needed here.So i have tried some while loop for calling page directory macro.But I cant do well.