// PartitionMagic Script File

// This script file is an example of the Do-While script statement.

// Scenario:
// Disk 1 contains a primary partition and an unknown number of logical 
// partitions.
//
// The user wishes to take 10 MB of unused space on each logical partition and
// add the unused space to the primary partition.

// Select the last partition
Select Disk 1
Select Partition Last

// Loop thru the logical partitions and remove any unused space over 50 MB
Do While IsLogical
     If GetUnusedAmount > 50 Then
          Resize Smaller GetUnusedAmount - 50
          Move Right Max
     End If
     Select Partition Previous
Loop

// Resize the extended partition to fit the logical partitions
Select Partition Extended
Resize Left Boundary Min

// Expand the primary partition to include the unused space
Select Partition Previous
Resize Larger Max
