Is it possible to execute unix commands in dashcode?
By smg58 at Fri, Feb 15 2008 3:33pm |
Hi, I'm new to the site here. I've just started playing around with dashcode, and I was wondering if it is possible to create a widget where I could execute a UNIX command with the touch of a button. (I'm a scientist who does a lot of number-crunching with fortran but has never built a website, so HTML and javascript are totally new beasts to me.)
Thanks for your help!



Yes, that's possible. Use
Yes, that's possible. Use "widget.system()" to do that, documented here:
Apple Dashboard Documentation
Edit: put link into an A-tag
Thanks! Scott
Thanks!
Scott
Unix commands in dashcode
For completeness, here is an example that I used in a widget called 'Desktop Dustup' to find old files and move them to the trash:
var findCommand = "/usr/bin/find ~/Desktop -fstype local -maxdepth 1 -ctime +" + numberOfDaysFilesKept + " -exec mv -- {} ~/.Trash \\; >/dev/null 2>&1"; widget.system(findCommand, null);Drew
---------------------------
Drew McCormack
http://www.maccoremac.com
http://www.macanics.net
http://www.macresearch.org