I want to make a app that executes a terminal command with a button. Eg when I press the button I want it to purge the memory how do i do that? HELP!
do shell script "purge"
YEA but how to hook up the button to the code
Or if it's a single command, like 'purge', simply use this AppleScript command:
Code:do shell script "purge"
----------
The same way you'd do it in any other AppleScript. If you're looking for a tutorial on writing AppleScript and hooking it up to buttons, you should search for that using a search engine like google.
If all you want to do is run the 'purge' command, you don't need a button for that. Enter the command I posted above. Save your AppleScript as an application. To purge memory, launch the application. Every time the application is launched, it purges memory. No button needed/
If you want to do other things, like present a dialog, there are AppleScript commands for that. Google search terms: applescript dialog.
If you want a complete window, with multiple buttons, one of which purges memory, and other buttons that do other things, look for a tutorial on making windowed applications with buttons in AppleScript. Everything other than do shell script "purge" will be common to all such AppleScript apps.
Thanks for you help bro btw how do I place memory usage stats e.g how activity monitor has it.
I don't understand what you want.
Are you asking how to get memory usage statistics? Or are you asking how to display statistics in a list that looks similar to Activity Monitor?
Are you really trying to write a replacement for Activity Monitor using AppleScript? If so, why?