I need some help...

Yes.
When the sensor detects, send a message on the serial line.
Then on the PC have a program that looks at the serial port and when it sees the message opens the file.