On Thu, Mar 22, 2007 at 05:55:18PM -0400, Sherm Pendley wrote: > On Mar 22, 2007, at 1:01 PM, Andrew Brosnan wrote: > >I'd like to run a daily backup script on my laptop, but I'd like it to > >ask permission first. I'm wondering what is the best way to do this. > First off - can you always depend on a user being logged in? If so, > the simplest ideas tend to be the best. For a full-blown GUI app I'd > use CamelBones, but for a simple OK/Cancel dialog the old MacPerl > module is still the easiest: > > #!/usr/bin/perl > use MacPerl; > my $verify = MacPerl::Answer('Do you want to run backups?', 'OK', > 'Cancel'); > print $verify, "\n";
Consider what happens if I'm busily typing away, and the dialogue box pops up and grabs focus, and then whatever its default is gets selected because i hit space or enter. So not only have you annoyed me by popping something up and then removing it before I get a chance to read it, you'll now take an action without the user knowing about it but on the assumption that he does, *and* you've eaten an arbitrary amount of what I typed, which I'll have to type again. Needless to say, this is a Very Bad Idea. -- David Cantrell | Nth greatest programmer in the world It's my experience that neither users nor customers can articulate what it is they want, nor can they evaluate it when they see it -- Alan Cooper