r/applescript • u/GeroSchorsch • Aug 19 '21
How to save command-result in variable?
Hey guys Im really new to AppleScript and wanted to use it to test my shell. So I tell AppleScript to start the shell and execute some commands. I want to test if the output of the commands is the desired one. How do I get the command output? This is the code:
osascript <<EOF
tell application "System Events"
keystroke "cd /Users/uwe/documents/coding/c/pshell"
delay 0.5
keystroke return
delay 0.5
keystroke "make compile_and_run"
delay 1
keystroke return
set resul to paragraphs of (read STDOUT)
end tell
EOF
Thanks for the help
3
Upvotes
View all comments
Show parent comment
1
u/brandelune Aug 20 '21
Ooops, sorry. I had not seen u/ssharky's reply.