I have written a little mortscript, which checks if bluetooth is connected to my carkit. If it is, the script starts the app BTRestore. When i leave my car, the scripts kills BTRestore.
How to install
1. Install Mortscript on your device
2. Install BTRestore on your device. For more information about the app see site (it's in dutch)
3. start notepad on your pc and copy/paste script below in notepad
4. save the script to a file with extension mscr, for example handsfree.mscr
5. place the file on your device in folder "windows\Startup"
6. Restart the device or executed the script manually by selecting the file.
By placing the script in folder "windows\Startup" the script is executed automatically when you start your device.
The script checks the status every 10 seconds. You can change timeout by changing parameter 'Sleepfor'. Each time the app BTRestore is started or killed the device vibrates. If you don't want that, change the parameter 'EnableVibrate' to value '0'
#initialize script SleepFor = 10000 EnableBTRestore = 0 BTProcessFull = "Program Files\BTRestore\BTRestore.exe" BTProcess = "BTRestore.exe" EnableVibrate = 1 VibrateFor = 250 While (1) BluetoothState = RegRead("HKLM", "System\State\Hardware", "Bluetooth") if (BluetoothState <= 8) #Bluetooth off. kill BTRestore EnableBTRestore = 0 Call ("BTRestore") else #bluetooth is switched on. Check if Handsfree is enabled HandsfreeState = RegRead("HKLM", "System\State\Hardware", "Handsfree") if (HandsfreeState = 1) #Phone is connected to handsfree device. Activate BTRestore EnableBTRestore = 1 Call ("BTRestore") else #Phone is not connected to handsfree device. So kill BTRestore EnableBTRestore = 0 Call ("BTRestore") endif endif Sleep(SleepFor) EndWhile Sub BTRestore Running = ProcExists(BTProcess) if (EnableBTRestore = 1) #check if BTRestore already is running if (Running = TRUE) #BTRestore already running else #execute BTRestore run (BTProcessFull) if (EnableVibrate = 1) Vibrate(VibrateFor) endif endif else #check if BTRestore is running if (running = TRUE) #Kill BTRestore kill ("BTRestore.exe") if (EnableVibrate = 1) Vibrate(VibrateFor) endif else #BTRestore not running. Do nothing endif endif EndSub