Jump to content

newbie1234

Member
  • Posts

    6
  • Joined

  • Last visited

Everything posted by newbie1234

  1. Hi, in case anyone comes across this, this code works properly. This is because the previous `activate` only makes the Incognito tab visible, but doesn't actually focus on it. I incorporated the code found here; do clickthrough for a more comprehensive explanation of what the code does. # Activates the specified window (w) of the specified AppleScriptable # application (a). # Note that both parameters must be *objects*. # Example: Activate the window that is currently the 2nd window in Chrome: # tell application "Google Chrome" # my activateWin(it, window 2) # end tell on activateWin(a, w) tell application "System Events" click menu item (name of w) of menu 1 of menu bar item -2 ¬ of menu bar 1 of process (name of a) end tell activate a end activateWin on run argv tell application "Google Chrome" -- Open incognito window set W to every window whose mode is "incognito" if W = {} then set W to {make new window with properties {mode:"incognito"}} set [W] to W -- Focus incognito window tell application "Google Chrome" activate set index of (every window whose mode is "incognito") to 1 end tell my activateWin(it, window 1) if title of W does not contain "New Tab" then tell application "System Events" to keystroke "t" using command down # set emptyTab to my lookupTabWithUrl("chrome://newtab/") # if emptyTab is not null then # close emptyTab # end if -- Focus incognito window # my activateWin(it, W) end tell end run
  2. My apologies. You are right I'm using `Run NSAppleScript`. How do I rewrite it using a Run Script with /usr/bin/osascript (AS) as the language? My workflow is currently based on someone else's workflow from the forums. You can find it here. Thank you very much! (It's currently working, but like I said, it stops working somewhat erratically.)
  3. Hi, For context, I am trying to use a hotkey to trigger a Workflow to open a new Chrome incognito tab (if none is open) and switch to a Chrome incognito tab if there is one. I have mapped it to Cmd + Option + N (though I don't think this matters). The issue would be more straightforward if this straight-up doesn't work. The weird thing is that it mostly works, then it stops working, but when I restart my laptop, it works again. In previous versions of macOS/Alfred, this has mostly worked, so this seems to be a new issue. Steps taken to debug and other relevant info: - I have used ShortcutDetective and it shows that Alfred is the one receiving the shortcut - On macOS 11.5.1 and Alfred 4.5 - See AppleScript code below (not sure if this might be relevant) On a side note, I have recently experienced a similar issue with using caps to change my input source, i.e. it became flaky but works after restart. Not sure if related (Alfred wasn't involved in that). I'd prefer not to restart my laptop every few days. The relevant AppleScript triggered by the workflow, in case anyone is interested: on alfred_script(q) tell application "Google Chrome" -- Open incognito window set W to every window whose mode is "incognito" if W = {} then set W to {make new window with properties {mode:"incognito"}} set [W] to W -- Focus incognito window set index of W to 1 activate set emptyTab to my lookupTabWithUrl("chrome://newtab/") if emptyTab is not null then close emptyTab end if -- Focus incognito window set index of W to 1 activate end tell end alfred_script
  4. I tried searching for this but can't find anyone with the same version. As far as I can tell, I have tweaked the settings and granted permission, but I am missing the rich file preview part when I search on Alfred. That is, for the screenshot on https://www.alfredapp.com/help/features/previews/ I am missing the right hand side with the picture and the file info. Hoping for a fix! (I even bought the Powerpack thinking this is a paid feature.)
×
×
  • Create New...