Help wrighting a simple AppleScript

Essage

Member
I need help to wright a simple AppleScript.

Here´s what it should do:
open Terminal
write "sudo ipfw add deny udp from any to any 0000"
press enter
write "password"
press enter
quit Terminal

Can someone please help me with that?

//Essage
 
better to do this with a shell script.

I am not that into shell scripting, nor do I sit in front of my OS X right now, but maybe I can look into it when I get home.
 
Ok, so if anyone knows how to write a shell script that does the same, please do an post it.

How do you trigger a shell script? Can it automaticly be run at startup? That would be really nice :cool:
 
I believe you can just put this in a text file here. Put it in your /Library/StartupItems folder and it'll launch when you reboot everytime. If StartupItems isn't there just make a folder called StartupItems and it should work.

Code:
#!/bin/sh

. /etc/rc.common

CheckForNetwork

if [ "${NETWORKUP:=-NO-}" = "-YES-" ]; then

sudo ipfw add deny udp from any to any 0000

fi
 
You can make the shell script executable and use cron to run it whenever you would like.
I don't know alot about cron, but you could do a 'man crom' from the terminal to get more info. I know you would have to edit your/etc/crontab file to get this to work. This way you could keep the file wherever you wish and then point to its correct location in the crontab.

Let me know if this works or not, and if it does, how you got it to work.

Good Luck,:)

SA
 
After you write the shell script, maybe you could write an Applescript to execute the shell script. Something like:
Open terminal
run "shellscript"

How does this sound? Let me know if and how it works.

Good Luck,:)
SA
 
Back
Top