AppleScript to clear java temp internet files.

Discussion in 'Mac Programming' started by Smbryant20, Sep 23, 2017.

  1. Smbryant20 macrumors newbie

    Joined:
    Sep 23, 2017
    #1
    I am trying to build an AppleScript to open system preferences, click on the Java icon at the bottom. I am good up to this point. Then the Java Control Panel Panel opens up. This is where I need help to click “settings...” for temperary internet files, choose “delete files...”, check the third check box for “installed application and applets” and thick clicking ok to close that window and then ok to close temp files settings window,and then ok to close the Java Control Panel.

    I know that’s a lot of step but any way to get this done or another way to complete it would be a great big help!

    Thanks.
     
  2. superscape macrumors 6502a

    superscape

    Joined:
    Feb 12, 2008
    Location:
    East Riding of Yorkshire, UK
    #2
    Hi,

    I'm no expert on Java, I'm afraid, so I don't know exactly *what* clicking on the "delete files..." button you mention actually deletes.

    However, having said that, it's usually best to keep UI scripting as an absolute last resort. In my experience, it's hard work to script and the results are usually flakey and unreliable. If you can figure out which files/folders it's clearing out then you're probably better off scripting the Finder using it's scripting dictionary to do the deletion.

    Maybe there's more to it than I understand, given my unfamiliarity with Java. If so then my apologies!
     
  3. kryten2 macrumors 6502a

    Joined:
    Mar 17, 2012
    Location:
    Belgium
    #3
  4. superscape macrumors 6502a

    superscape

    Joined:
    Feb 12, 2008
    Location:
    East Riding of Yorkshire, UK
    #4
    Bingo! :)

    So, all you'd need to do is delete the files in that folder with an AppleScript or shell script. The latter would probably be my personal choice. Much easier and more reliable than UI scripting.
     

Share This Page

3 September 23, 2017