PDA

View Full Version : AppleScript and C-shell Script




youmacsoiammac
Apr 15, 2004, 06:33 PM
Hi all

First of all, I am new to mac, still haven't received my ibook G4, don't know what happen to all the UK suppliers, no stores are in stock.

Seconally, just wondering how much different between AppleScript and C-shell Script? Is it similiar to C-shell on Sun's CDE(Common Desktop Environment)?

Anyway, that's all the question for now, may have somemore once I recived my mac.

Xu



bousozoku
Apr 15, 2004, 07:29 PM
AppleScript is about as far from csh script as Pascal is from C, as you can see from these examples.

This one uses the Internet Connect application to dial out:


tell application "Internet Connect"
activate
connect
quit
end tell



This one uses System functionality to do its work:


repeat with volumeLevel from 7 to 0 by -1
set volume volumeLevel
end repeat
repeat with volumeLevel from 0 to 7 by 1
set volume volumeLevel
end repeat



These execute UNIX commands, one visibly and the other invisibly:


tell application "Terminal"
activate
do script "cd fahproc1; ./fah.sh"
do script "cd fahproc2; ./fah.sh"
end tell




do shell script "drutil tray eject"

youmacsoiammac
Apr 15, 2004, 07:32 PM
Thanks man.