Progress bar in drupal admin area for long running scripts I have a custom module that has visual representation in admin area of my Drupal 7 installation.

Script that runs via that module executes pretty long time (some syncing process), and i would like to implement some kind of Progress bar (like when you run some cron job etc in Drupal, you see progress bar and even messages of the script parts).

How i can implement this ? Basicially, i would like to track a foreach loop, and iteration through foreach loop would be visible as progress bar.

Script is being triggered via hook_form_submit.

Thanks!
Grab a copy of Examples and checkout the batch_example module. 

It's got several code examples for various scenarios using the batch API, which Drupal uses internally to produce pages with progress bars (like the upgrade check page for example). The module is very well commented, and it should give you everything you need to get started.