Jump to content

joedarch

Members
  • Posts

    8
  • Joined

  • Last visited

Reputation

0 Neutral
  1. Ummm...Christopher, isn't this for Windows? I think James is looking for something to start up CCleaner on Snow Leopard on a MAc (so, not in Windows) and let it run automatically, no? If so, here it goes: 1) press command-space (to activate spotlight) 2) in spotlight, type "applescript editor" - select it, it will start to run 3) copy paste the text below into the applescript editor tell application "CCleaner" activate tell application "System Events" click button "Run Cleaner" of window "Ccleaner" of process "CCleaner" end tell end tell 4) save the file as an application (anywhere you want). 5) Anytime you run this application (by double clicking on it - or by putting it in your dock so you just only have to click it once), it will startup CCleaner and run the cleaning task. (Be sure to run CCleaner once and manually beforehand to setup your cleaning needs per application...) That's all there is to it! Note: if you don't want to run the cleaner after startup but only want it to analyze, then in the script-text above (under point 3): replace "Run Cleaner" with "Analyze". Oh, and if you want CCleaner to quit automatically after cleaning, just add the following text below the script-text under point 3: global idleTime, processName, averageCPUvalue, tempCPUsum, counterTics, maxCPUusage set idleTime to 1 set processName to "CCleaner" set counterTics to 0 set maxCPUusage to 15 on idle set processProcessorUsage to word 2 of (do shell script "/bin/ps -xcro command,%cpu | grep " & quoted form of processName) if processProcessorUsage < maxCPUusage then set counterTics to counterTics + 1 if counterTics > 3 then tell application "CCleaner" quit end tell quit me else return idleTime end if else return idleTime end if end idle If you added this text to quit CCleaner automatically, be sure to check the "stay open" box if you save the script as an app!!! ...Now, if you want to startup CCleaner, clean and quit CCleaner everytime (and automatically) when you boot your Mac, just put your app into the login items (go to preferences, accounts and choose login options to add login items)! Cheers! Joe D.
  2. Success! Only, not with the average CPU usage, but the script determines whether the CPU usage goes at least 3 times under 40 %. These numbers can be altered in the script of course to suit your needs. Experiment! Here's the script that: 1) runs CCleaner 2) runs its cleaning task 3) quits CCleaner! tell application "CCleaner" activate tell application "System Events" click button "Run Cleaner" of window "Ccleaner" of process "CCleaner" end tell end tell global idleTime, processName, averageCPUvalue, tempCPUsum, counterTics, maxCPUusage set idleTime to 1 set processName to "CCleaner" set counterTics to 0 set maxCPUusage to 40 on idle set processProcessorUsage to word 2 of (do shell script "/bin/ps -xcro command,%cpu | grep " & quoted form of processName) if processProcessorUsage < maxCPUusage then set counterTics to counterTics + 1 if counterTics > 2 then tell application "CCleaner" quit end tell quit me else return idleTime end if else return idleTime end if end idle ...Copy and paste this in Apple script editor, save it as a 'stay open' application. That's it. Whenever you run the application it will do as mentioned: start, run and quit CCleaner, in that order! Of course, you have to set CCleaner's settings (determine what it will delete) by running it manually (not with the script!) and tick the necessary boxes! Cheers! Joe D.
  3. Still searching... Now, I'm checking another forum (the cool macscripter.net) to see if it's possible to determine in my script whether CCleaner has done its task yet. I'm still working on it, but the main idea is to let the script check every x seconds since CCleaner started cleaning to see if the average(!) processor (CPU) usage of CCleaner hasn't dropped below a certain percentage yet (for instance 8%). If so, CCleaner will be told to quit. If not, the script will continue checking. If (I don't know yet, so bear with me!) and when it works, I'll post about it! And I'll post the script(s) of course! Cheers, Joe D.
  4. Ok, I'm here... Here's the first script to startup CCleaner and run the cleaning process: tell application "CCleaner" activate tell application "System Events" click button "Run Cleaner" of window "Ccleaner" of process "CCleaner" end tell end tell And here is the other script, to shut down all apps and shutdown the Mac: tell application "System Events" to set the visible of every process to true set white_list to {"Finder"} try tell application "Finder" set process_list to the name of every process whose visible is true end tell repeat with i from 1 to (number of items in process_list) set this_process to item i of the process_list if this_process is not in white_list then tell application this_process quit end tell end if end repeat on error tell the current application to display dialog "An error has occurred!" & return & "This script will now quit" buttons {"Quit"} default button 1 with icon 0 end try tell application "Finder" shut down end tell ...That's it... Save these two scripts as apps, give them an icon, put them in your dock and in two clicks you clean and shutdown your mac! Cheers! (Still searching to do it in one click though!) Joe D.
  5. To be really able to delete Flash cookies would be awesome indeed!
  6. Thanks for the reply - I figured this feature will/might be there one day as it's there in the Windows version and it's not a Windows specific feature. Of course, I can post my AScripts - I should have done that in the first place! I'm at work now and don't have them with me, I'll post them tonight or tomorrow. In the meantime, I'm still searching for scripts or other ways to shut CCleaner down automatically after having done its job. I tried to implement an "idle" handler in a script (meaning: it checks the idle state of the system for x seconds, after which it shuts down CCleaner), but that doesn't work as this handler doesn't seem to detect that CCleaner is still cleaning. So it shuts down while still cleaning. So now I'm looking for some other way to detect whether CCleaner is still busy cleaning or analyzing. That's the rather hard part: I have to find some proof of CCleaner having done. It's not about the "process CCleaner" running, it's all about its busy/active state: as long as it's doing a task (cleaning/analyzing), it should not quit yet. Maybe there's some sort of file (maybe a log or something?) that CCleaner alters or produces after having done its cleaning job? Does anyone know about that? Or something else like that? This can be checked by the script with "IF...THEN" so, that would be a way to quit CCleaner only when it's done with its task... Anyway, I'll post what I've got so far tonight or tomorrow! Cheers, Joe D.
  7. I forgot something: ...So, for now, I just run my applescript to automatically startup Ccleaner and (automatically) do the clean process and then, I run another script to quit all apps and shutdown the mac. I've setup both applescript apps with their own icon and placed them on my dock. So, with two clicks on my dock I clean and shut down my Mac.
  8. Hi, I absolutely loved CCleaner for Windows and since I switched to Mac, I love the Mac version! However, the Windows version has this cool "close program after cleaning" feature and the Mac version hasn't...yet? I really hope to see this come to CCleaner for Mac one day. In the mean time, I made an app with applescript that starts the CCleaner app and automatically runs the cleaning process. After that, I still have to quit CCleaner manually. It would be awesome to have the "close program after cleaning" feature. Like that, I will even be able to make an app (with automator and applescript combined) which: 1)...quits all running apps 2)...starts CCleaner 3)...runs the cleaning process automatically (written in applescript to click on the "Clean" button) 4)...quits CCleaner (set in the options of CCleaner once the option is there) 5)...shuts down my Mac or puts it to sleep Now, that would be very convenient and handy: automatically clean my Mac and shut it down with one click on my app-icon! So, hope to see the "close program after cleaning" soon... But anyway: thanks for making this piece of software. It's really convenient to have all the cleaning facilities (histories, caches, downloads, other apps, trash, ............) in one place! Cheers! Joe D. (architect)
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.