Applescript automatisation

Discussion in 'Mac Programming' started by xieem, Dec 15, 2016.

  1. xieem macrumors member

    Joined:
    Oct 7, 2014
    #1
    Hi,

    I was wondering if it would be possible to run an Applescript that would create a new folder every time there is a new month? This would be useful for accountancy purposes that it would also check certain file types for a date and put that file automatically in that folder.

    Not sure if that would be doable but if yes any idea how to start?
     
  2. superscape macrumors 6502a

    superscape

    Joined:
    Feb 12, 2008
    Location:
    East Riding of Yorkshire, UK
    #2
    It's most certainly possible. You could do it in AppleScript. Personally, I'd probably do it with a shell script. For example the following makes a folder on your desktop named with the current year and month:

    Code:
    mkdir -p "~/Desktop/$(date +%Y-%m)"
    (copy and paste it into Terminal, found in your Utilities folder).

    From then on, its just a question of scheduling the command to run at a specific time. You could use Automator to create a calendar alarm to schedule the script. Automator has a "Run Shell Script" tool. There are more elegant ways, but that's probably the easiest method.

    Hope that's of some help!
     

Share This Page