Jasondm007 Posted June 27, 2019 Share Posted June 27, 2019 @dfay I was tinkering around with the Active Windows workflow, and I noticed that a small tweak to the "active_window.scpt" helped it start working with the OmniOutliner app. Namely, if you remove the "document" reference when you're grabbing the app/name/id, it seem to work. I've copied the relevant version of the script below, commented out the original line, and added a notation to the new line in screenshot below. set theWindows to {} set appsForWindows to {} repeat with theApp in appList tell application theApp set itsWindows to every window repeat with w in itsWindows #set theWindows to theWindows & {{theApp as string, name of document of w, id of w}} set theWindows to theWindows & {{theApp as string, name of w, id of w}} -- Added by Jason end repeat end tell end repeat I still haven't had any luck getting it to work with PDF Expert, but I'll keep toying with it. Do you ever use this app? Unfortunately, I suspect that it's not scriptable. All the best! Link to comment
dfay Posted June 27, 2019 Author Share Posted June 27, 2019 (edited) Cool, thanks - I expect there will be a lot of similar quirks depending on how apps extend the base classes in applescript, but haven’t had the time to do further testing etc. Unfortunately Readdle seems to have no interest in making their apps scriptable - I had a brief email exchange with them after PDF Expert beta for Mac launched & they’ve done nothing since. Edited June 27, 2019 by dfay Link to comment
Jasondm007 Posted June 28, 2019 Share Posted June 28, 2019 @dfay Unfortunately, my previous suggestion had the unintended side-effect of retaining the page info from Preview - which takes up a ton of space in the output (e.g., page 1 of 350, etc.). To fix this, I just added an IF/THEN statement to use the original code for Preview's windows, and the abbreviated version for other things. I don't have Skim on my machine, so I didn't add anything special for it. I suspect that you'll want to treat it like Preview (i.e., the original code)? Here's the relevant portion of the "active_window" script: set theWindows to {} set appsForWindows to {} repeat with theApp in appList tell application theApp set itsWindows to every window repeat with w in itsWindows if ((theApp as string) is equal to "Preview") then -- Added by Jason set theWindows to theWindows & {{theApp as string, name of document of w, id of w}} else -- Added by Jason set theWindows to theWindows & {{theApp as string, name of w, id of w}} -- Added by Jason end if -- Added by Jason end repeat end tell end repeat Yeah, you're definitely right about PDF Expert. I asked them about a different script-related question previously, and got brushed off. I don't think they'll ever add it. That issue seemed like it was a little more complicated than grabbing a document/window's name, however. I'm a little surprised that it doesn't work here. Isn't that limited amount required? In any case, maybe I'll have to switch to another PDF reader/annotater some day. For the most part, I use Preview. However, I've always liked the simplicity and aesthetic of PDF Expert better - so I use it when I'm reading for longer periods. Its layout for annotations and bookmarks is a lot cleaner than Preview's. I also have Adobe Acrobat Pro DC and Abby FineReader, but I'm not a big fan of these apps when just reading or taking notes. I assume from the script that you're a Skim user, right? Out of curiosity, what do you do about the embedded annotations issue (assuming it's still an issue)? I never tried Skim because I hated the idea of having to remember to export each PDF after adding something to it. It's GUI always struck me as a little dated, too (but functional, nonetheless). Unrelated, but were you thinking about displaying each supported app's icons in the workflow's output? I ask because I noticed the images in the workflow's folder (and think it's a good idea, too). However, they've never shown up on my computer - even before I started screwing around with it. My output just shows the generic orange four squared icon from Alfred for all windows/apps. Link to comment
Jasondm007 Posted June 29, 2019 Share Posted June 29, 2019 @dfay By chance, do you know how to target Finder's "All Tags.." view (accessible most easily through the sidebar, when enabled)? I tried to create a simple workflow that opened Finder to this view, and have not had any luck. It seems to behave quite differently from most. Thanks Link to comment
dfay Posted June 30, 2019 Author Share Posted June 30, 2019 I've used Skim since 2005, before Preview added annotations, so it's largely a matter of inertia. But it also has better AppleScript capabilities for getting notes out than anything else I've tried I was trying to get the app icons but they weren't showing up despite using (what I think was) the correct json. So I gave up and used the generic 4 square icon. The "All Tags..." control would need to be addressed through GUI scripting. I tried a bit with no success. 40-02 1 Link to comment
Jasondm007 Posted July 1, 2019 Share Posted July 1, 2019 @dfay Thanks for giving it a try! I really appreciate it. I'm not sure what the deal is with Mojave's tags features. Even the old tags shortcut doesn't work without removing favorites or other odd workarounds. Let's keep our fingers crossed they address some of this in Catalina. ... I won't hold my breath. Link to comment
davidkizler Posted October 22, 2021 Share Posted October 22, 2021 (edited) Hi there, thanks for this awesome workflow! Is there possibly a way to have all Alfred searches lead to a folder opening open in a new tab? For example, rather than typing "fo folder_or_file_name" you can just type "folder_or_file_name" and the results will open in a new tab? I rarely want more than 1 finder window open so I'm just seeing if I can kind of make this the default Alfred behavior without having to add the "fo". Thanks either way! Edited October 22, 2021 by davidkizler Link to comment
davidkizler Posted October 22, 2021 Share Posted October 22, 2021 Hi there, thanks for this awesome workflow! Is there possibly a way to have all Alfred searches lead to a folder opening open in a new tab? For example, rather than typing "fo folder_or_file_name" you can just type "folder_or_file_name" and the results will open in a new tab? I rarely want more than 1 finder window open so I'm just seeing if I can kind of make this the default alfred behavior without having to add the fo. Thanks either way! Link to comment
deanishe Posted October 22, 2021 Share Posted October 22, 2021 5 hours ago, davidkizler said: Is there possibly a way to have all Alfred searches lead to a folder opening open in a new tab? Short answer: no. There's no option or API to tell Finder to open folders in a new tab. The only way to do it is to blindly fire simulated keypresses at Finder, wait a bit and tell Finder to navigate to the folder, hoping a new tab has opened in that time. It's very unlikely that Andrew would add that behaviour to Alfred because it's so hacky and unreliable. Link to comment
tbrown Posted March 22, 2022 Share Posted March 22, 2022 I just upgraded to a Mac Studio and am running macOS 12.3. although the workflow sort of works, it now will not find directories not at the top level of my user directory. For example, it will find /Users/tbrown/Downloads when I type "fo do", but it will not find /Users/tbrown/Downloads/irc' when I type "irc". It used to and I'm not sure when it quit. Remotely possible it is the change to Mac Studio (I had lots of problems with Migration Assistant not transferring various permissions). It could also be the upgrade to 12.3. Any suggestions? My version of the workflow is .5. Link to comment
vitor Posted March 22, 2022 Share Posted March 22, 2022 14 minutes ago, tbrown said: I had lots of problems with Migration Assistant not transferring various permissions Migration Assistant in Monterey is particularly problematic. See Troubleshooting File Indexing Issues on macOS Monterey. Link to comment
tbrown Posted March 22, 2022 Share Posted March 22, 2022 thanks for the tip. I fixed the problem by changing the scope of Alfred's search by dragging Macintosh HD into the scope field. Now the workflow finds the directory. Migration Assistant did not do me a lot of favors in this case. Link to comment
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now