Ok, so I want to try to write some kind of script or such for a service in Mac OS X Snow Leopard which will when a file/folder is clicked on, and this service command used, lsof will run and the output will be used to determine what programs are using that file/folder. Then, I would use the standard AppleScript "close" command to close that file and stop the program from using it. If that fails I would force quit the program, after displaying a dialog showing what the program is and if I want to continue(so as not to kill any vital system processes).
Now, I'm pretty sure I can figure out the part to run lsof, and I think I can figure out how to kill the app if the close command fails...really, I think I got the whole thing down except for how to use the output from the lsof command, especially since after using "lsof -F" to get a usable output, this still always puts out the process IDs. So what I am looking for is a good way to separate the process IDs and the pathnames of the files so I can use both as variables. Any ideas?