I'm new to Linux scripting but have experience with website scripting so I hope I can catch on quickly, I would appreciate if anyone can point me in the right direction for what I am trying to do:

I need to make a program (xvidcap) open automatically every time an x-window is opened (I am accessing my server over an NX client). I then want to make the xvidcap program perform specific actions, such as sizing the video window and beginning recording automatically, I don't expect that you can tell me how to do this specifically but I am wondering should I be looking into modifying the xvidcap code itself or is there another way I could write a script to interact with the program?

Thanks