sepulchra Posted October 4, 2022 Share Posted October 4, 2022 (edited) I currently use this contact query. (screenshot below) When i search for a contact within alfred -- i select their number and it focuses me on the message field where i can type directly into that field. I'm wondering if there is a way to build a worklfow where i can also type the message as a variable and also have it send to that contact. There is this applescript.... tell application "Messages" set targetBuddy to "(XXX) XXX-XXXX" set targetService to id of 1st account whose service type = iMessage set textMessage to "test" set theBuddy to participant targetBuddy of account id targetService send textMessage to theBuddy end tell Is there a way to use the custom contact action in a workflow to pass the number to that script -- and i can use another keyword to pass the message to into a variable that also hits that script? I just don't want to leave alfred to send the message if it is a contact i have to send regular messages to Edited October 4, 2022 by sepulchra Link to comment
Stephen_C Posted October 4, 2022 Share Posted October 4, 2022 Although this is not the complete answer to your problem I think it can be done because I've done something similar. In effect what you need to do is to save both the number and the message as separate variables in the workflow (just use a keyword action for the message without any keyword) and then pass to Messages a URL like imessage://{var:recipient}&body={var:theMessage}. Stephen Link to comment
sepulchra Posted October 4, 2022 Author Share Posted October 4, 2022 (edited) That is interesting. The thing about the contact custom action that is nice is that (i think) it is extracting the number and formatting it correctly. Alfred is pulling that metadata in the contacts app for the query... Edited October 4, 2022 by sepulchra Link to comment
vitor Posted October 4, 2022 Share Posted October 4, 2022 You’ll need a Contact Action Trigger, which you then add in the Contacts Feature as per your Screenshot. You’ll need a Keyword Input to ask for the message text, plus the Arg and Vars Utility to save the variables. Your code will be in a Run Script Action. To get the variables into your code, see the documentation. Link to comment
sepulchra Posted October 4, 2022 Author Share Posted October 4, 2022 thank you @vitor i sorted it! the irony is that i'm not sure if i am saving any time, but i learned something! 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