Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8635387
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T09:57:46+00:00 2026-06-12T09:57:46+00:00

I have an AppleScript: on run set pathName to /Users/Alexander/Documents/GeekTool/DiskCapacityMeter set usedSpace to (do

  • 0

I have an AppleScript:

on run
    set pathName to "/Users/Alexander/Documents/GeekTool/DiskCapacityMeter"
    set usedSpace to (do shell script "df -hl | grep 'disk0s2' | awk '{sub(/%/, \"\");print $5}'") as integer

    set theNumber to (round (usedSpace / 5)) * 5

    do shell script ("cp " & pathName & "/img/" & theNumber & ".png " & pathName & "/temp.png")
end run

(downloaded from: Here)

I wanna change this script to show my CPU usage instead of my disc capacity, and since i really don’t know any AppleScript, i have no clue how to change it.

I just know i need to change this part:

(do shell script "df -hl | grep 'disk0s2' | awk '{sub(/%/, \"\");print $5}'")

to give me my CPU usage instead of my disc capacity.. if it’s even possible to get my CPU usage this way?

edit*
There are 11 picures associated with this script (0-10.png) and a twelfth picture (temp.png) that changes to one of the first 11 depending on the number generated by the script.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-12T09:57:47+00:00Added an answer on June 12, 2026 at 9:57 am

    I don’t know how accurate this is, but the CPU usage at single points of time has a lot of variance:

    ps axo %cpu | awk '{s+=$1}END{print s}'
    

    This would be even less accurate, because top itself uses a lot of CPU:

    top -l1 -n0 | sed -En 's/^CPU usage: ([^%]*)% user, ([^%]*)%.*/\1+\2/p' | bc
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am trying to run this shell script command through applescript on my mac
I have an applescript that reads data from a CSV (successfully!). After my script
I have such an AppleScript: tell application Firefox activate set the bounds of the
I have Mail set up to execute an AppleScript when it receives an email
I have an automator workflow with a Run Applescript action. Is it possible to
I have an AppleScript script that I use to display iTunes track information on
I have two windows/tabs set up to run in Terminal.app, syd and mel. i.e.
I have an applescript that refuses to run on any excel files I feed
Hi I have written applescript to get file name. on open of thisPDF set
I have a simple 'repeat with' in an AppleScript, and would like to move

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.