Closed aaronjz closed 2 years ago
this syntax looks off. the script seems to work in script editor. however, this line returns the index not the window itself.
set targetWindow to item 1 of windows
you may want to try something more like:
set targetWindow to item 1 of window 1
that being said it seems to infer the correct the window, but other times when I try to just return item 1 of windows I get an error. but it appears to be timing issue. I get the error if I run this script with brave closed and it has to launch brave. Activate in AppleScript will launch the app if isn't running. The error is that the script tries to get "item 1" before item 1 is even available.
Thank you for reporting this, @aaronjz - this portion of the extension is based on the Chrome extension, and I have hit this issue myself recently; I'll have a look at it over the next few days and get a patch pushed up. My gut says it has to do with multiple windows open, and the tab is on a minimized or hidden window.
You’re welcome! Thanks for looking into it. I appreciate the work!
Aaron On Jun 10, 2022, 8:26 AM -0700, Ron Myers @.***>, wrote:
Thank you for reporting this, @aaronjz - this portion of the extension is based on the Chrome extension, and I have hit this issue myself recently; I'll have a look at it over the next few days and get a patch pushed up. My gut says it has to do with multiple windows open, and the tab is on a minimized or hidden window. — Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you were mentioned.Message ID: @.***>
@ron-myers I had encountered this too. after a few attempts I noticed with the second script below. The window ids seem to be the issue. this appears to work modifying the line to be "first window" to be reliable.
modified script:
set newTabUrl to "https://sunsetcc.churchofficechms.com/members"
tell application "Brave Browser"
activate
set targetWindow to item 1 of first window whose index is 1
tell targetWindow
set visible to false
set visible to true
set index to 1
end tell
tell front window to make new tab at after (get active tab) with properties {URL:newTabUrl}
end tell
how I figured out the window ids don't start start at integer of 1, which is why item 1 can't be found. This is with just one window open and one active tab notice the id is 43 and tab index is 44:
tell application "Brave Browser"
-- return id of every window
return properties of first window
end tell
Result:
{closeable:true, zoomed:false, active tab index:1, class:window, index:1, visible:true, given name:"", name:"New Tab", miniaturizable:true, mode:"normal", active tab:tab id 44 of window id 43 of application "Brave Browser", id:43, miniaturized:false, resizable:true, bounds:{444, 106, 1644, 937}, zoomable:true}
edit: added "whose index is 1" this is equivalent to "frontmost" window.
This issue/pull request has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs in the next 7 days to keep our backlog clean. Thanks for your contributions.
Extension – Brave
Author: @ron-myers
Description
The app didn't open a browser tab when I selected one and pressed enter (I use the Brave browser). It just crashed.
Error:
Steps To Reproduce
The current behavior
Closes the Raycast window, and nothing happens with the Browser.
The expected behavior
Open the selected website in a new default browser tab.
Raycast version
Version: 1.35.2