QiD: ActiveSync Toggle, and Bluetooth + profile Toggle - Windows Mobile Development and Hacking General

Quick and dirty;
i hated starting ActSync, -> tools -> Options -> Options -> uncheck 'When craddled' Eneble PC sync '...'
Everytime i had to change is, or Tomtom would not work, and i would see a Qtec trying to sync with my car !
So i made a quick, and not so dirty mortscript/mortrunner batch :
This is for the MDA 2/XDA2/Qtec 2020
Cut here
---8<-------------------------------------------------
Code:
Errorlevel Syntax
If regKeyEqualsDWord HKCU, ControlPanel\Comm, AutoCnct, 5
if question AutoActiveSync is On. Switch Off ?, ActiveSync when cradled
RegWriteDWord HKCU, ControlPanel\Comm, AutoCnct, 0
Else
Exit
Endif
Else
if question AutoActiveSync is Off. Switch On ?, ActiveSync when cradled
RegWriteDWord HKCU, ControlPanel\Comm, AutoCnct, 1
Else
Exit
Endif
---8<-------------------------------------------------
Save as toggleASync.mortrun or toggleASync.mscr and sitck it somewhere on the qtec and create a shortcut to it, install Mortrunner/Mortscript and assign a HW button to the shortcut, or add it to a Today launcher
Did the same for switching BT + profile on off..
Please test, since it don't work on my Qtec, i have BTTools installed
---8<-------------------------------------------------
Code:
Errorlevel Syntax
If regKeyExists HKCU, Software\PBT, PreferredAudioDevice
Message "BTTools is installed, Use it's TodayPlugin instead!", ToggleBT
Exit
Endif
If regKeyEqualsDWord HKCU, Software\Microsoft\Bluetooth\Settings, ScanMode, 1
if question Bluetooth is On. Switch Off ?, ToggleBT
RegWriteDWord HKCU, Software\Microsoft\Bluetooth\Settings, ScanMode, 0
RegWriteDWord HKCU, Software\HTC\BTProfile, On, 0
Else
Exit
Endif
Else
if question Bluetooth is Off. Switch On ?, ToggleBT
RegWriteDWord HKCU, Software\Microsoft\Bluetooth\Settings, ScanMode, 5
RegWriteDWord HKCU, Software\HTC\BTProfile, On, 1
Else
Exit
Endif
exit
---8<-------------------------------------------------
Save as ToggleBT.mscr or .mortrunner etc....

Related

can ya change sound of Wizard only during certain programs

