Loop through entities chosen by Views Bulk Operations
Quoting the VBO Development guide, you can use the aggregate option to get a list of all chosen entities. 


  implement hook_action_info()
  
  aggregate (optional): boolean. If TRUE, all selected objects' IDs
  (oids) will be packed in an array and passed as the first argument to
  the action function, instead of passing each object one by one. This
  is useful to implement aggregate functions that perform a single
  operation on the whole selection set.


Note this guide is only for D6. I have created a D7 version but could not add an aggregate example yet. 

However, in your hook_action_info() implementation, set aggregate to TRUE (defaults to FALSE) and VBO will send a list of entity IDs (for you to perform additional related tasks).