Help--Need script to prevent system sleep during Abbyy OCR

Does anybody know of a script or other resource that will prevent the system from going to sleep during batch Abbyy OCR using the Convert to Searchable PDF function?

We’re finding that it saves us time to scan large numbers of business forms with OCR off on one day, OCR them while the computer is not needed, and then label and classify the documents the next day.

So last night I attempted to batch OCR about 30 DTPO documents before leaving our studio. When I got back this morning, half a dozen were completed, but the system was sleeping and the others were not processed.

Advanced Search on this forum revealed that this topic has been partially addressed in a previous discussion:

viewtopic.php?f=29&t=6050&p=27665&hilit=sleep#p27665

Here are a couple of the resources mentioned in that thread:

[i]1. On Leopard, you can execute the following from Terminal to disable the Sleep menu item (and overall system sleep functionality):

CODE: SELECT ALL
sudo pmset -a disablesleep 1

Replace the 1 with 0 to re-enable sleep functionality.

  1. How do I disable Command-Option-Eject (sleep)?

A kiosk developer can disable system sleep using the I/O Kit APIs. This can be done by calling IOCancelPowerChange after receiving a power change notification for system sleep. This technique is illustrated in more detail at: Receiving Notification of Power Events in the I/O Kit documentation. Note this technique does not work in “demand power change” situations such as when the lid of a laptop computer is closed.

developer.apple.com/technotes/tn2002/tn2062.html
[/i]

Thanks in advance for recommendations and suggestions!

I haven’t bothered to write such a script. I just open System Preferences > Energy Saver and set the Sleep slider to Never. Later, I can reset the Sleep slider to its normal setting.

Try Caffeine, a menu-bar app that turns off the screen saver. I use it when I watch movies on Netflix.

http://www.apple.com/downloads/macosx/system_disk_utilities/caffeine.html

Um, maybe I’m dense, but can’t you just set up a “no sleep” corner in the Screensaver preferences and then mouse to that corner? It wouldn’t hurt to try and it’s pretty simple and easy and built into the OS.

Twicks and Bill: Thanks for your replies. Suppose for just a moment that it takes 2 hours to OCR 30 files, and that I leave the studio at 5PM at night and get in at 9 the next morning.

We are running DTPO on a Quad Core 2.66 GHz Mac Pro. After the computer finishes the job, if it doesn’t go to sleep it will idle from 7PM to 9AM (14 hours) before any of us touch it again.

Merely at idle, this computer will burn almost 200 watts of power.

As a business owner trying to control costs, I don’t see why I should have to pay for (and waste) this 200 watts of power for 14 hours every weekday night as a tradeoff for having my Abbyy OCR jobs processed during non-work hours. It’s bad for my expensive Pacific Gas & Electic bill and bad for consumption of natural resources here in California.

In my corner of the world, power consumption of idle electric and electronic devices is a big deal. Some folks around here are buying these new “smart” power outlet strips that shut off even the small amount of electricity consumed by TV sets and other gadgets after they’ve been turned off.

tvillemw: I think your suggestion of Caffeine above is outstanding and I’ve already installed this application. I’ll let you and everybody here on the forum know how it works out for us. Thanks very much for your recommendation!

(For more about the power consumption of the Quad Core 2.66 GHz Mac Pro and similar models see support.apple.com/kb/HT2836.)

Point taken. Unless you could figure out how to use the resulting heat to cook your breakfast and lunch for the next day, it would be inefficient use of energy. :slight_smile:

My little ModBook draws only a fraction of that amount of electricity, especially as the display would go inactive early on, and the hard drive would go to sleep when the OCR processing is done. But it would take longer than your Poser Mac.

I think saving energy is a big deal too.

Christian, Would it be possible to add a property to the Devonthink Applescript dictionary such that one could “get OCR Queue Items”…?

If so, then it would be easy to make an Applescript to put the machine to sleep between the hours of 6pm and 6am if there are no items on the queue.

I would also vote for support of this property for other reasons: I find in DTPro that if I run a script in Script Editor asking it to ocr a series of records, the script will wait until each record is done before iterating through to the next one in the loop. If I run such a script from the dt applescript menu, however, the items are all added to the queue immediately, before the previous one is done, and they pile up. This makes scripting unpredictable.

So it would be great if there was a way to know how many items were in the queue, and just force dt to wait to do each one…and then it wouldn’t be hard to put the machine to sleep when the whole shebang is done…

best,
erico

I have put on my “nice-to-have” list the fact that we could postpone sleep when the queue is not empty.

Annard,

Thanks for the response! Let me say I would prefer an applescript variable above an option request for DT, because I know there’s a lot of feature requests, and that would allow for two different problems to be solved: the sleep problem and the scripting issue I mentioned above.

But let me ask the question this way: is there a file/folder out in the file system whose status would tell us if the queue is running? Because knowing that would allow for an interim solution…

-erico

It may well be easier to implement the sleep feature than to expose internal data structures through AppleScript. And currently there is no reliable way to find out that something is being worked on other than checking that DEVONscribbler is running. If it isn’t running you can be sure that the queue has been empty for a while.