Wrote this up to open ports in sharing preferences used bit torrent as an example.
this is my first useful applescript. ill put promps in later
(*
By BigKM
this script creates a new firewall rule
*)
set startport to "6880"
set endport to "6899"
set Nameports to "Bit Torrent"
--Should only need to edit the above code
tell application "System Preferences"
activate
end tell
delay 2
tell application "System Events"
tell process "System Preferences"
set frontmost to true
click menu item "Sharing" of menu "View" of menu bar 1
delay 2
tell window "Sharing"
click radio button 2 of tab group 1
click button "New..." of tab group 1
tell sheet 1
tell pop up button 1
click
tell menu 1
click menu item "Other"
end tell
end tell
delay 1
set value of text field 1 to startport & "-" & endport
try
keystroke tab & Nameports
end try
click button "OK"
end tell
end tell
end tell
end tell
tell application "System Preferences"
quit
end tell
display dialog "Successfully opened ports
" & startport & "-" & endport & "
For " & Nameports default button 1 buttons {"OK"}