Search the Community
Showing results for tags 'clipboad'.
Found 2 results
Hello forum, What's the best practice for a workflow trigger (keyword or script filter) that uses an optional argument with a fallback value? Example 1 (I made this up): I want to more easily yell at people on the internet, so I have a workflow that turns text to caps. My clipboard is "foo". I call caps and expect my script to receive "foo". I call caps wasd and expect my script to receive "wasd". Example 2: Like example 1, but instead of the contents, I want to use hardcoded text. I call caps and expect my script to receive "your mother". ... What's the best practice to do that? This would be the in-script solution. Is there a built-in way to do this? import sys from AppKit import NSPasteboard, NSStringPboardType def getClipboard(): pb = NSPasteboard.generalPasteboard() pbstring = pb.stringForType_(NSStringPboardType) return u"Pastboard string: %s".encode("utf-8") % repr(pbstring) query = sys.argv if len(sys.argv) >= 2 else getClipboard() # query = sys.argv if len(sys.argv) >= 2 else "your mother" #example 2 sys.stdout.write(query.upper())
I want to run a workflow when something is getting copied into the clipboard. If the clipboard content matches a certain pattern I want to open a URL. Is this possible at all? To me it seems I need a keyboard trigger that then inspects the clipboard. Which isn't quite as automated as I wished. cheers, Torsten