To do something when a button is pressed you will need to create action handler(s) that get called when the button is pressed, for example:
ondoButtonStuff_(sender) -- do stuff when a button is pressed
logsender's title() -- the name of the button
# whatever
enddoButtonStuff_
The action handler receives one parameter (the button), and is connected to the desired button(s) in the Interface Editor.
To make a progress indicator move, you will need to break up your task and increment the progress bar each time through the loop - see the NSProgressINdicator Class Reference for available methods. Note that if you are using something like a repeat loop, you will need to add code to handle events so that your user interface gets updated.
I have an example project that uses timers and a progress bar if you want to look at that - it can be downloaded here.