Jump to content
multicolor

Not focusing correct Excel window

Recommended Posts

Hello, 

 

I don't know if this is just me, but here goes. 

 

Alfred does not focus the correct window when having several different Excel-files open.

 

How to replicate:

 

1) Open existing spreadsheets A and B

2) Leave A focused and try to open B from Alfred

3) For me A stays focused and B still in the background. If opening from another app, it correctly activates Excel but the wrong window (the last active) is focused.

 

The thing is that other apps can do it correctly. For example the lovely window-switcher Contexts consistently switches to the chosen file. 

 

This is not the case with other apps than Excel as far as I've seen. 

 

Running Alfred 4.0.6 [1123] on 10.14.6 Mojave, with Excel 16.30 from Office 365.

 

Cheers,

M

Edited by multicolor

Share this post


Link to post
6 minutes ago, multicolor said:

Alfred does not focus the correct window

 

Alfred doesn't focus any windows. It simply asks macOS to open the specified file (optionally with a specific application).

 

What happens after that is up to macOS and the application opening the file. That is to say, it's an issue with Excel, not Alfred.

Share this post


Link to post
4 minutes ago, deanishe said:

 

Alfred doesn't focus any windows. It simply asks macOS to open the specified file (optionally with a specific application).

 

What happens after that is up to macOS and the application opening the file. That is to say, it's an issue with Excel, not Alfred.

 

Thanks for your lightning-fast reply.

 

I understand that, but seeing as other apps such as Contexts are doing it better (i.e asking macOS in supposedly different way) it is indeed something than can be improved with Alfred.

Share this post


Link to post
3 minutes ago, multicolor said:

seeing as other apps such as Contexts are doing it better

 

Contexts isn't doing the same thing. It's telling the OS to focus a window. Alfred is telling the OS to open a file.

 

Exactly the same thing happens if you open an Excel file from Finder and exactly the same thing would happen if you could open a file via Contexts because the problem is with the way Excel handles open-file commands.

 

Alfred (and every other application that opens files) aren't going to add window-management logic just to work around a bug in Excel.

Share this post


Link to post
On 11/5/2019 at 5:47 PM, deanishe said:

 

Contexts isn't doing the same thing. It's telling the OS to focus a window. Alfred is telling the OS to open a file.

 

Exactly the same thing happens if you open an Excel file from Finder and exactly the same thing would happen if you could open a file via Contexts because the problem is with the way Excel handles open-file commands.

 

Alfred (and every other application that opens files) aren't going to add window-management logic just to work around a bug in Excel.

 

Hi,

 

Thanks a lot for clarifying that. I understand the difference, and can definitely sympathise with not wanting to add app-specific workarounds for buggy apps. 

 

I'm wondering though, would it be possible to implement (in a workflow or in the Alfred main code) the functionality of focusing the app window if the app is running rather than opening the file? Perhaps there's already something like that,  although I haven't found it. 

Share this post


Link to post
2 minutes ago, multicolor said:

the functionality of focusing the app window if the app is running rather than opening the file?

 

By that you mean the window that has that specific file open in it, right? Yes, that's possible to do via Excel's AppleScript API. You can check if the application is running, and Excel's AppleScript API allows you to tell which documents are open in which windows. So you could probably create a workflow.

 

First of all, you should report the bug to Microsoft, though.

Share this post


Link to post

Excel aside, I've had a bit of a play this morning of making Alfred "activate" an application if it's already running instead of asking macOS to open (reopen) it, which would essentially give Alfred the same behaviour of cmd+tab instead of Spotlight / Finder like reopening.

 

This brings different and sometimes undesirable behaviour, for example, if you have Messages.app open but no windows open for the app and cmd+tab to it, you don't get the messages window. This compares unfavourably to the current behaviour where a new Messages window is opened.


As a side note, Dock seems to have the ideal behaviour in this situation when looking at the Messages.app example, but I suspect it's using workspace APIs which aren't publicly accessible (e.g. direct access to the current windows for an app and shaping the behaviour accordingly).

 

Alfred's default behaviour will remain as it is (i.e. matching Spotlight and Finder vs cmd+tab).

Share this post


Link to post
23 minutes ago, Andrew said:

Dock seems to have the ideal behaviour in this situation when looking at the Messages.app example

 

Could Alfred not check if the app has any windows open, and then activate or open accordingly? Or is that too slow?

 

The same behaviour as messages is fairly common amongst document-based apps, like browsers and editors, I believe.

Share this post


Link to post
35 minutes ago, deanishe said:

Could Alfred not check if the app has any windows open, and then activate or open accordingly? Or is that too slow?

 

Modern macOS restricts access to these kind of things without the necessary permissions, and as much as possible, Alfred is an "opt-in" when it comes to giving permissions... so I don't think I could make this work as standard default behaviour, which is imperative when it comes to such a fundamental action.

 

To re-phrase, for such a core feature, I'd rather do a single simple API call to open an app, matching Spotlight's behaviour, rather than go through logic which could potentially hold Alfred up making Alfred "slow" for the every-day user.

Share this post


Link to post
2 minutes ago, Andrew said:

Modern macOS restricts access to these kind of things

 

I think I hate modern macOS.

 

3 minutes ago, Andrew said:

rather than go through logic which could potentially hold Alfred up making Alfred "slow" for the every-day user.

 

Yeah. You can't have such a core action being slow.

Share this post


Link to post

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...