Can an Automator workflow generate an Application? I'm building a &quot;Wizard&quot; of sorts that uses Automator and some Appliescript, and at the end I would like it to generate an &quot;Automator Application&quot; 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:

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) &amp; &quot;test.scpt&quot;
    
    set code to &quot;osacompile -e 'tell application \&quot;Messages\&quot;' -e ' 
    set imessageservice to 1st service whose service type = iMessage' -e '
    set iMessageBuddy to buddy &quot; &amp; sms_address &amp; &quot; of imessageservice' -e '
    send &quot; &amp; sms_content &amp; &quot; to iMessageBuddy' -e '
    end tell' -o &quot; &amp; 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:

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 &quot;person@gmail.com&quot;
set sms_content to &quot;sms content&quot;

set savePath to (path to desktop as text) &amp; &quot;test.scpt&quot;

set code to &quot;osacompile -e 'tell application \&quot;Messages\&quot;' -e ' set imessageservice to 1st service whose service type = iMessage' -e 'set iMessageBuddy to buddy &quot; &amp; sms_address &amp; &quot; of imessageservice' -e 'send &quot; &amp; sms_content &amp; &quot; to iMessageBuddy' -e 'end tell' -o &quot; &amp; quoted form of POSIX path of savePath

do shell script code
So from the edits to my post, I was on the right track.  But I forgot that the final script needs to have quotes around the content being passed in!  This is the code snippet that ultimately worked:
set sms_address to &quot;sms_address&quot;
set sms_body to &quot;sms_body&quot;
set filename to &quot;filename&quot;
set savePath to (path to desktop as text) &amp; filename &amp; &quot;.scpt&quot;

set code to &quot;osacompile -e '
tell application \&quot;Messages\&quot; 
    set imessageservice to 1st service whose service type = iMessage 
    set iMessageBuddy to buddy \&quot;sms_address\&quot; of imessageservice 
    send \&quot;sms_body\&quot; to iMessageBuddy
end tell' -o &quot; &amp; quoted form of POSIX path of savePath

do shell script code

So I was on the right path all along, just needed to excape those double quotes.