Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

phoenixuprising

macrumors newbie
Original poster
Nov 17, 2008
1
0
I'm pretty new to apple script so I'm needing some help. I'm trying to write an apple script that will take another apple script copy it into an textedit document and reformat into a single line unix command.

applescript:

Code:
tell application "Terminal"
	activate
end tell

tell application "System Events"
	
	keystroke "sudo softwareupdate -i -a"
	keystroke return
	delay 1
	keystroke " <<PASSWORD>> "
	keystroke return
	
end tell

to unix command

Code:
osascript -e "tell application \"Terminal\""  -e "activate" -e "end tell" -e "tell application \"System Events\"" -e "keystroke \"sudo softwareupdate -i -a\"" -e "keystroke return" -e "delay 1" -e "keystroke \" <<PASSWORD>> \"" -e "delay 1" -e "keystroke return" -e "end tell"

for that example I manually typed it out.

what I have so far is a script that takes what I have in a current open textedit document, copies it, opens a new document and pastes it.

Code:
tell application "TextEdit"
	activate
end tell

tell application "System Events"
	keystroke "a" using command down
	keystroke "c" using command down
	keystroke "n" using command down
	keystroke "v" using command down
	keystroke "a" using command down
	key code 126
end tell

I have no idea where to go from there though. Any help would be much appreciated.
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.