Write Finder plugin

  • Hi All,

    I already posted this is darwin-dev list and was told to post here. This
    topic was discussed already but I am not very cleared that how to go ahead
    to implement a Finder plugin for Mac OS 10.6/10.7. I want to add items in
    Finder's Contextual menu. These menu items should be displayed only when I
    make right click on file/folders in a particular folder. Let me know if its
    possible to do it in python. I don't want to add items in Service.

    There are applications (eg. dropbox) which are able to create items in
    finder's contextual menu, not service. There should be some way to do it.

    Thanks in advance.

    Regards,
    Rakesh Singhal
  • On Jul 2, 2012, at 11:53 AM, Rakesh Singhal wrote:

    > Hi All,
    >
    > I already posted this is darwin-dev list and was told to post here. This
    > topic was discussed already but I am not very cleared that how to go ahead
    > to implement a Finder plugin for Mac OS 10.6/10.7. I want to add items in
    > Finder's Contextual menu. These menu items should be displayed only when I
    > make right click on file/folders in a particular folder. Let me know if its
    > possible to do it in python. I don't want to add items in Service.

    The correct way to do this is via a Service — sorry.

    > There are applications (eg. dropbox) which are able to create items in
    > finder's contextual menu, not service. There should be some way to do it.

    DropBox uses code injection, which is evil and is the reason why I don’t have it on my machine. If you want to go that route, be aware that 1) many people dislike it, 2) it has a tendency to introduce instability, crashes, and weird behavior, and 3) it tends to get royally screwed up once the application you’re hacking gets updated.

    I’d suggest you just use a Service.

    Charles
  • On Mon, Jul 2, 2012, at 10:23 PM, Rakesh Singhal wrote:
    > I already posted this is darwin-dev list and was told to post here. This
    > topic was discussed already but I am not very cleared that how to go
    > ahead
    > to implement a Finder plugin for Mac OS 10.6/10.7. I want to add items in
    > Finder's Contextual menu. These menu items should be displayed only when
    > I
    > make right click on file/folders in a particular folder. Let me know if
    > its
    > possible to do it in python. I don't want to add items in Service.

    There is no officially supported means for writing a Finder plugin. You
    will not receive assistance in doing so on this mailing list.

    --Kyle Sluder
  • On Jul 2, 2012, at 9:53 AM, Rakesh Singhal <rakesh.singhal...> wrote:

    > There are applications (eg. dropbox) which are able to create items in
    > finder's contextual menu, not service. There should be some way to do it.

    There is no supported way to do this. Dropbox uses various hacks to make its way into the Finder process. Frequently, the current version of Dropbox is incompatible with a new release of Mac OS X and has to be disabled. Don't use them as a model.

    -eric
  • AFAIK Dropbox accomplishes this using private APIs and reverse-engineered hacks.

    I'd love to hear if there's an official method, but if there isn't you won't be able to take this up further on this mailing list.

    (Sent from my iPhone.)

    --
    Conrad Shultz

    On Jul 2, 2012, at 9:53, Rakesh Singhal <rakesh.singhal...> wrote:

    > Hi All,
    >
    > I already posted this is darwin-dev list and was told to post here. This
    > topic was discussed already but I am not very cleared that how to go ahead
    > to implement a Finder plugin for Mac OS 10.6/10.7. I want to add items in
    > Finder's Contextual menu. These menu items should be displayed only when I
    > make right click on file/folders in a particular folder. Let me know if its
    > possible to do it in python. I don't want to add items in Service.
    >
    > There are applications (eg. dropbox) which are able to create items in
    > finder's contextual menu, not service. There should be some way to do it.
    >
    >
    > Thanks in advance.
    >
    > Regards,
    > Rakesh Singhal
  • Hi All,

    Thanks to all of you for your response. I will use Services. I hope, I
    would get some sample code with proper documentation to implement this.
    Please let me know if it is possible to do in python.

    Regards,
    Rakesh Singhal

    On Tue, Jul 3, 2012 at 2:33 AM, John C. Randolph <jcr...> wrote:

    >
    > On Jul 2, 2012, at 11:39 AM, Eric Schlegel <ericsc...> wrote:
    >
    >> On Jul 2, 2012, at 9:53 AM, Rakesh Singhal <rakesh.singhal...>
    > wrote:
    >>
    >>> There are applications (eg. dropbox) which are able to create items in
    >>> finder's contextual menu, not service. There should be some way to do
    > it.
    >>
    >> There is no supported way to do this. Dropbox uses various hacks to make
    > its way into the Finder process. Frequently, the current version of Dropbox
    > is incompatible with a new release of Mac OS X and has to be disabled.
    > Don't use them as a model.
    >
    > Note also, that any product doing this won't be accepted by the App Store.
    >
    > -jcr
    >
  • Hi Eric,

    Thanks. I am trying to do it using Services but I couldn't find any sample
    code.  Can I do it in python?

    Regards,
    Rakesh Singhal

    On Tue, Jul 3, 2012 at 12:09 AM, Eric Schlegel <ericsc...> wrote:

    >
    > On Jul 2, 2012, at 9:53 AM, Rakesh Singhal <rakesh.singhal...>
    > wrote:
    >
    >> There are applications (eg. dropbox) which are able to create items in
    >> finder's contextual menu, not service. There should be some way to do it.
    >
    > There is no supported way to do this. Dropbox uses various hacks to make
    > its way into the Finder process. Frequently, the current version of Dropbox
    > is incompatible with a new release of Mac OS X and has to be disabled.
    > Don't use them as a model.
    >
    > -eric
    >
    >
  • On Jul 12, 2012, at 10:45 PM, Rakesh Singhal <rakesh.singhal...> wrote:

    > Hi Eric,
    >
    > Thanks. I am trying to do it using Services but I couldn't find any sample code.  Can I do it in python?

    No, you can only write a Service with Objective C. You can read about implementing a service here: https://developer.apple.com/library/mac/#documentation/Cocoa/Conceptual/Sys
    Services/introduction.html
    .

    -eric
  • You can do this with Services if you are willing to have it in the services menu of the contextual menu, the user has to enable your service by going to System Preferences > Keyboard > Keyboard Shortcuts, you may be able to AppleScript that. If you are just writing scripts for you own use that you want to use from the Contextual Menu, do a google search for Mac Services AppleScripts. I think there is at least 1 app that lets you run scripts as services.

    Doing it in Cocoa is pretty straight forward.

    On 13/07/2012, at 3:45 PM, Rakesh Singhal <rakesh.singhal...> wrote:

    > Hi Eric,
    >
    > Thanks. I am trying to do it using Services but I couldn't find any sample
    > code.  Can I do it in python?
    >
    > Regards,
    > Rakesh Singhal
    >
    > On Tue, Jul 3, 2012 at 12:09 AM, Eric Schlegel <ericsc...> wrote:
    >
    >>
    >> On Jul 2, 2012, at 9:53 AM, Rakesh Singhal <rakesh.singhal...>
    >> wrote:
    >>
    >>> There are applications (eg. dropbox) which are able to create items in
    >>> finder's contextual menu, not service. There should be some way to do it.
    >>
    >> There is no supported way to do this. Dropbox uses various hacks to make
    >> its way into the Finder process. Frequently, the current version of Dropbox
    >> is incompatible with a new release of Mac OS X and has to be disabled.
    >> Don't use them as a model.
    >>
    >> -eric
    >>
    >>

  • On 13.07.2012, at 08:43, Nathan Day wrote:
    > You can do this with Services if you are willing to have it in the services menu of the contextual menu, the user has to enable your service by going to System Preferences > Keyboard > Keyboard Shortcuts, you may be able to AppleScript that. If you are just writing scripts for you own use that you want to use from the Contextual Menu, do a google search for Mac Services AppleScripts. I think there is at least 1 app that lets you run scripts as services.

    IIRC, if you set the flags correctly in the Info-plist, your service's item will automatically be activated. Only "old-style" services need to be activated explicitly. Others show up as soon as their context matches (e.g. the selected file has the UTI that your service expects as input).

    Cheers,
    -- Uli Kusterer
    "Die Zeugen des TeachText sind überall..."
    http://www.wiederholungstaeter-podcast.de
  • But the OP *could* create a Workflow OS X Services Item that has a Run
    Shell Script action with a python script.

    On Thu, Jul 12, 2012 at 11:16 PM, Eric Schlegel <ericsc...> wrote:
    >
    > On Jul 12, 2012, at 10:45 PM, Rakesh Singhal <rakesh.singhal...> wrote:
    >
    >> Hi Eric,
    >>
    >> Thanks. I am trying to do it using Services but I couldn't find any sample code.  Can I do it in python?
    >
    > No, you can only write a Service with Objective C. You can read about implementing a service here: https://developer.apple.com/library/mac/#documentation/Cocoa/Conceptual/Sys
    Services/introduction.html
    .
    >
    > -eric

    --
    Mark Munz
    unmarked software
    http://www.unmarked.com/
  • On 13 Jul, 2012, at 18:11, Mark Munz wrote:

    > But the OP *could* create a Workflow OS X Services Item that has a Run
    > Shell Script action with a python script.

    Or use PyObjC.

    Ronald

    >
    > On Thu, Jul 12, 2012 at 11:16 PM, Eric Schlegel <ericsc...> wrote:
    >>
    >> On Jul 12, 2012, at 10:45 PM, Rakesh Singhal <rakesh.singhal...> wrote:
    >>
    >>> Hi Eric,
    >>>
    >>> Thanks. I am trying to do it using Services but I couldn't find any sample code.  Can I do it in python?
    >>
    >> No, you can only write a Service with Objective C. You can read about implementing a service here: https://developer.apple.com/library/mac/#documentation/Cocoa/Conceptual/Sys
    Services/introduction.html
    .
    >>
    >> -eric
    >
    >
    >
    > --
    > Mark Munz
    > unmarked software
    > http://www.unmarked.com/

    Cocoa-dev mailing list (<Cocoa-dev...>)

    Please do not post admin requests or moderator comments to the list.
    Contact the moderators at cocoa-dev-admins(at)lists.apple.com

    Help/Unsubscribe/Update your Subscription:
    https://lists.apple.com/mailman/options/cocoa-dev/<cocoa...>

    This email sent to <cocoa...>
  • Hi Ronald,

    Thank you very much and now I am using PyObjC. But it doesn't add the items
    in Services if my app is installed in /Applications folder. If you have any
    idea then please let me know. Is it possible to enable these items only for
    particular folder in finder?

    Regards,
    Rakesh Singhal

    On Mon, Jul 16, 2012 at 12:45 PM, Ronald Oussoren <ronaldoussoren...>wrote:

    >
    > On 13 Jul, 2012, at 18:11, Mark Munz wrote:
    >
    >> But the OP *could* create a Workflow OS X Services Item that has a Run
    >> Shell Script action with a python script.
    >
    > Or use PyObjC.
    >
    > Ronald
    >
    >>
    >> On Thu, Jul 12, 2012 at 11:16 PM, Eric Schlegel <ericsc...>
    > wrote:
    >>>
    >>> On Jul 12, 2012, at 10:45 PM, Rakesh Singhal <rakesh.singhal...>
    > wrote:
    >>>
    >>>> Hi Eric,
    >>>>
    >>>> Thanks. I am trying to do it using Services but I couldn't find any
    > sample code.  Can I do it in python?
    >>>
    >>> No, you can only write a Service with Objective C. You can read about
    > implementing a service here:
    > https://developer.apple.com/library/mac/#documentation/Cocoa/Conceptual/Sys
    Services/introduction.html

    > .
    >>>
    >>> -eric
    >>
    >>
    >>
    >> --
    >> Mark Munz
    >> unmarked software
    >> http://www.unmarked.com/
    >
    >
  • It worked. Pbs was indexing the old build.

    On 10.7, I am not getting the file path instead of that I get something
    like "file:///.file/ide71367.3388989". In 10.6, I am getting full path.
    Is there something, I am missing?

    Regards,
    Rakesh Singhal

    On Thu, Jul 26, 2012 at 2:36 PM, Rakesh Singhal <rakesh.singhal...>wrote:

    > Hi Ronald,
    >
    > Thank you very much and now I am using PyObjC. But it doesn't add the
    > items in Services if my app is installed in /Applications folder. If you
    > have any idea then please let me know. Is it possible to enable these items
    > only for particular folder in finder?
    >
    > Regards,
    > Rakesh Singhal
    >
    >
    > On Mon, Jul 16, 2012 at 12:45 PM, Ronald Oussoren <ronaldoussoren...>wrote:
    >
    >>
    >> On 13 Jul, 2012, at 18:11, Mark Munz wrote:
    >>
    >>> But the OP *could* create a Workflow OS X Services Item that has a Run
    >>> Shell Script action with a python script.
    >>
    >> Or use PyObjC.
    >>
    >> Ronald
    >>
    >>>
    >>> On Thu, Jul 12, 2012 at 11:16 PM, Eric Schlegel <ericsc...>
    >> wrote:
    >>>>
    >>>> On Jul 12, 2012, at 10:45 PM, Rakesh Singhal <rakesh.singhal...>
    >> wrote:
    >>>>
    >>>>> Hi Eric,
    >>>>>
    >>>>> Thanks. I am trying to do it using Services but I couldn't find any
    >> sample code.  Can I do it in python?
    >>>>
    >>>> No, you can only write a Service with Objective C. You can read about
    >> implementing a service here:
    >> https://developer.apple.com/library/mac/#documentation/Cocoa/Conceptual/Sys
    Services/introduction.html

    >> .
    >>>>
    >>>> -eric
    >>>
    >>>
    >>>
    >>> --
    >>> Mark Munz
    >>> unmarked software
    >>> http://www.unmarked.com/
    >>
    >>
    >
  • On Jul 26, 2012, at 3:56 AM, Rakesh Singhal <rakesh.singhal...> wrote:

    > It worked. Pbs was indexing the old build.
    >
    > On 10.7, I am not getting the file path instead of that I get something
    > like "file:///.file/ide71367.3388989". In 10.6, I am getting full path.
    > Is there something, I am missing?

    That's a file reference URL. Use -[NSURL filePathURL] to convert it to a normal file URL.

    --Kyle Sluder
  • On 26 Jul 2012, at 15:17, Kyle Sluder wrote:

    > On Jul 26, 2012, at 3:56 AM, Rakesh Singhal <rakesh.singhal...> wrote:
    >
    >> It worked. Pbs was indexing the old build.
    >>
    >> On 10.7, I am not getting the file path instead of that I get something
    >> like "file:///.file/ide71367.3388989". In 10.6, I am getting full path.
    >> Is there something, I am missing?
    >
    > That's a file reference URL. Use -[NSURL filePathURL] to convert it to a normal file URL.

    Or use CFURLCreateFilePathURL() which has the extra nicety of giving you back a proper error object in the event of failure.
  • Hi Kyle,

    Thank you very much. It worked.

    Regards,
    Rakesh Singhal

    On Thu, Jul 26, 2012 at 7:47 PM, Kyle Sluder <kyle...> wrote:

    > On Jul 26, 2012, at 3:56 AM, Rakesh Singhal <rakesh.singhal...>
    > wrote:
    >
    >> It worked. Pbs was indexing the old build.
    >>
    >> On 10.7, I am not getting the file path instead of that I get something
    >> like "file:///.file/ide71367.3388989". In 10.6, I am getting full path.
    >> Is there something, I am missing?
    >
    > That's a file reference URL. Use -[NSURL filePathURL] to convert it to a
    > normal file URL.
    >
    > --Kyle Sluder
previous month july 2012 next month
MTWTFSS
            1
2 3 4 5 6 7 8
9 10 11 12 13 14 15
16 17 18 19 20 21 22
23 24 25 26 27 28 29
30 31          
Go to today