[Test] Need some registry values - Windows 10 Mobile

Hi! I wanna run some tests and i need some registry values under
HKEY_LOCAL_MACHINE\System\Touch\Buttons
What i need is the keys and the values(better if the device is 4.7" or more)
Thanks

content of "Buttons" from 950XL
"0" key
String = Name, Value = Back
Integer = VKey, Value = 27
"1" key
String = Name, Value = Start
Integer = VKey, Value = 113
"2" key
String = Name, Value = Search
Integer = VKey, Value = 114
Integer = Count, Value = 3
Integer = Duration, Value = 20
Integer = Intensity, Value = 100
Integer = Vibrate, Value = 1

For 640xl.,
All the values are same...except,
Duration(value=41)
Intensity(value=99)
previously i disabled vibration for navigation keys under touch and gestures settings so,
Vibrate(value=0)

dxdy said:
content of "Buttons" from 950XL
"0" key
String = Name, Value = Back
Integer = VKey, Value = 27
"1" key
String = Name, Value = Start
Integer = VKey, Value = 113
"2" key
String = Name, Value = Search
Integer = VKey, Value = 114
Integer = Count, Value = 3
Integer = Duration, Value = 20
Integer = Intensity, Value = 100
Integer = Vibrate, Value = 1
Click to expand...
Click to collapse
Sai Chrisna said:
For 640xl.,
All the values are same...except,
Duration(value=41)
Intensity(value=99)
previously i disabled vibration for navigation keys under touch and gestures settings so,
Vibrate(value=0)
Click to expand...
Click to collapse
Intensity around 50 saves some battery

Related

Create PopUp with dimmed background

Hello devs
Im developing an application for Windows Mobile in Visual Basic.NET.
Now I would like to make some kind of PopUp with all the stuff seen in background "dimmed". This can be seen on all newer Manila-Style applications and of course HTC is making those popups.
But, how do I create such popups? I know that it has something to do with AlphaBlending, but I don't really understand how to make it.
Does anyone of you probably have a working sample solution in VB.NET?
Many thanks in advance for any help...
raftbone
Here you go. http://blogs.msdn.com/priozersk/archive/2009/03/31/dimming-the-background.aspx
This guys blog is great. All kinds of tips and tricks to make mobile apps work and look better.
Many thanks for the link. I'll try to get this code changed to VB.NET.
Seems to lock pretty easy and it's exactly what I was looking for
OK, I've managed to change the code into VB. This is the code:
Code:
Protected Overrides Sub OnPaint(ByVal e As PaintEventArgs)
Dim dimBackground As Bitmap = New Bitmap(Me.Width, Me.Height)
Dim gxTemp As Graphics = Graphics.FromImage(dimBackground)
gxTemp.Clear(Color.Black)
e.Graphics.drawalpha(dimBackground, 100, 0, 0)
gxTemp.Dispose()
dimBackground.Dispose()
End Sub
The code is working execpt "DrawAlpha". DrawAlpha seems to be unknown in VisualBasic.NET with .NET CF 3.5.
Can anyone help me how to get the DrawAlpha method working?
Code:
Public Module opacity
Public Structure BlendFunction
Public BlendOp As Byte
Public BlendFlags As Byte
Public SourceConstantAlpha As Byte
Public AlphaFormat As Byte
End Structure
Public Declare Function AlphaBlendCE Lib "Coredll.dll" Alias "AlphaBlend" (ByVal hdcDest As IntPtr, _
ByVal xDest As Int32, ByVal yDest As Int32, ByVal cxDest As Int32, _
ByVal cyDest As Int32, ByVal hdcSrc As IntPtr, ByVal xSrc As Int32, _
ByVal ySrc As Int32, ByVal cxSrc As Int32, ByVal cySrc As Int32, _
ByVal blendFunction As BlendFunction) As Int32
Public Enum BlendOperation As Byte
AC_SRC_OVER = &H0
End Enum
Public Enum BlendFlags As Byte
Zero = &H0
End Enum
Public Enum SourceConstantAlpha As Byte
Transparent = &H0
Opaque = &HFF
End Enum
Public Enum AlphaFormat As Byte
AC_SRC_ALPHA = &H0
End Enum
Public Sub DrawAlpha(ByVal gx As Graphics, ByVal image As Bitmap, _
ByVal transp As Byte, ByVal x As Integer, ByVal y As Integer)
Try
Using gxSrc As Graphics = Graphics.FromImage(image)
Dim hdcDst As IntPtr = gx.GetHdc()
Dim hdcSrc As IntPtr = gxSrc.GetHdc()
Dim bf As New BlendFunction()
bf.BlendOp = CByte(BlendOperation.AC_SRC_OVER)
bf.BlendFlags = CByte(BlendFlags.Zero)
bf.SourceConstantAlpha = transp
bf.AlphaFormat = CByte(AlphaFormat.AC_SRC_ALPHA)
AlphaBlendCE(hdcDst, x, y, image.Width, image.Height, hdcSrc, _
0, 0, image.Width, image.Height, bf)
gx.ReleaseHdc(hdcDst)
gxSrc.ReleaseHdc(hdcSrc)
End Using
Catch ex As Exception
Logger.log("Device dont support alphablending.", Logger.logLevel.NOTICE)
Logger.log(ex, Logger.logLevel.NOTICE)
End Try
End Sub
End Module
usage:
Code:
opacity.DrawAlpha(e.graphics, bmp, 128), 0, 0) 'draw your bmp with 50% opacity
Hope it help it's the quicker method that I found. I have cutted out some specific code from my app, so you ca find error, I've not test the code. Let me know if you have trouble.
If you are intrested there is an other way to make opacity bitmap that work pixel per pixel but is too slow.
If you found better method please post it.
Ciao
Hi
Many thanks for your code. It seems to work pretty using the code I have posted initally. There I was using a new form with WindowState = Maximized etc.
But now I don't really understand on how to exactly use your code in my project.
I have one form and multiple controls on it. The controls are normally invisible and set to Visible = True if I need to show them.
How can I now dim the background with your code, before setting a specific control to Visible = True?
I tried something like this:
Code:
Private Sub ShowPanel()
Dim dimBackground As Bitmap = New Bitmap(Me.Width, Me.Height)
Dim gxTemp As Graphics = Graphics.FromImage(dimBackground)
gxTemp.Clear(Color.Black)
modOpacity.DrawAlpha(gxTemp, dimBackground, 128, 0, 0)
gxTemp.Dispose()
dimBackground.Dispose()
Me.Panel2.Visible = True
End Sub
But if I do this code, I get an error in your code at the line:
Code:
Dim hdcSrc As IntPtr = gxSrc.GetHdc()
It seems, that the object gxSrc does not have a method GetHdc(), but I simply don't understand why...
Could you probably get me into the right direction?
raftbone
As explained in the blog I've created a form 'BackgroundForm'
Code:
using System;
using System.Drawing;
using System.Windows.Forms;
using Microsoft.Drawing;
namespace UI
{
public partial class BackgroundForm : Form
{
public BackgroundForm()
{
InitializeComponent();
}
protected override void OnPaint(PaintEventArgs e)
{
using (Bitmap dimBackGround = new Bitmap(this.Width, this.Height))
using (Graphics gxTemp = Graphics.FromImage(dimBackGround))
{
gxTemp.Clear(Color.Black);
opacity.DrawAlpha(e.Graphics, dimBackGround, 100, 0, 0);
}
}
protected override void OnPaintBackground(PaintEventArgs e)
{
}
}
}
and changed it to be fullscreen (in the designer):
Code:
FormBorderStyle = System.Windows.Forms.FormBorderStyle.None;
WindowState = System.Windows.Forms.FormWindowState.Maximized;
Then I've created a static helper class
Code:
using System;
using System.Windows.Forms;
namespace UI
{
public static class FormHelper
{
public static DialogResult ShowMessageBox(string text)
{
return ShowMessageBox(text, string.Empty, MessageBoxButtons.OK, MessageBoxIcon.None);
}
public static DialogResult ShowMessageBox(string text, string caption)
{
return ShowMessageBox(text, caption, MessageBoxButtons.OK, MessageBoxIcon.None);
}
public static DialogResult ShowMessageBox(string text, string caption, MessageBoxButtons buttons, MessageBoxIcon icon)
{
BackgroundForm form = new BackgroundForm();
form.Show();
DialogResult result = MessageBox.Show(text, caption, buttons, icon, MessageBoxDefaultButton.Button1);
form.Close();
return result;
}
}
}
And now you can simply use one of the three methods to show a message box with dimmed background e.g.
Code:
FormHelper.ShowMessageBox("Text", "Caption", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
To convert from C# to VB.net use for example convert csharp to vb.
Hi
Thanks for your answer. Meanwhile I was already able to get it working with your blog info about using a new form.
Thanks to everyone helping me
raftbone

problem on screen orientation

Hi all,
i want to lock the screen orientation in portrait mode.
how can i do it in programming??
Thank you
try this, is not too clean sorry:
Code:
Public Class display
'DEVICEMODE
<Runtime.InteropServices.DllImport("coredll.dll")> _
Friend Shared Function ChangeDisplaySettingsEx(ByVal lpszDeviceName As String, ByVal lpDevMode As Byte(), ByVal hwnd As IntPtr, ByVal dwflags As CDSFlags, ByVal lParam As IntPtr) As CDSRet
End Function
'Declare Function ChangeDisplaySettingsEx Lib "coredll.dll" (ByVal lpszDeviceName As String, ByVal lpDevMode As Byte(), ByVal hwnd As IntPtr, ByVal dwflags As CDSFlags, ByVal lParam As IntPtr) As CDSRet
Public Shared Function ChangeDisplayOrientation(ByVal degree As Integer) As String
Dim devMode As New devicemodeW()
devMode.dmFields = DM_Fields.DM_DISPLAYORIENTATION
If degree = 0 Then
devMode.dmDisplayOrientation = DMD.DMDO_0
ElseIf degree = 90 Then
devMode.dmDisplayOrientation = DMD.DMDO_90
ElseIf degree = 180 Then
devMode.dmDisplayOrientation = DMD.DMDO_180
ElseIf degree = 270 Then
devMode.dmDisplayOrientation = DMD.DMDO_270
End If
Dim ret As CDSRet = ChangeDisplaySettingsEx(Nothing, devMode.Data, IntPtr.Zero, 0, IntPtr.Zero)
Return (ret.ToString())
End Function
' from pinvoke.net
Public Enum DMD
DMDO_0 = 0
DMDO_90 = 1
DMDO_180 = 2
DMDO_270 = 4
End Enum
Public Enum DM_Fields
DM_DISPLAYORIENTATION = 8388608
DM_DISPLAYQUERYORIENTATION = 16777216
End Enum
Public Enum DM_Orient
DMORIENT_PORTRAIT = 1
DMORIENT_LANDSCAPE = 2
End Enum
' Flags for ChangeDisplaySettings
Enum CDSFlags
CDS_VIDEOPARAMETERS = &H20
CDS_RESET = &H40000000
End Enum
' Return values for ChangeDisplaySettings
Enum CDSRet
DISP_CHANGE_SUCCESSFUL = 0
DISP_CHANGE_RESTART = 1
DISP_CHANGE_FAILED = -1
DISP_CHANGE_BADMODE = -2
DISP_CHANGE_NOTUPDATED = -3
DISP_CHANGE_BADFLAGS = -4
DISP_CHANGE_BADPARAM = -5
End Enum
Public Class devicemodeW
Inherits SelfMarshalledStruct
Private _DM_Orient As DM_Orient
Private _DM_Fields As DM_Fields
Private _DMD As DMD
Public Sub New()
MyBase.New(192)
dmSize = CUShort(Data.Length)
End Sub
Public Property dmDeviceName() As String
Get
Return GetStringUni(0, 64)
End Get
Set(ByVal value As String)
SetStringUni(value, 0, 64)
End Set
End Property
Public Property dmSpecVersion() As UShort
Get
Return GetUInt16(64)
End Get
Set(ByVal value As UShort)
SetUInt16(64, value)
End Set
End Property
Public Property dmDriverVersion() As UShort
Get
Return GetUInt16(66)
End Get
Set(ByVal value As UShort)
SetUInt16(66, value)
End Set
End Property
Public Property dmSize() As UShort
Get
Return GetUInt16(68)
End Get
Set(ByVal value As UShort)
SetUInt16(68, value)
End Set
End Property
Public Property dmDriverExtra() As UShort
Get
Return GetUInt16(70)
End Get
Set(ByVal value As UShort)
SetUInt16(70, value)
End Set
End Property
Public Property dmFields() As DM_Fields
Get
'Return DirectCast(GetUInt32(72), DM_Fields)
Return _DM_Fields
End Get
Set(ByVal value As DM_Fields)
_DM_Fields = value
SetUInt32(72, CInt(value))
End Set
End Property
Public Property dmOrientation() As DM_Orient
Get
'Return DirectCast(GetInt16(76), DM_Orient)
Return _DM_Orient
End Get
Set(ByVal value As DM_Orient)
SetInt16(76, CShort(value))
End Set
End Property
Public Property dmPaperSize() As Short
Get
Return GetInt16(78)
End Get
Set(ByVal value As Short)
SetInt16(78, value)
End Set
End Property
Public Property dmPaperLength() As Short
Get
Return GetInt16(80)
End Get
Set(ByVal value As Short)
SetInt16(80, value)
End Set
End Property
Public Property dmPaperWidth() As Short
Get
Return GetInt16(82)
End Get
Set(ByVal value As Short)
SetInt16(82, value)
End Set
End Property
Public Property dmScale() As Short
Get
Return GetInt16(84)
End Get
Set(ByVal value As Short)
SetInt16(84, value)
End Set
End Property
Public Property dmCopies() As Short
Get
Return GetInt16(86)
End Get
Set(ByVal value As Short)
SetInt16(86, value)
End Set
End Property
Public Property dmDefaultSource() As Short
Get
Return GetInt16(88)
End Get
Set(ByVal value As Short)
SetInt16(88, value)
End Set
End Property
Public Property dmPrintQuality() As Short
Get
Return GetInt16(90)
End Get
Set(ByVal value As Short)
SetInt16(90, value)
End Set
End Property
Public Property dmColor() As Short
Get
Return GetInt16(92)
End Get
Set(ByVal value As Short)
SetInt16(92, value)
End Set
End Property
Public Property dmDuplex() As Short
Get
Return GetInt16(94)
End Get
Set(ByVal value As Short)
SetInt16(94, value)
End Set
End Property
Public Property dmYResolution() As Short
Get
Return GetInt16(96)
End Get
Set(ByVal value As Short)
SetInt16(96, value)
End Set
End Property
Public Property dmTTOption() As Short
Get
Return GetInt16(98)
End Get
Set(ByVal value As Short)
SetInt16(98, value)
End Set
End Property
Public Property dmCollate() As Short
Get
Return GetInt16(100)
End Get
Set(ByVal value As Short)
SetInt16(100, value)
End Set
End Property
Public Property dmFormName() As String
Get
Return GetStringUni(102, 64)
End Get
Set(ByVal value As String)
SetStringUni(value, 102, 64)
End Set
End Property
Public Property dmLogPixels() As UShort
Get
Return GetUInt16(166)
End Get
Set(ByVal value As UShort)
SetUInt16(166, value)
End Set
End Property
Public Property dmBitsPerPel() As UInteger
Get
Return GetUInt32(168)
End Get
Set(ByVal value As UInteger)
SetUInt32(168, value)
End Set
End Property
Public Property dmPelsWidth() As UInteger
Get
Return GetUInt32(172)
End Get
Set(ByVal value As UInteger)
SetUInt32(172, value)
End Set
End Property
Public Property dmPelsHeight() As UInteger
Get
Return GetUInt32(176)
End Get
Set(ByVal value As UInteger)
SetUInt32(176, value)
End Set
End Property
Public Property dmDisplayFlags() As UInteger
Get
Return GetUInt32(180)
End Get
Set(ByVal value As UInteger)
SetUInt32(180, value)
End Set
End Property
Public Property dmDisplayFrequency() As UInteger
Get
Return GetUInt32(184)
End Get
Set(ByVal value As UInteger)
SetUInt32(184, value)
End Set
End Property
Public Property dmDisplayOrientation() As DMD
Get
'Return DirectCast(GetUInt32(188), DMD)
Return _DMD
End Get
Set(ByVal value As DMD)
_DMD = value
SetUInt32(188, CInt(value))
End Set
End Property
End Class
Public Class ScreenMode
'DEVICEMODE
<Runtime.InteropServices.DllImport("coredll.dll")> _
Friend Shared Function ChangeDisplaySettingsEx(ByVal lpszDeviceName As String, ByVal lpDevMode As Byte(), ByVal hwnd As IntPtr, ByVal dwflags As CDSFlags, ByVal lParam As IntPtr) As CDSRet
End Function
'Declare Function ChangeDisplaySettingsEx Lib "coredll.dll" (ByVal lpszDeviceName As String, ByVal lpDevMode As Byte(), ByVal hwnd As IntPtr, ByVal dwflags As CDSFlags, ByVal lParam As IntPtr) As CDSRet
Public Function ChangeMode(ByVal degree As Integer) As String
Dim devMode As New devicemodeW()
devMode.dmFields = DM_Fields.DM_DISPLAYORIENTATION
If degree = 0 Then
devMode.dmDisplayOrientation = DMD.DMDO_0
ElseIf degree = 90 Then
devMode.dmDisplayOrientation = DMD.DMDO_90
ElseIf degree = 180 Then
devMode.dmDisplayOrientation = DMD.DMDO_180
ElseIf degree = 270 Then
devMode.dmDisplayOrientation = DMD.DMDO_270
End If
Dim ret As CDSRet = ChangeDisplaySettingsEx(Nothing, devMode.Data, IntPtr.Zero, 0, IntPtr.Zero)
Return (ret.ToString())
End Function
Public Sub SetLandscape()
Try
ChangeMode(90)
Catch ex As Exception
'MsgBox(ex.ToString)
End Try
End Sub
Public Sub SetPortrait()
Try
ChangeMode(0)
Catch ex As Exception
'MsgBox(ex.ToString)
End Try
End Sub
End Class
End Class
usage:
Code:
display.ChangeMode(angle)
i use Win32API to write my app. But , your code is VB.
i will try my best to understand it.
Thank alessandroame so much =]

