Prevent sleep in Mac OSX 10.8 when Igor is crunching data
nate_church
I realize that there are work-arounds from disabling sleep entirely in System Preferences to installing other programs and scripts, but it would be nice to be able to leave a large problem running overnight or longer and let the system power down when it's done. I realize that it's a case of Apple moving the goalposts (again?) which I imagine does little to engender affection in developers, but if the solution is not serious, it would be a great functionality to get back. Thanks!
caffeinate /Applications/Igor\ Pro\ 6.2\ Folder/Igor\ Pro.app/Contents/MacOS/Igor\ Pro
You can create a small shell script with this for easier access, or use Automator and its "Run Shell Script" action to create a small launcher that will do this.
You could also set up an Igor hook that runs the Igor "ExecuteScriptText" command at launch, and then have this command run a "do shell script" routine that will invoke the "pmset noidle" Terminal command, which will prevent sleep. I'm not sure if this will persist throughout the Igor session, but you could also set up Igor to invoke this command during function execution to prevent sleep only when the function is running.
Here are some such functions, from the Igor help:
The function to execute the shell script...
String uCommand // Unix command to execute
Variable printCommandInHistory
Variable printResultInHistory
if (printCommandInHistory)
printf "Unix command: %s\r", uCommand
endif
String cmd
sprintf cmd, "do shell script \"%s\"", uCommand
ExecuteScriptText cmd
if (printResultInHistory)
Print S_value
endif
return S_value
End
Running the command...
The Igor hook...
String igorApplicationNameStr
ExecuteUnixShellCommand("pmset noidle",1,1)
end
...I'm not guaranteeing this will work, but it or a similar approach should invoke an assertion to the system.
January 20, 2013 at 04:51 pm - Permalink
January 21, 2013 at 12:09 am - Permalink
January 21, 2013 at 08:03 am - Permalink
The use of this command is still doable, but you would need to call it within each function and then issue the "killall pmset" command to clear the locks at the end of the function.
Anyway...its an explorable option.
January 21, 2013 at 09:55 am - Permalink
January 21, 2013 at 10:08 am - Permalink