I’m going to be out of the office for a week. Including the two weekends, that means 9 days, and the App Store daily reports are only maintained for 7 days so that would mean losing 2 days of data in AppViz, the amazing tool from IdeaSwarm that I use to keep track of sales and reviews etc. What to do?
Well, three options came to mind:
- Accept the loss of data (AppViz will fill in the missing information to some extent from the weekly reports, so it is only really a loss of resolution);
- Take a laptop, find an internet connection on my trip and download the data files to there (AppViz can read the downloaded files);
- Find a way to schedule the AppViz to download the data on its own while I’m away.
The first two options didn’t appeal much, so I asked on Twitter if anybody had any ideas for scheduling AppViz. And two people responded with the information I needed (thanks @jonathanbenari and @graiz). So, without further ado, here’s what I did:
Recording an Automater Workflow
- Enable access for assistive devices in System Preferences -> Universal Access so that Automater can record your actions;
- Launch Automater;
- Launch AppViz, if it isn’t already running;
- Hit the Automater record button;
- Bring AppViz to the front;
- Choose the Data -> Import from web menu option, and let it complete that;
- Stop recording in Automater;
- Save your new workflow as an Application (make sure you choose Application and not Workflow for the type);
Scheduling the Download
We’re going to schedule the saved workflow to run every morning at 6:31am (we’ll see why it is 6:31am in the next section). So, here’s what we need to do:
- Launch iCal;
- Add a new event at 6:31am (or whatever time you want to schedule the download for);
- Set the entry to repeat to every day;
- In the Alarm section, choose Open File;
- In the line that appeared below Open File (and says iCal), click and choose Other. You will be asked to pick the file here, so pick the Application format file you saved in Automater earlier;
- Set the time before the event to be 0 minutes;
- Click Done to schedule the event;
And that’s it scheduled. If you leave your computer on all the time, you’re done at this point. If however, you’re being nice to the environment and you put your computer to sleep (or have it set to sleep automatically), iCal won’t be able to run your script since the computer will be asleep. Let’s fix that next…
Wake From Sleep
Re-open the system preferences and choose the Energy Saver option. In there you will notice a button labeled Schedule… – press it and you will be able to choose a time for your computer to wake up, and a time for it to go to sleep. I chose to have it wake up 6:30am and go back to sleep at 6:45am (15 minutes ought to be long enough for AppViz to download any new reports). This also explains the 6:31am time on the iCal alarm – 1 minute after the machine is woken from its sleep by the energy saver!
And that’s it. Now my machine will wake up, download the daily reports from Apple, and go back to sleep all on its own, leaving me free to enjoy my vacation without having to find an internet connection to download the data files.