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

chown33

Moderator
Staff member
Aug 9, 2009
10,750
8,422
A sea of green
Wrap a shell script with Platypus.

http://sveinbjorn.org/platypus

Or if it's a single command, like 'purge', simply use this AppleScript command:
Code:
 do shell script "purge"


----------

YEA but how to hook up the button to the code

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.
 

DavidBlack

macrumors 6502a
Original poster
Jan 27, 2013
606
239
Somewhere In Apple's HQ ;)
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.
 

chown33

Moderator
Staff member
Aug 9, 2009
10,750
8,422
A sea of green
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?
 

DavidBlack

macrumors 6502a
Original poster
Jan 27, 2013
606
239
Somewhere In Apple's HQ ;)
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?

No I am making a free memory app. And I want to get the stats in activity monitor in the app the free memory pie chart how do I get that done?
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.