Hay guys and gals...
I have a question, regarding the PDA sound of the Wizard(so not the phone sound) it's the left bar on your volume shortcut...
I imagine this is a question which is on a lot of TomTom 6 users by now...
Is there a way, to increase this sound automatically only when a certain program is active, and to decrease it to standard when the program is terminated?
Tomtom 5.21 used to take over this slider, and the sound would be loud enough...after tt5.21 terminated, it would return to it's original value.
Now in TT6, the sound is related to the pda sound bar....so it's either turn up your PDA volume for all time(which I don't want to do, because all the sounds are so loud then...) or choose to not hear the voices of TomTom6 when you drive, even with the TomTom volume turned to 100%...
Hope someone has the solution for me...pretty please
Greetings!!!
maybe Mortscript???HELP PLEASE!!!
maybe Mortscript can do this for me?
But unfotunately I have no idea what strings I should use..
Could someone help me create a .mscr file to launch TOMTOM with max volume and to restore volume te previous, or set value after TOMTOM exit?
Prettyplease with cherry's on top???
got going...
Okay..
I got this far with mortscript:
run (aplication)
setvolume 255
This string turns up the volume all the way when you run the app.
Now only, I want it to go back to a preset value when I exit the program..
I tried:
Run (application)
While procexists (aplication.exe)
Setvolume 255
endwhile
Setvolume 70
But this imediately sets the volume to value 70...
even tried it with sleep 10000 between the run and the while, to make sure the app was running, no luck
Anyone gotten an idea???
No idea??
Is there no one with an idea on this???
Turning volume up is no problem, turnig it down again after closing app is what I can't seem to manage....
Maybe there's a program which does this???
:?: :roll: :?:
ANYONE????
Got the answer from Mort himself::::
Here's the solution...worked for me!!
Needs mortscript and a text editor(notepad)
My question to him on his support forum:
Haia...
I'm looking for a way to turn up the PDA volume during a program, and turn it down after the program terminates...
I tries to do this with Mortscript, using
run (aplication)
while (aplication)
setvolume 255
endwhile
setvolume 80
Even tried it with a sleep before the while...to ensure the app is up and running
This script however doesn't turn the volume up, but goes directly to volume 80...
The ap is Tomtom 6...the volume is now coupled on your PDA volume, so I have either very loud PDA sounds, or a very silent TomTom voice...this bugs me...
Is there a way to turn up the volume during the aplication, and turn it down again automatically after app exits.
Turning the volume up before the app starts is of course no problem using mortscript....but the turning it down after app ends is what's keeping me awake at night...
Hope someone has the answer....
Thu Sep 07, 2006 9:32 am
Morts reply:
Probably the window name in "While wndExists ..." is wrong. Try to get it with GetActiveWindow and Message, and be sure to use correct upper/lower case (i.e. "Tomtom" won't find "TomTom"!).
Another way might be to use RunWait, i.e.
SetVolume 255
RunWait \...\tomtom.exe
SetVolume 80
This wouldn't reset the volume all the time, but also won't require as much CPU time. If you prefer the while loop (or RunWait doesn't work with TomTom), you should add a Sleep in the loop, so the check and volume change doesn't happen all the time. Sleep is far more CPU friendly.
Tutorial....
Okay, here goes....
Firstly download and install Mortscript, to be found at:
http://www.sto-helit.de/modules/edito/content.php?id=38
Then put the file attached to this post on your device..
Very important :!: :!: to change the extension of the file from .txt to .mscr :!: :!:
For some reason .mscr extensions are not allowed on this forum.
You can put the file anywhere you like...
Then click it to make TomTom run, The script will be executed and TomTom will start automatically..
If you find the sound too loud, take a text editor, open the file and change the value at Setvolume 255 to something less...
Same with the return sound..If you find that to much or to less, change the value at Setvolume 90...
You just have to tweak those two to your own desired volumes.
For people with devices in different languages, you should open the file with a text editor and change the value of \Program Files\Navigator\ to the value where you've gotten TomTom installed...
Good luck!!!
Works great, thanks!!
Now I have just put this script file in my "\Windows\Start Menu" folder and use this to launch TT6.
Fantastic.
BTW, 60 is the first "notch" of volume, which is where I normally have my phone.
Can anyone test the backlight function? I want to see if i can solve the iguidance problem of the battery light going off. this is what i have sucessfully working:
SetBacklight External 100, Battery 100
just found out about mortscript recently. very nice. found this thread doing some searches for solutions to my ttn6 problems. here's the script i use which gets the current volume first before setting to max.
# ace_ttn_start.mscr
# launch tomtom and keep active, set volume to max
# initialize values
ErrorLevel("syntax")
ttn_exe = "\Program Files\Navigator\TomTom Navigator.exe"
ttn_ttl = "TomTom Navigator"
intrval = 2000
# turn off connection established notification
mem_conn = RegRead("HKCU","ControlPanel\Notifications\{8ddf46e7-56ed-4750-9e58-afc6ce486d03}","options")
RegWriteDWord("HKCU","ControlPanel\Notifications\{8ddf46e7-56ed-4750-9e58-afc6ce486d03}","options",0)
# adjust volume
mem_vol = RegRead("HKCU","ControlPanel\Volume","Volume") * 255 / 4294967295
SetVolume(255)
# launch tomtom
Run(ttn_exe)
WaitFor(ttn_ttl, 30)
# keep tomtom active
While(WndExists(ttn_ttl))
If (NOT WndActive(ttn_ttl))
Show(ttn_ttl)
EndIf
Sleep(intrval)
EndWhile
# replace changed values
RegWriteDWord("HKCU","ControlPanel\Notifications\{8ddf46e7-56ed-4750-9e58-afc6ce486d03}","options",mem_conn)
SetVolume(mem_vol)
Click to expand...
Click to collapse

BT Sound mortscript - tweak?

I'm no programmer, I thought I'd attempt to tweak it to be a toggle switch but just don't know enough even after reviewing the manual.
What I'd like to see is instead of a Yes No, a toggle - IF it is set to VC then switch to Audio, IF not, then switch to VC.
That way I can either assign it (hopefully) to a button or a faster key sequence.
I know there is also another Mortbutton, but haven't looked into it yet to see if I could perhaps assign it to the PTT press & hold.
if your talking about the basic BTsound script i posted here
http://forum.xda-developers.com/showthread.php?t=278778&page=4
then this might work, i havent tested it though.
edit: tested it and it works fine.
Code:
#basic mortscript to Toggle BT Mono Sound
LaunchApEnable = RegRead ("HKLM","Software\OEM\VoiceCommand","LaunchApEnable")
if (LaunchApEnable=1)
RegWriteDword ("HKLM","Software\OEM\VoiceCommand","LaunchApEnable",0)
RegWriteDword ("HKLM","Software\OEM\VoiceCommand","VoiceCmdDuration",86400)
else
RegWriteDword ("HKLM","Software\OEM\VoiceCommand","LaunchApEnable",1)
RegWriteDword ("HKLM","Software\OEM\VoiceCommand","VoiceCmdDuration",30)
endif
That's cool, could you add a statement that would briefly show the status with each push like "Bluetooth is now Re-Directed" and "Bluetooth is now Normal".
I'm currently using AE Button to map a key to toggle Bluetooth and WiFi on and off this way. They show a balloon with status for a few seconds. Works great for those times when Bluetooth mysteriously turns off when plugging in the charger occasionally.
Having something like that to re-direct the bluetooth really would be nice.
how about this one.
not sure how to get rid of the count down though,
i can make it just kill the window in the above script but i think this method is cleaner
Code:
#basic mortscript to Toggle BT Mono Sound
LaunchApEnable = RegRead ("HKLM","Software\OEM\VoiceCommand","LaunchApEnable")
if (LaunchApEnable=1)
RegWriteDword ("HKLM","Software\OEM\VoiceCommand","LaunchApEnable",0)
RegWriteDword ("HKLM","Software\OEM\VoiceCommand","VoiceCmdDuration",86400)
#you can change the number after sleepmessage for how long you want it to show
#you can change the text"bluetooth is now..." to anything you want.
sleepmessage 2,Bluetooth is now Re-Directed, BTAudio
else
RegWriteDword ("HKLM","Software\OEM\VoiceCommand","LaunchApEnable",1)
RegWriteDword ("HKLM","Software\OEM\VoiceCommand","VoiceCmdDuration",30)
sleepmessage 2,Bluetooth is now Normal, BTAudio
endif

Turning BT off/on w/ mortscript

I am trying to create a script that checks the BT state and then turn on/keeps on the BT then start a program (landscaper-->google maps) and then when the program terminates it returns the BT state that it was before starting the script...
the programs are
Program Files\BlindLemon\BTToggle.exe
Program Files\Landscaper.exe or \Windows\Start Menu\Programs\Landscaper.exe
Program Files\Googlemaps\googlemaps.exe
I have part of the script but I need the BT part. Here is what I have
Rotate(90)
Run( "\Window\Start Menu\Programs\Landscaper.exe" )
WaitForActive( "Landscaper", 05 )
SendDown ( "Landscaper" )
Runwait( "\Program Files\GoogleMaps\GoogleMaps.exe" )
Close( "Landscaper" )
Rotate(0)
And This portion Works fine.. just looking for the BT component
If anyone has experience with this or has a similar script let me know
Thanks..
__________________
You couldn't fool your mother on the foolingest day of your life even if you had an electrified fooling machine!
I saw him once. Sure I'm blind in one eye, and my other eye was infected that day from picking at it, and I was tired, and I'd been swimming in a pool with too much chlorine, and that was the hour my glasses were at Lenscrafters but I seen that fish!
bluetooth toggle
i just found this little app that toggles BT state when called. i mapped it to an icon in my program launcher/today screen to toggle BT on and off with the push of a button. I believe I found it on the forums here, but can't remember - it was late. Hope this helps.
Thanks, but I already have a BT Toggler app, (BlindLemon\BTToggle.exe) What I need to know is how to read the BT status, and then either turn the BT on or execute the program.
I need to know how to have Mortscript read the BT status also I cannot figure out the if/then part
Figured It out...
This script is for
1. Check the BT state and turn on if off (using a simple BT toggler program located HERE....and turn off when program is exited
2. Rotating the screen to 90º (So Keyboard will be Functional)
3. Keeping the screen rotated at 90º even if switched to portrait (this is achived with the program called Landscaper)
4. Running Google Maps
5. Returning everything (BT Status/Rotation) to state prior to executing the script
Of course you can change any of the programs to suite your needs..
Here is the Script I used
B = RegRead ("HKLM", "Software\oem\bluetooth\" , "BTcomstatus" )
If ( B = 0 )
Run( "\Program Files\BlindLemon\BTToggle.exe" )
Rotate(90)
Run( "\windows\Start Menu\programs\Landscaper.exe" )
WaitForActive( "Landscaper", 05 )
SendDown ( "Landscaper" )
Runwait( "\Program Files\GoogleMaps\GoogleMaps.exe" )
Close( "Landscaper" )
Run( "\Program Files\BlindLemon\BTToggle.exe" )
Rotate(0)
Else
If ( B = 1 )
Rotate(90)
Run( "\windows\Start Menu\programs\Landscaper.exe" )
WaitForActive( "Landscaper", 05 )
SendDown ( "Landscaper" )
Runwait( "\Program Files\GoogleMaps\GoogleMaps.exe" )
Close( "Landscaper" )
Rotate(0)
Here is the BT monitoring part
0 is BT off
1 is BT on
B = RegRead ("HKLM", "Software\oem\bluetooth\" , "BTcomstatus" )
If ( B = 0 )
run( "Prorgam path for BT toggler such as BlindLemon's BTTolgger" )
runwait( "Insert your program path here" )
run( "Prorgam path for BT toggler such as BlindLemon's BTTolgger" )
Else
If ( B = 1 )
run( "Insert your program path here" )

TreoVibe Mortscript - vibration during call

Hi All,
I have installed treovibe mortscript from http://discussion.treocentral.com/wm-developers-mortscript/138234-mortscript-treovibe-2.html
to change continuous vibration to something cool
It works for me OK, but i have one problem with that script:
i have very annoying vibration during call (when an SMS arrives or I have another incoming call or any other notification)
treovibe use something like this to enable vibration:
x = RegRead( "HKLM", "System\State\Phone", "Status" )
If (x AND 65536)
If ((VibrateStyle=1) or (VibrateStyle=2) or (VibrateStyle=3))
Vibrate(VibrateShort)
Else
Vibrate(VibrateLong)
EndIf
EndIf
Sleep(100)
I thought that if it can read another regkey which will inform the script if there is an active call it can turn off vibration.
Could someone help me with that?
This should go into Q&A section btw
The Reg key you are looking for is
HKLM\System\State\Phone\active call count
if this reg key exists there is an active call
thanks for info about reg key..
Now i would be very grateful if somebody help with modifying this treovibe script..

kill and start processus when screen off

Hi,
Already , sorry for my english
I would like to make a script which kills a process when the screen is off and start process when screen is on , If possible with mortscript.
With windows mobile 6.5
I looked everywhere, I did not find
Thx very very very much
Yannis
Try this:
ProcessToKill="XYZ.exe"
While(ProcExists("device.exe"))
If(0=RegRead("HKLM","System\CurrentControlSet\Control\Power\State\BackLightOff","bkl1:"))
#
#backlight is off
If(ProcExists(ProcessToKill))
Kill(ProcessToKill)
EndIf
Else
#
#backlight is on
If(NOT ProcExists(ProcessToKill))
Run(ProcessToKill)
EndIf
EndIf
#
#yield
Sleep 1000
EndWhile
Try this:
ProcessToKill="XYZ.exe"
While(ProcExists("device.exe"))
If(0=RegRead("HKLM","System\CurrentControlSet\Control\Power\State\BackLightOff","bkl1:"))
#
#backlight is off
If(ProcExists(ProcessToKill))
Kill(ProcessToKill)
EndIf
Else
#
#backlight is on
If(NOT ProcExists(ProcessToKill))
Run(ProcessToKill)
EndIf
EndIf
#
#yield
Sleep 1000
EndWhile

Categories

Resources