Results 1 to 2 of 2
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 ...
  1. #1
    Advanced Array

    Join Date
    Sep 2010
    Posts
    30
    Post Thanks / Like
    Downloads
    0
    Uploads
    0
    Rep Power
    0

    Default 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<)



  2. #2
    Super Moderator Array Olethros's Avatar

    Join Date
    Sep 2007
    Location
    Norway
    Posts
    8,360
    Post Thanks / Like
    Downloads
    0
    Uploads
    0
    Rep Power
    439

    Default

    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

  1. Help with Terminal Scripting
    By MicroLabrat in forum Using Snow Leopard
    Replies: 0
    Last Post: 01-30-2011, 12:10 AM
  2. Scripting Language for APPLE
    By JayBird in forum Genuine Mac Support
    Replies: 0
    Last Post: 12-29-2008, 09:16 PM
  3. [Scripting] Start up script
    By JN2 in forum Free Toolchain Software (Cydia App's)
    Replies: 4
    Last Post: 06-17-2008, 10:02 AM
  4. Scripting minicom possible?
    By Tego in forum Free Toolchain Software (Cydia App's)
    Replies: 11
    Last Post: 11-17-2007, 09:39 AM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Powered by vBulletin®
Copyright © 2014 vBulletin Solutions, Inc. All rights reserved.
Search Engine Friendly URLs by vBSEO
(c) 2006-2012 Hackint0sh.org
All times are GMT +2. The time now is 01:32 AM.
twitter, follow us!