WP7 - how to update the bound data in a chart?

Hi,
I'm having a hard time for, what I guess, is a simple question...
Here is the code I'm using to render the amChart
In short, my situation is tha the chart always renders the same datapoints...and there is no way I can change them!
Code:
Dim Y_Value_0 As Double = 0.0
Dim Y_Value_1 As Double = 0.0
Dim Y_Value_2 As Double = 0.0
Dim Y_Value_3 As Double = 0.0
Dim Y_Value_4 As Double = 0.0
Public Class ItemValues
Public Property Range() As String
Public Property Value() As Double
End Class
Private DataPoints As New ObservableCollection(Of ItemValues)() From
{New ItemValues() With {.Range = "200", .Value = Y_Value_0}, _
New ItemValues() With {.Range = "400", .Value = Y_Value_1}, _
New ItemValues() With {.Range = "600", .Value = Y_Value_2}, _
New ItemValues() With {.Range = "800", .Value = Y_Value_3}}
Public ReadOnly Property Data() As ObservableCollection(Of ItemValues)
Get
Return DataPoints
End Get
End Property
Private Sub Page_Graphs_Loaded(ByVal sender As Object, ByVal e As System.Windows.RoutedEventArgs) Handles MyBase.Loaded
Me.Fill_Graph()
End Sub
Private Sub Fill_Graph()
Y_Value_0 = -5
Y_Value_1 = -10
Y_Value_2 = -20
Y_Value_3 = -50
Me.DataContext = Me
End Sub
However, there is no way, that when the chart is rendered it takes the new values...
In short, how to make the graph to take my data points?
Thanks in advance for any help!
You need to use INotifyPropertyChanged interface so the databound control knows when to update itself.
http://msdn.microsoft.com/en-us/library/system.componentmodel.inotifypropertychanged.aspx
Check out the "Windows Phone Databound Application" template installed by default if you want to see a working project. It uses a listbox but it's the same concept.

