Giter Club home page Giter Club logo

Comments (8)

tbartelmess avatar tbartelmess commented on June 26, 2024

The actual identifier is com.apple.finder, why should it be case insensitive?

from axelements.

 avatar commented on June 26, 2024

As com.apple.Finder still works but causes a RuntimeError when it should just fail as not found.

from axelements.

ferrous26 avatar ferrous26 commented on June 26, 2024

The issue is that NSWorkspace.launchAppWithBundleIdentifier is case-insensitive, but NSRunningApplication.runningApplicationsWithBundleIdentifier is case-sensitive.

The problem then is that "com.apple.Finder" will not be found as a running application, so we try to launch it, which then brings Finder to the front (because it is already running). Then we sleep on the run loop for a couple of seconds and try again.

After looping a few times we raise an exception.

I think this might actually be an Apple problem...something to report to them. I just need to double check what I've claimed here first...

from axelements.

 avatar commented on June 26, 2024

Hey, we all make mistakes.....right?

Let me know then and I'll direct my gaze over to radar.

from axelements.

 avatar commented on June 26, 2024

Another example

1.9.3-p362 :003 > apple_contacts = AX::Application.new "com.apple.addressbook"
RuntimeError: com.apple.addressbook failed to launch in time
from /Users/mp4976qpa/Developer/AXElements/lib/accessibility/dsl.rb:136:in raise' from /Users/mp4976qpa/Developer/AXElements/lib/ax/application.rb:134:ininitialize'
from (irb):3:in new' from (irb):3 from /Users/mp4976qpa/.rvm/rubies/ruby-1.9.3-p362/bin/irb:16:in

'
1.9.3-p362 :004 > apple_contacts = AX::Application.new "com.apple.AddressBook"
=> #<AX::Application "Contacts" 2 children focused[✘] pid=30451>
1.9.3-p362 :005 >
1.9.3-p362 :006 > apple_contacts = AX::Application.new "com.apple.stupid"
RuntimeError: com.apple.stupid is not a registered bundle identifier for the system
from /Users/mp4976qpa/Developer/AXElements/lib/accessibility/dsl.rb:136:in raise' from /Users/mp4976qpa/Developer/AXElements/lib/ax/application.rb:136:ininitialize'
from (irb):6:in new' from (irb):6 from /Users/mp4976qpa/.rvm/rubies/ruby-1.9.3-p362/bin/irb:16:in'

from axelements.

tbartelmess avatar tbartelmess commented on June 26, 2024

Here again, it's case sensitive. The identifier actually is com.apple.AddressBook. Probably it's best if you check the Info.plist of the application.

from axelements.

ferrous26 avatar ferrous26 commented on June 26, 2024

Hmmm, that might have to be the work around for now. Fortunately, there are a few ways to easily get the bundle identifier for an application. Here's a non-exhaustive list of ways you can do it from within Ruby (with AXElements):

1: If the app is already running

AX::Application.new('Contacts').bundle_identifier

2: If you know where the app is:

load_plist(File.read('/Applications/Contacts.app/Contents/Info.plist'))['CFBundleIdentifier']

from axelements.

 avatar commented on June 26, 2024

Thank-you, appreciated.

from axelements.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.