View Single Post
  #1 (permalink)  
Old 01-28-2010, 01:39 AM
mswlogo's Avatar
mswlogo
VIP Member
Offline
Location: MA, USA
 
Join Date: Jun 2007
Posts: 1,330
Reputation: 970
mswlogo knows their stuffmswlogo knows their stuffmswlogo knows their stuffmswlogo knows their stuffmswlogo knows their stuffmswlogo knows their stuffmswlogo knows their stuffmswlogo knows their stuff
Mentioned: 0 Post(s)
Tagged: 0 Thread(s)
iGuidance MortScript to get around TTS not always working

In the spirit of the script written for iGo8 in the thread http://forum.ppcgeeks.com/showthread.php?t=88692

I've written a script to shutdown Sense UI, ActiveSync, HTCMessaging and start GPSGate and iGuidance and automatically restart Sense UI when you exit iGuidance.

The Script is below but is also attached.

Just copy the script to \Windows\Start Menu\Programs and then you and add a short cut to it from where ever you want.

One click and you are up and running.

EDIT 1: If you have VoiceCommand enabled you need to do the "Voice Command" notifications dance to get it out of the way from blocking TTS too. Switch back and forth between Notifications on Handset and Headset (with reboots in between. It does not seem to matter which you leave it on but toggling this and rebooting a few times seems to fix something that blocks TTS in navigation.

EDIT 2: I attaced a new version that does not use KILL which is bad.

EDIT 3: Acid test for TTS. Reboot, Send Text Message to yourself and wait for it. Open it an Click all Messages. Open Email and Click All Messages. Make Bluetooth call with Voice Command. Now try to run your Nav with TTS. With this script it will work as far as I can tell. Without loosing Voice Command.

EDIT 4: New V3 Script now restarts Voice Command too.

EDIT 5: Uploaded V4. Finally got around to adding timeouts. Also added opera 10.

EDIT 6: Uploaded V5. Fixed issue where backup Kill Command could be issued too soon and not always free resources. Thanks to nayr1482 for finding this.

EDIT 7: Uploaded V6. Just a very minor tweak that would only speed things up if you got a timeout error.

EDIT 8: Uploaded V7. I blundered a copy paste error and it would not wait for manila to shutdown before proceeding. Thanks again to nayr1482 for his persistence in debugging what the script does.

EDIT 9: Uploaded V8. I must of been drunk when doing V4. Found another error, Opera 10 was not being shutdown by it's window which could leave resources unreleased. Also noticed with the fix in V7 that manila did take longer than timeout value (5 seconds) on occasion so I bumped it up to 10 seconds.

The inline text below is V8

# Shutdown Manila
RegWriteDword("HKLM","Software\Microsoft\Today\Ite ms\HTC Sense","Enabled",0)
RedrawToday
Call( "WaitProcessDieWithTimeOut", "manila.exe", 20, 500 )

# In case we reboot or hang turn set Manila to start now before going further
RegWriteDword("HKLM","Software\Microsoft\Today\Ite ms\HTC Sense","Enabled",1)

# Remove warnings on unfound windows
ErrorLevel("syntax")

# Shutdown a bunch of trouble makers for TTS
Call( "GentleKill", "ActiveSync", "Repllog.exe", 10, 500 )
Call( "GentleKill", "Opera Mobile 10", "Opera10-armv4i.exe", 10, 500 )
Call( "GentleKill", "Contacts", "poutlook.exe", 10, 500 )
Call( "GentleKill", "Outlook E-mail", , 10, 500 )
Call( "GentleKill", "Messaging", "tmail.exe", 10, 500 )
Call( "GentleKill", "HTC Messages", "Messaging_Client.exe", 10, 500 )

# Restart Voice Command (if you want to leave VoiceCmd off just comment out Run) Restart seems to work
If ( ProcExists("voicecmd.exe") )
Call( "GentleKill", , "voicecmd.exe", 10, 500 )
Run("\Windows\StartUp\Voice Command.lnk")
EndIf

# If GpsGate installed prep it
If (FileExists ( "\Program Files\GpsGate 2.0\GPSGateCE.EXE" ) )
# If GPSGate isn't running clear Running flag (so it won't prompt) to start then start it
If (not ProcExists("GPSGateCE.EXE"))
RegWriteDword("HKCU","Software\Franson\GpsGate","R unning",0)
Run("\Program Files\GpsGate 2.0\GPSGateCE.EXE")
EndIf
EndIf

RunWait("\Program Files\iNav\iGuidance\iGuidance.exe")

# Loop until iGuidance Exits on it's own
While ( ProcExists("iGuidanceVGA.exe") )
Sleep(500)
# Igo8 may need this, not required for iGuidance (I uncheck "Dim Backlight While on Extrenal Power")
# IdleTimerReset
EndWhile

# Gracefully close GPSGate (no need to wait)
Close("Franson GpsGate")

# We already preped to restart manila just trigger it now.
RedrawToday

Sub GentleKill

Local( wname )
Local( pname )
Local( loops )
Local( delay )

wname = argv[1]
pname = argv[2]
loops = argv[3]
delay = argv[4]

if (Not IsEmpty( wname ) )
While ( WndExists( wname ) AND (loops > 0) )
Close( wname )
If ( WndExists( wname ) )
Sleep( delay )
EndIf
loops = loops - 1
EndWhile
If (loops = 0)
Message( "Warning: Timeout Waiting for Window to Close " & wname )
ElseIf (Not IsEmpty( pname ) )
If ( ProcExists( pname ) )
Call ( "WaitProcessDieWithTimeOut", pname, loops, delay )
EndIf
EndIf
EndIf

IdleTimerReset

loops = argv[3]

If (Not IsEmpty( pname ) )
If ( ProcExists( pname ) )
Kill(pname)
Call ( "WaitProcessDieWithTimeOut", pname, loops, delay )
EndIf
EndIf

EndSub

Sub WaitProcessDieWithTimeOut

Local( pname )
Local( loops )
Local( delay )

pname = argv[1]
loops = argv[2]
delay = argv[3]

if (Not IsEmpty( pname ) )
If ( ProcExists( pname ) )
While ( ProcExists( pname ) AND ( loops > 0 ) )
If ( ProcExists( pname ) )
Sleep( delay )
EndIf
loops = loops - 1
EndWhile
If (loops = 0)
Message( "Warning: Timeout Waiting for Process to Die " & pname )
EndIf
EndIf
EndIf

IdleTimerReset

EndSub
__________________
EVO 4G, Stock Sprint ROM, ProClip in Car, Sony HBH-300.

Last edited by mswlogo; 02-09-2010 at 08:22 PM.
Reply With Quote
This post has been thanked 3 times.