MortScripts to toggle settings

This thread is dedicated to MortScripts that we use to change settings. Most of these can be stand alone scripts, but I got started creating this thread based on CHTS needing WMLongLife to change from Automatic to GSM radio profile. I found that WMLL seemed to eat up battery life in my old Fuze. I tried a script or two from the MortScript examples thread, but they did not work for me. I'll be posting various scripts that I use during my profile changes in CHTS, but I will in such a way that if you do not use CHTS you can still use the scripts.
Another purpose of this thread is to make these scripts available to those who for one reason or another the default programs in CHTS do not work and perhaps the script will. An example is sound profile changing to Automatic was not available so I added a script to do it for me. The feature had been turned off since it did not work in all phones. In a coming version I believe it will be back. The beta test works in my Fuze.
The hope of this thread is to help those that use CHTS to get some of the features that may not work on their phone through MortScripts instead. Also, as a place to share these "TOGGLE" switch scripts for others to be able to use outside CHTS.
I am trying to write scripts that do not use programs outside windows mobile. The hope is that they can be used in as many phones and ROMs as possible. An example is the first form of my Band_Changer used a program in CHTS and I reworked it to not require that program.
Radio toggle between Automatic (2G & 3G) and GSM (2G only): Post #2
Switch Sound Profile: Post #3
Auto time zone toggle: Post #5 and Post #8
Toggle Backlight: Post #14
Toggle Screen Rotation: Post #15
Toggle between Active Sync and Mass Storage: Post #16
Toggle Voice Command: Post #17
Radio toggle between Automatic (2G & 3G) and GSM (2G only)
This script calls the main script with the argument required based on your current profile to switch the profile to the other.
Code:
# Band_Toggle.mscr
opmode = RegRead( "HKLM","Software\OEM\UMTS","OpMode")
opmode = RegRead( "HKLM","Software\OEM\PhoneSetting\NetworkType","ItemName" & OpMode + 1)
If(opmode eq "Auto")
key = "g"
Else
key = "a"
EndIf
CallScript("\storage card\scripts\Band_Changer.mscr", key)
# CallScript("\windows\Band_Changer.mscr", key)
I test the script in my storage card, but when I use it for CHTS I would have it in \windows folder.
This is the main script:
Code:
# Band_Changer.mscr
If(NOT FileExists("\Windows\CMBandSwitching.exe"))
Message("You must have CMBandSwitching.exe installed in windows folder.^NL^^NL^Script will exit now.", "ERROR")
Exit
EndIf
key = argv[1]
key = (key eq "a")?"Auto":"GSM"
opmode = RegRead( "HKLM","Software\OEM\UMTS","OpMode")
opmode = RegRead( "HKLM","Software\OEM\PhoneSetting\NetworkType","ItemName" & OpMode + 1)
network1 = RegRead( "HKLM","Software\OEM\PhoneSetting\NetworkType","ItemName1" )
network2 = RegRead( "HKLM","Software\OEM\PhoneSetting\NetworkType","ItemName2" )
network3 = RegRead( "HKLM","Software\OEM\PhoneSetting\NetworkType","ItemName3" )
If(key ne OpMode)
If(key eq network1)
key = 1
ElseIf(key eq network2)
key = 2
ElseIf(key eq network3)
key = 3
Else
EndIf
Call("switcher")
EndIf
Sub switcher
Global(key)
SendSpecial(126) # Data disconnect
i=0
ForEach xvariable in regSubkeys("HKLM", "Comm\ConnMgr\Providers\{7C4B7A38-5FF7-4bc1-80F6-5DA7870BB1AA}\Connections")
i+=1
enable[i] = RegRead("HKLM", "Comm\ConnMgr\Providers\{7C4B7A38-5FF7-4bc1-80F6-5DA7870BB1AA}\Connections" \ xvariable, "Enabled")
EndForEach
Sleep(500)
ForEach xvariable in regSubkeys("HKLM", "Comm\ConnMgr\Providers\{7C4B7A38-5FF7-4bc1-80F6-5DA7870BB1AA}\Connections")
RegWriteDWord("HKLM", "Comm\ConnMgr\Providers\{7C4B7A38-5FF7-4bc1-80F6-5DA7870BB1AA}\Connections" \ xvariable, "Enabled", 0)
EndForEach
Sleep(500)
Run("\Windows\CMBandSwitching.exe")
If(ScreenHeight() eq 640)
Y1 = 160 # 1st button which is Auto on my Fuze 163
Y2 = 245 # 2nd button which is GSM on my Fuze 244
Y3 = 315 # 3rd button which is WCDMA on my Fuze 314
Y4 = 610 # Done button on my Fuze 608
X4 = 135 # Done button on my Fuze 134
Y5 = 460 # Done button on my Fuze 460
X5 = 125 # Done button on my Fuze 125
ElseIf(ScreenHeight() eq 800)
Y1 = 150 # 1st button which is Auto on HD2 150
Y2 = 200 # 2nd button which is GSM on HD2 200
Y3 = 305 # 3rd button which is WCDMA on HD2 305
Y4 = 750 # Done button on HD2 750
X4 = 110 # Done button on HD2 110
Y5 = 480 # Done button on HD2 480
X5 = 110 # Done button on HD2 110
EndIf
While(NOT WndActive("Band"))
Sleep(50)
EndWhile
If(key eq 1)
MouseClick("Band", ScreenWidth()*0.25, Y1) # 1st button
ElseIf(key eq 2)
MouseClick("Band", ScreenWidth()*0.25, Y2) # 2nd button
Else
MouseClick("Band", ScreenWidth()*0.25, Y3) # 3rd button
EndIf
Sleep(150)
SendSpecial(112) # Done
Sleep(500)
i=0
ForEach xvariable in regSubkeys("HKLM", "Comm\ConnMgr\Providers\{7C4B7A38-5FF7-4bc1-80F6-5DA7870BB1AA}\Connections")
i+=1
RegWriteDWord("HKLM", "Comm\ConnMgr\Providers\{7C4B7A38-5FF7-4bc1-80F6-5DA7870BB1AA}\Connections" \ xvariable, "Enabled", enable[i])
EndForEach
Sleep(20000)
If(NOT Connected())
Connect("The Internet")
EndIf
EndSub
If you do not have a 480 x 640 or 480 x 800 phone or if this does not work for you please try this script to get me the points I need to improve this script.
Code:
# PickPoints.mscr
Run("\Windows\CMBandSwitching.exe")
WaitForActive("Band", 10)
Sleep(300)
SleepMessage( 2, "Select center of first (top) Network Type choice after this screen closes." )
Sleep(300)
aMouse = ScreenshotClick()
sMSGOutput1 = "^NL^First:^NL^X1 = " & aMouse[1] &"^NL^Y1 = " & aMouse[2]
SleepMessage( 2, "Select center of second (middle) Network Type choice after this screen closes." )
Sleep(300)
aMouse = ScreenshotClick()
sMSGOutput2 = "^NL^Second:^NL^X2 = " & aMouse[1] &"^NL^Y2 = " & aMouse[2]
SleepMessage( 2, "Select center of third (bottom) Network Type choice after this screen closes." )
Sleep(300)
aMouse = ScreenshotClick()
sMSGOutput3 = "^NL^Third:^NL^X3 = " & aMouse[1] &"^NL^Y3 = " & aMouse[2]
Sleep(300)
MouseClick("Band", aMouse[1], aMouse[2])
Sleep(300)
SleepMessage( 2, "Select center of Done button after this screen closes." )
Sleep(300)
aMouse = ScreenshotClick()
sMSGOutput4 = "^NL^Done:^NL^X4 = " & aMouse[1] &"^NL^Y4 = " & aMouse[2]
Sleep(300)
MouseClick("Band", aMouse[1], aMouse[2])
Sleep(1500)
SleepMessage( 2, "Select center of OK button after this screen closes." )
Sleep(300)
aMouse = ScreenshotClick()
sMSGOutput5 = "^NL^OK:^NL^X5 = " & aMouse[1] &"^NL^Y5 = " & aMouse[2]
SleepMessage( 2, "Select center of Cancel button after this screen closes." )
Sleep(3000)
WriteFile("\band_click.txt", "Screen width: " & ScreenWidth() & "^NL^Screen height: " & ScreenHeight() & sMSGOutput1 & sMSGOutput2 & sMSGOutput3 & sMSGOutput4 & sMSGOutput5)
Message("Please send me these data. They are saved in root directory \band_click.txt^NL^")
Remove the .txt from the end of the script files.
Switch Sound Profile
These scripts call the main script with the argument for the profile you want.
Code:
# Sound_Automatic.mscr
CallScript("\Windows\Sound_Profile.mscr", "Automatic")
Code:
# Sound_Normal.mscr
CallScript("\Windows\Sound_Profile.mscr", "Normal")
Code:
# Sound_Silent.mscr
CallScript("\Windows\Sound_Profile.mscr", "Silent")
Code:
# Sound_Vibrate.mscr
CallScript("\Windows\Sound_Profile.mscr", "Vibrate")
This is the main script:
Code:
# Sound_Profile.mscr
# Change Sound Profile based on argument used to call this script from
# a short script in the form:
# CallScript("\Windows\Sound_Profile.mscr", "Automatic")
mode=argv[1]
If(mode EQ "Automatic")
RegWriteString("HKCU", "ControlPanel\Profiles", "ActiveProfile", "Automatic")
SendMessage("", 1156, 0, 0)
ElseIf(mode EQ "Normal")
RegWriteString("HKCU", "ControlPanel\Profiles", "ActiveProfile", "Normal")
SendMessage("", 1156, 0, 0)
ElseIf(mode EQ "Silent")
SendMessage("", 1156, 3, 0)
ElseIf(mode EQ "Vibrate")
SendMessage("", 1156, 2, 0)
Else
EndIf
In CHTS profile switching I use the Execute/Kill App(s) section with the executable as \windows\mortscript.exe and the argument one of these four:
\Windows\Sound_Profile.mscr Automatic
\Windows\Sound_Profile.mscr Normal
\Windows\Sound_Profile.mscr Silent
\Windows\Sound_Profile.mscr Vibrate
Remove the .txt from the end of the script files.
This isn't written as a toggle, but these scripts will turn off or on the auto-time zone sync option in phone settings. Turning it off helps to keep active sync from running all the time.
Code:
#Auto time zone off
RegWriteDWord("HKLM","\Drivers\BuiltIn\RIL","NITZEnable",0)
Code:
#Auto time zone on
RegWriteDWord("HKLM","\Drivers\BuiltIn\RIL","NITZEnable",1)
Auto time zone toggle
Thanks Farmer Ted
It is easy enough to create a toggle.
Code:
If(RegRead("HKLM","\Drivers\BuiltIn\RIL","NITZEnable"))
RegWriteDWord("HKLM","\Drivers\BuiltIn\RIL","NITZEnable",0) #Auto time zone off
Else
RegWriteDWord("HKLM","\Drivers\BuiltIn\RIL","NITZEnable",1) #Auto time zone on
EndIf
Thx RoryB... toggle features are good... if you can store all here.. it must be a good base to share with communauty !
great job my friend! especially after the long test time in beta group to fulfill different device's needs.
this is the perfect extension for the post-run-scripts while profile switching.
I'm looking forward to much more of this scripts, which can be used.
Thanx also in name of all CHTS-users
Micha
RoryB said:
Thanks Farmer Ted
It is easy enough to create a toggle.
Click to expand...
Click to collapse
Cool, that was a lot simpler than if I'd done it, lol. Here's the same script, with message boxes to let you know what the setting is.
Code:
If(RegRead("HKLM","\Drivers\BuiltIn\RIL","NITZEnable"))
RegWriteDWord("HKLM","\Drivers\BuiltIn\RIL","NITZEnable",0) #Auto time zone off
Message("Active Sync under control")
Else
RegWriteDWord("HKLM","\Drivers\BuiltIn\RIL","NITZEnable",1) #Auto time zone on
Message("Active Sync running wild")
EndIf
LOL I love a sense of humor.
I updated post #2 for the Band Changer because I have been getting failed to connect or dialed modem not answering error messages.
RoryB said:
I updated post #2 for the Band Changer because I have been getting failed to connect or dialed modem not answering error messages.
Click to expand...
Click to collapse
Made another tweak to stop data connection first.
Updated Post #2 for Band_Changer.mscr. It seems to run a little faster.
On Band_Changer I realized that
Code:
Y1 = 150 # 1st button which is Auto on HD2 150
Y2 = 215 # 2nd button which is GSM on HD2 200
Y3 = 300 # 3rd button which is WCDMA on HD2 305
works in my phone too. So I would not need to check the screen size, but I am running Energy ROM that is a WVGA with tweaks to work on my VGA. I need to get some pick point data from anyone who uses a true VGA ROM in their phone to confirm the points for it. Also, a screen shot of CMBandSwitcher.exe would help a lot.
If CMBandSwitcher.exe has the same screen size for WVGA and VGA phones I will be able to reduce the code some more.
Toggle Backlight
From http://forum.xda-developers.com/showpost.php?p=2018165&postcount=239
Code:
#toggle backlight between max and one-from-minimum (on trinity at least)
CurrentBright = RegRead( "HKCU", "ControlPanel\Backlight", "Brightness" )
If (CurrentBright = 1)
SetBacklight (100, 5)
Else
SetBacklight (1, 1)
EndIf
Toggle Screen Rotation
From http://forum.xda-developers.com/showpost.php?p=2832605&postcount=929
Code:
If (regread("HKLM", "System\GDI\ROTATION", "ANGLE") eq 0)
Rotate (90)
Else
Rotate (0)
Endif
Toggle between Active Sync and Mass Storage
From http://forum.xda-developers.com/showpost.php?p=5078802&postcount=2552
Code:
usb = RegRead ( "HKLM", "Drivers\USB\FunctionDrivers", "DefaultClientDriver" )
If ( usb eq "RNDIS" )
Run ( "\Windows\USBSetting.exe" )
Sleep ( 200 )
SendSpecial ( "Down" )
Sleep ( 50 )
SendSpecial ( "CR" )
Sleep ( 50 )
SendOK
ElseIf ( usb eq "Mass_Storage_Class" )
Run ( "\Windows\USBSetting.exe" )
Sleep ( 200 )
SendSpecial ( "Up" )
Sleep ( 50 )
SendSpecial ( "CR" )
Sleep ( 50 )
SendOK
EndIf
Toggle Voice Command
I only use Voice Command when I am driving so I toggle it off when I am not driving to save battery drain.
Code:
ShowWaitCursor
If( ProcExists( "VoiceCmd.exe" ) )
Kill( "VoiceCmd.exe" )
PlaySound( "Stopping" )
HideWaitCursor
SleepMessage( 2, "Voice Command^NL^^NL^Stopped", "Voice Command Toggle" )
Delete( "\Windows\Startup\Voice Command.lnk" ) # so it will not restart after a soft reset
else
Run( "\Program Files\Voice Command\VoiceCmd.exe" )
PlaySound( "Starting" )
HideWaitCursor
SleepMessage( 2, "Voice Command^NL^^NL^Started", "Voice Command Toggle" )
Endif
Sad to go
My Fuze no longer works. I currently have a loner Infuse 4G, but do not know what I will end up with.
I will not be able to continue development of Mortscripts, etc.
Sorry to go, but it has been fun.
I'll keep watching to see if anything comes up I need to respond to.

Hide an NDEF record into the NDEF Message?

I have developped 2 Android applications. The first one, to write into an NFC tag, and the second to read the contents I have written .
This is what i did in the first application (WriteNFC)
private NdefRecord createRecord1(String data)
{
byte[] payload = data.getBytes(Charset.forName("UTF-8"));
byte[] empty = new byte[] {};
return new NdefRecord(NdefRecord.TNF_ABSOLUTE_URI, empty, empty, payload);
}
private NdefRecord createRecord2(String data)
{
byte[] payload = data.getBytes(Charset.forName("UTF-8"));
byte[] empty = new byte[] {};
return new NdefRecord(NdefRecord.TNF_ABSOLUTE_URI, payload, empty, empty);
}
And for in the second application (ReadNFC)
NdefRecord cardRecord = msg.getRecords()[1];//Extract the second Record
String url_data = new String(cardRecord.getType());//Read data type
Result:
When I read with my own application (ReadNFC), of course I had on screen only the payload of the second Record, which I stored through "Record Type". But with a third-party application, especially that natively installed ("tag"), It display correctly the first record, and for the second it's an empty field. How can I hide this field. Otherwise, how can I force the other third-party applications to not read the second record?

Categories

Resources