Thanks for the explanation, I can't remember all I tried back then, but it seems like I missed trying it like this!
Since the part for Wifi and launching/quitting applications with it is working fine now, is there any chance you could help me with creating a script for doing the same for bluetooth? It doesn't seem to work with just changing the network card in the lines from wifi and the script I found on the internet is rather.. inefficient (slow, and uses quite some code). So, the only reason I'm using this, is because I couldn't make it work otherwise and also couldn't find any better hints anywhere. Again, I don't remember where I found this code. Just some copy&paste work I did a while ago.
The script I'm currently using (python):
import sys, objc
from CoreFoundation import *
IOBT_BRIDGESUPPORT = '''<?xml version="1.0" standalone="yes"?>
<!DOCTYPE signatures SYSTEM "file://localhost/System/Library/DTDs/BridgeSupport.dtd">
# int s : 0 = off, 1 = on
s1 = -1
for i in range(50):
s1 = get_ioblpstate()
if s1 == s:
if s1 != s:
sys.stderr.write('Unable to set bluetooth power state to %s\n' % ('off' if s == 0 else 'on').encode('utf-8'))
print '%d' % set_ioblpstate(1 if get_ioblpstate() == 0 else 0)