Joren Posted December 19, 2022 Share Posted December 19, 2022 It would be useful to be able to do a javascript script on a number or clipboard when you type a snippet. For example "Encode" would give me : function () { return Math.floor({clipboard:0} +1145 * 16 / 4145) } and what it returns it will paste as a snippet. Alternatively maybe allow GET requests to do these things. Link to comment Share on other sites More sharing options...
vitor Posted December 19, 2022 Share Posted December 19, 2022 Welcome @Joren, {clipboard} is a Dynamic Placeholder introduced by Alfred, randomly allowing it in the middle of code could lead to breaking behaviour. Furthermore, a GET request wouldn’t apply to get the clipboard contents. If you want the clipboard contents, ask macOS for it: const app = Application.currentApplication() app.includeStandardAdditions = true const clipboard = app.theClipboard() Math.floor(clipboard + 1145 * 16 / 4145) or ObjC.import("AppKit") const clipboard = $.NSPasteboard.generalPasteboard.stringForType($.NSPasteboardTypeString).js Math.floor(clipboard + 1145 * 16 / 4145) Alternatively, use the {clipboard:0} as the argument in an in a Arg and Vars Utility and call it as an argument: function run(argv) { return Math.floor(argv[0] + 1145 * 16 / 4145) } Link to comment Share on other sites More sharing options...
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