YuTang Posted August 1, 2022 Share Posted August 1, 2022 I make a workflow to pass through selection/clipboard contents(only if there is no selection) to Alfred (for example, to search them on a certain website), they can be texts or images, yet I have no idea how to filter them from each other for different usages. Could you please give me any instruction on this, thank u so so much~ Link to comment
vitor Posted August 1, 2022 Share Posted August 1, 2022 Make a Run Script Action with Language set to /usr/bin/osascript (JavaScript) and code: ObjC.import("AppKit") function run() { const clipboardTypes = $.NSPasteboard.generalPasteboard.pasteboardItems.js[0].types.js.map(c => c.js) if (clipboardTypes.includes("public.utf8-plain-text") && !clipboardTypes.includes("public.file-url")) return "text" return "not text" } That will output text or not text, depending. Can’t be more precise without knowing your Workflow. Use a Conditional Utility to filter the output. 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