raycast / extensions

Everything you need to extend Raycast.
https://developers.raycast.com
MIT License
5.23k stars 2.93k forks source link

[Google Chrome] Does not switch to tab #5998

Closed varp closed 1 year ago

varp commented 1 year ago

Extension

https://www.raycast.com/Codely/google-chrome

Description

Error:

Error: Command failed with exit code 1: osascript -e 
    tell application "Google Chrome"
      activate
      set _wnd to first window where id is NaN
      set index of _wnd to 1
      set active tab index of _wnd to 21
    end tell
    return true

96:99: execution error: The variable NaN is not defined. (-2753)

    tell application "Google Chrome"
      activate
      set _wnd to first window where id is NaN
      set index of _wnd to 1

Steps To Reproduce

I think it's caused by multi-profile/window usage of Chrome or by using of Tag groups

Current Behaviour

Got an error

Expected Behaviour

Switch to tab

raycastbot commented 1 year ago

Thank you for opening this issue!

🔔 @rgomezcasas @bromanko @crisboarna @andreaselia @rtyke @karolre @Aiee you might want to have a look.

💡 Tip: Once the issue is resolved, comment @raycastbot close this issue to close it.

karolre commented 1 year ago

Because I cannot reproduce the issue, I have prepared the pull request which should provide more info allowing to help understand the root cause: https://github.com/raycast/extensions/pull/6068

karolre commented 1 year ago

I was able to find a root cause thanks to more extensive error logging. The issue is related to the fact that in some cases MacOS generates windows identifiers which are represented in exponential form: 1,304973562E+9. Full exception below.

Error: Issue with tab: '[tab name]~~~[tab url]~~~~~~1,304973562E+9~~~4'
Command failed with exit code 1: osascript -e 
    tell application "Google Chrome"
      activate
      set _wnd to first window where id is NaN
      set index of _wnd to 1
      set active tab index of _wnd to 4
    end tell
    return true

96:99: execution error: The variable NaN is not defined. (-2753)

Command failed with exit code 1: osascript -e 
    tell application "Google Chrome"
      activate
      set _wnd to first window where id is NaN

Now I need to find a way to resolve it.

karolre commented 1 year ago

Raised PR to fix the issue: https://github.com/raycast/extensions/pull/6172

varp commented 1 year ago

@karolre Thanks a lot!