Discuss Scripting from lsof output at the Genuine Mac Support - Hackint0sh.org; Ok, so I want to try to write some kind of script or such for ...
-
Scripting from lsof output
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?
Mac Mini(Mid-2010)
2.4 GHz Intel Core 2 Duo
Mac OS X 10.7(Lion)
PowerMac G4 Quicksilver ~993 MHz
Mac OS X 10.4(Tiger)
iPod Touch 2G 16GB
iPhone 3GS 32GB (New Bootrom) - Locked AT&T
(\_/) This is Bunny, copy Bunny into your signature to
(O.o) help him on his way to world domination.
(>i<)
-
-
Super Moderator
Array
I'd look at the unix commands sed or (maybe the simpler) cut to achieve what you want
Please read the stickies & search forum before posting!
How to report an iTunes restore/update fail in a useful manner
-
iPad 3G 64GB (4.3.3, Redsn0w) oldest SHSH 3.2.2
iPhone 4 32GB (4.2.1, Redsn0w JB-monte) oldest SHSH 4.1
iPhone 3GS 32GB (4.3.3; Pwnagetool) factory unlocked oldest SHSH 3.1
iPhone 8GB (3.1.3; Pwnagetool) AT&T Locked - Unlocked with bootneuter
-
Did we solve your problem? Got a dollar or two spare ?
Donate!
-
Similar Threads
-
By MicroLabrat in forum Using Snow Leopard
Replies: 0
Last Post: 01-30-2011, 01:10 AM
-
By JayBird in forum Genuine Mac Support
Replies: 0
Last Post: 12-29-2008, 10:16 PM
-
By JN2 in forum Free Toolchain Software
Replies: 4
Last Post: 06-17-2008, 10:02 AM
-
By Tego in forum Free Toolchain Software
Replies: 11
Last Post: 11-17-2007, 10:39 AM
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
Bookmarks