andweeb / Ki

⌘ Work in macOS like you work in vim <currently under construction>
MIT License
127 stars 13 forks source link

cannot locate the window of Microsoft Teams app #10

Closed NitroCao closed 3 years ago

NitroCao commented 4 years ago

local Application = spoon.Ki.Application local iterm2 = Application:new('iTerm2') local pycharm = Application:new('pycharm') local music = Application:new('Music') local datagrip = Application:new('datagrip') local teams = Application:new('Teams') local outlook = Application:new('Microsoft Outlook')

local entityEvents = { { nil, "i", iterm2, { 'Entities', 'iTerm2' } }, { nil, "t", teams, { 'Entities', 'Teams' } }, { { 'shift' }, "p", pycharm, { 'Entities', 'pycharm' } }, { { 'shift' }, "m", music, { 'Entities', 'Music' } }, { { 'shift' }, "d", datagrip, { 'Entities', 'datagrip' } }, { { 'shift' }, "o", outlook, { 'Entities', 'Microsoft Outlook' } }, }

spoon.Ki.workflowEvents = { entity = entityEvents, } spoon.Ki:start()


* `ps -ef | grep Teams`:
![image](https://user-images.githubusercontent.com/17915615/81631612-d02f5b80-943a-11ea-963c-8235f047e89a.png)

The corresponding key cannot locate the window.
andweeb commented 4 years ago

Hi!

It looks like the application name is actually "Microsoft Teams", so try updating the line to be:

local teams = Application:new('Microsoft Teams')

Let me know if that works!

NitroCao commented 4 years ago

Hi!

It looks like the application name is actually "Microsoft Teams", so try updating the line to be:

local teams = Application:new('Microsoft Teams')

Let me know if that works!

Thanks for your reply. It works! BTW, would you please tell me what is the best way to find out the exact name of an app? This thing indicates that searching from ps command is not good.

andweeb commented 4 years ago

Great!

The name is used to retrieve the application instance using hs.application.get that expects the localized name of the application. The best way to find the exact name would be to search on Spotlight and use the name that gets returned.

You can also list all application names and metadata using the system profiler command:

system_profiler SPApplicationsDataType

Thanks for reporting! I'm actually working on a v2 release for Ki in the develop branch. I'll consider using hs.application.find instead to loosen the exactness of the name, so I'll keep this issue open until that release.

For example, if you change this line to use .find() instead, you would be able to use Application:new('Teams').

NitroCao commented 4 years ago

Great!

The name is used to retrieve the application instance using hs.application.get that expects the localized name of the application. The best way to find the exact name would be to search on Spotlight and use the name that gets returned.

You can also list all application names and metadata using the system profiler command:

system_profiler SPApplicationsDataType

Thanks for reporting! I'm actually working on a v2 release for Ki in the develop branch. I'll consider using hs.application.find instead to loosen the exactness of the name, so I'll keep this issue open until that release.

For example, if you change this line to use .find() instead, you would be able to use Application:new('Teams').

Thanks for your reply, and thanks for your excellent work 👍