Sample Header Ad - 728x90

Can an Automator workflow generate an Application?

0 votes
1 answer
197 views
I'm building a "Wizard" of sorts that uses Automator and some Appliescript, and at the end I would like it to generate an "Automator Application" that does things when launched, that are based on the inputs from the wizard. Is this even possible? Can one Automator workflow, actually generate an application from the results? I know software can create software, but is this possible within Automator's capabilities? **EDIT: As noted in the comments below the post, osacompile seems like it might get me where I want to go, but now I have a new problem with that.** Here's a screenshot of my automator steps: Automator routine Here's the code of the erroring module (Send iMessage): on run {input, parameters} set sms_address to item 1 of input set email_address to item 2 of input set sms_content to item 3 of input set email_subject to item 4 of input set email_body to item 5 of input set savePath to (path to desktop as text) & "test.scpt" set code to "osacompile -e 'tell application \"Messages\"' -e ' set imessageservice to 1st service whose service type = iMessage' -e ' set iMessageBuddy to buddy " & sms_address & " of imessageservice' -e ' send " & sms_content & " to iMessageBuddy' -e ' end tell' -o " & quoted form of POSIX path of savePath do shell script code return input end run Note that the lines are broken up that way because it was the only approach I could find where I didn't get any errors just because of adding line breaks (I can put this code all on one line and get the identical error) Here's the error I receive: osacompile error message I haven't been able to figure out what the problem is here but it seems like I'm not passing the variables in the way a bash script expects. Have tried a bunch of other approaches and nothing has worked any better, but this is the one that seems the most sensible to me, knowing how I would normally pass variables into a script. **EDIT 2: To simplify further, here is the standalone code I'm current debugging in AppleScript Editor and without any line breaks to not confuse the issue:** set sms_address to "person@gmail.com" set sms_content to "sms content" set savePath to (path to desktop as text) & "test.scpt" set code to "osacompile -e 'tell application \"Messages\"' -e ' set imessageservice to 1st service whose service type = iMessage' -e 'set iMessageBuddy to buddy " & sms_address & " of imessageservice' -e 'send " & sms_content & " to iMessageBuddy' -e 'end tell' -o " & quoted form of POSIX path of savePath do shell script code
Asked by JVC (2951 rep)
Jul 14, 2020, 11:41 PM
Last activity: Jul 21, 2025, 12:00 PM