View Single Post
JonWW's Avatar
Posts: 623 | Thanked: 289 times | Joined on Jan 2010 @ UK
#1291
Originally Posted by moudy91 View Post
HI guys i have a question
i have like 10 scripts on my n900 desktop thats mean 10 qbw like bluetooth on and off in one qbw and the other silent profile and general profile , my question is can i combine this 2 commands in one qbw,
1.bluetooth
2. profile
and on my desktop i click 1= bluetooth ( bluetooth on )
and i click 2= profile ( general or silent profile )
PS this scripts in one QBW
thank you
Here you go:

To flip between silent and general profiles use:
Code:
if [ `dbus-send --type=method_call --print-reply --dest=com.nokia.profiled /com/nokia/profiled com.nokia.profiled.get_profile|awk -F "\"" '/g/ {print $2}'` == "general" ];then
  dbus-send --type=method_call --dest=com.nokia.profiled /com/nokia/profiled com.nokia.profiled.set_profile string:"silent"
else
  dbus-send --type=method_call --dest=com.nokia.profiled /com/nokia/profiled com.nokia.profiled.set_profile string:"general"
fi
dbus-send --type=method_call --print-reply --dest=com.nokia.profiled /com/nokia/profiled com.nokia.profiled.get_profile|awk -F "\"" '/g/ {print $2}'|sed 's/^s/S/;s/^g/G/;s/^/Profile: /'
To flip Bluetooth on or off use:
Code:
if [ `dbus-send --system --print-reply --type=method_call --dest=org.bluez $(dbus-send --system --print-reply --dest=org.bluez / org.bluez.Manager.DefaultAdapter | awk -F'"' '/at/ {print $2}') org.bluez.Adapter.GetProperties|sed -n "/Powered/,/boolean/p"|tail -1|awk '{print $3}'` == "true" ];then
  dbus-send --system --type=method_call --dest=org.bluez $(dbus-send --system --print-reply --dest=org.bluez / org.bluez.Manager.DefaultAdapter | awk -F'"' '/at/ {print $2}') org.bluez.Adapter.SetProperty string:Powered variant:boolean:false
else
  dbus-send --system --type=method_call --dest=org.bluez $(dbus-send --system --print-reply --dest=org.bluez / org.bluez.Manager.DefaultAdapter | awk -F'"' '/at/ {print $2}') org.bluez.Adapter.SetProperty string:Powered variant:boolean:true
fi
dbus-send --system --print-reply --type=method_call --dest=org.bluez $(dbus-send --system --print-reply --dest=org.bluez / org.bluez.Manager.DefaultAdapter | awk -F'"' '/at/ {print $2}') org.bluez.Adapter.GetProperties|sed -n '/Powered/,/boolean/p'|tail -1|awk '{print $3}'|sed 's/true/ON/;s/false/OFF/;s/^/Bluetooth: /'
 

The Following User Says Thank You to JonWW For This Useful Post: