I have a group full of PDFs which are captured from URLs (e.g. a PDF of https://devontechnologies.com). I’d like to ‘browse’ through that group opening the URL instead of the PDF. I’ve written a script “Open URL in DT” which is executed via a smart rule “On open” in the database.
This works fine, but I’d like to only do this when browsing the database via a specific smart group (so I can choose to have the rule applied or not). But obviously smart rules can’t be applied on smart groups. So my workaround would be to manually disable / enable the smart rule when needed. Are there any other ways I could achieve this idea (I’m thinking as an analogy this is like looking at a ‘database view’ or ‘virtual table’ rather than the original table).
If there’s no workaround - is there a way to script enabling / disable a smart rule?
is there a way to script enabling / disable a smart rule?
No.
would it be possible to have the “Open URL in DT” check the type of the current open group?
Items aren’t contained in smart groups, so what would be the point of checking the group?
I think you’re overcomplicating this. I don’t even see a need for a script in this case.
Why don’t you just apply some specific metadata to items you want to operate this way?
What would be the purpose of automating this via KM or BTT?
There’s already a command – Data > Launch URL – and a shortcut available.
Also, the smart rule I suggested does what the OP is describing.
Although I’m capturing PDF (mainly for purposes of search) - reading is always more convenient if there’s still a webpage available (which there mostly is when I’m browsing my inbox). I should have specified that I’m opening the URL in DT, so in the content window like this:
on performSmartRule(theRecords)
tell application id "DNtp"
repeat with theRecord in theRecords
set theWindow to think window 1
set theRecord to content record of theWindow
set URL of theWindow to URL of theRecord
end repeat
end tell
end performSmartRule
I want to browse the URL, but still have e.g. the Inspector open on the item (in most cases a PDF) I’m looking at - that’s what this little script is excellent for. I think I’m going to explore if I can script something to find out the currently opened smart group (as indeed items are not contained there, but it’s opened in the sidebar so maybe I can find out that via scripting).