Mortscript Sendkeys Help - Windows Mobile Development and Hacking General

Hi,
am trying to use Mortscript to automate some key presses on my E650. The script is below.
It gets so far to opening settings.exe and then nothing happens.
What am I doing wrong?
RunCheck = 0
While (1)
HandsFreeState = RegRead("HKLM", "System\State\Hardware", "Handsfree")
If (HandsFreeState = 1 && RunCheck = 0)
Run "\Windows\Settings.exe"
Sleep 2000
SendKeys("6")
Sleep 2000
SendKeys("3")
Sleep 2000
SendKeys("1")
RunCheck = 1
EndIf
If (HandsFreeState = 0 && RunCheck = 1)
# - Enter any code you wish to execute on disconnect here.
ToggleDisplay(0)
RunCheck = 0
EndIf
Sleep (1000)
EndWhile

I've ran into this before.
you might try sending a mouse click to the field that you want the numbers inputed to. (this insures that the field has focus)

Related

set the bearermode V110 for a GSM ISDN data connection

Hi,
how can I set the bearermode for a GSM to ISDN dataconnection?
If I connect with my tornado (SDA) smartephone (TAPI) to ISDN, the bearermode will be 3,1 KHz and not "unrestricted digital, V110".
How can I change this?
my code:
Code:
LPLINECALLPARAMS lpCallParams;
lpCallParams = (LPLINECALLPARAMS)malloc(sizeof(LINECALLPARAMS) + 1024); //Speicher reservieren
memset(lpCallParams,0,sizeof(LINECALLPARAMS) + 1024); //0en
lpCallParams->dwTotalSize = sizeof(LINECALLPARAMS) + 1024;
lpCallParams->dwMediaMode = mediaMode;
lpCallParams->dwBearerMode = LINEBEARERMODE_VOICE; //LINEBEARERMODE_VOICE;//LINEBEARERMODE_PASSTHROUGH; //LINEBEARERMODE_VOICE;
lpCallParams->dwCallParamFlags = LINECALLPARAMFLAGS_IDLE;
lpCallParams->dwAddressMode = LINEADDRESSMODE_ADDRESSID;
lpCallParams->dwAddressID = 0;
lpCallParams->dwDisplayableAddressOffset = sizeof(LINECALLPARAMS);
lpCallParams->dwDisplayableAddressSize = number.GetLength();
strcpy((LPSTR)lpCallParams + sizeof(LINECALLPARAMS), (const char*)num);
ret = lineMakeCall(line, &hCall, num, 0, lpCallParams);
Thanks
Thomas
tq said:
Hi,
how can I set the bearermode for a GSM to ISDN dataconnection?
If I connect with my tornado (SDA) smartephone (TAPI) to ISDN, the bearermode will be 3,1 KHz and not "unrestricted digital, V110".
How can I change this?
my code:
Code:
LPLINECALLPARAMS lpCallParams;
lpCallParams = (LPLINECALLPARAMS)malloc(sizeof(LINECALLPARAMS) + 1024); //Speicher reservieren
memset(lpCallParams,0,sizeof(LINECALLPARAMS) + 1024); //0en
lpCallParams->dwTotalSize = sizeof(LINECALLPARAMS) + 1024;
lpCallParams->dwMediaMode = mediaMode;
lpCallParams->dwBearerMode = LINEBEARERMODE_VOICE; //LINEBEARERMODE_VOICE;//LINEBEARERMODE_PASSTHROUGH; //LINEBEARERMODE_VOICE;
lpCallParams->dwCallParamFlags = LINECALLPARAMFLAGS_IDLE;
lpCallParams->dwAddressMode = LINEADDRESSMODE_ADDRESSID;
lpCallParams->dwAddressID = 0;
lpCallParams->dwDisplayableAddressOffset = sizeof(LINECALLPARAMS);
lpCallParams->dwDisplayableAddressSize = number.GetLength();
strcpy((LPSTR)lpCallParams + sizeof(LINECALLPARAMS), (const char*)num);
ret = lineMakeCall(line, &hCall, num, 0, lpCallParams);
Click to expand...
Click to collapse
I would think using LINEBEARERMODE_DATA would help, but the mediamode is also important, it could be LINEMEDIAMODE_DIGITALDATA or LINEMEDIAMODE_DATAMODEM.
bigmac
LINEBEARERMODE_DATA, LINEMEDIAMODE_DIGITALDATA
Hi,
if I set LINEBEARERMODE_DATA the result is the same (3,1 kHz audio). LINEMEDIAMODE_DIGITALDATA don't work with LINEBEARERMODE_DATA or LINEBEARERMODE_VOICE.
Today, I test it on an O2 XDA mini and I get 3,1KHz audio, too.
I found the function lineSetCallBarringState. But what is "lpszPassword ". What is the default setting?
Is the functioned helpful?
thx Thomas

Initiate a VoIP call via RTC API on WM6

Hello everyone, it's my first post here.
Please help me with a small problem:
I have a WM6 device (Glofiish X800) with a VoIP enabled (WM6VoIP.cab). Built-in VoIP dialer works perfectly with my sipnet.ru profile.
Now I'm trying to initiate a VoIP call from my application. I use RTC API for this (rtcdll.dll etc.). I've got headers from the RTC Client API v.1.3 SDK for desktop.
Here are the examples I follow: http://msdn.microsoft.com/en-us/library/ms775274(VS.85).aspx
Everything compiles and runs ok, the objects get created, I even receive RTC events through IRTCEventNotification.
But when I try to enable and register my profile (exactly the same to which I provisioned and it worked), I receive RTCRS_ERROR state with the status 0x800703EB (ERROR_CAN_NOT_COMPLETE).
Code:
ThrowIfFailed(::CoCreateInstance(CLSID_RTCClient, NULL, CLSCTX_INPROC_SERVER, IID_IRTCClient, OUT (LPVOID*)(&client_))) ;
ThrowIfFailed(client_->Initialize()) ;
ThrowIfFailed(client_->QueryInterface(IID_IRTCClientProvisioning, OUT (LPVOID*) &prov_)) ;
ThrowIfFailed(client_->put_EventFilter(RTCRF_REGISTER_ALL)) ;
{
CComPtr<IConnectionPointContainer> connPtCont ;
ThrowIfFailed(client_->QueryInterface(IID_IConnectionPointContainer, OUT (void**)&connPtCont)) ;
ThrowIfFailed(connPtCont->FindConnectionPoint(IID_IRTCEventNotification, OUT &connPt_)) ;
CComPtr<IUnknown> myUnknown ;
ThrowIfFailed(QueryInterface(IID_IUnknown, OUT (void**)&myUnknown)) ;
ThrowIfFailed(connPt_->Advise(myUnknown, OUT &handlerConnectionCookie_)) ;
}
static const PCTSTR KProfileXml =
L"<provision key='1232ab01' name='SIPNET'>"
L" <provider name='SIPNET' />"
L" <user account='sim123456' password='s1i2m3'"
L" uri='sip:[email protected]'"
L" allowedauth='digest'/>"
L" <sipsrv addr='sipnet.ru:5060' protocol='UDP' role='proxy'>"
L" <session party='first' type='pc2pc' />"
L" <session party='first' type='pc2ph' />"
L" </sipsrv>"
L" <sipsrv addr='sipnet.ru:5060' protocol='UDP' role='registrar'/>"
L"</provision>"
;
CComBSTR profileXmlBstr(KProfileXml) ;
ThrowIfFailed(prov_->CreateProfile(profileXmlBstr, OUT &profile_)) ;
ThrowIfFailed(prov_->EnableProfile(profile_, RTCRF_REGISTER_ALL)) ;
I tried to pass 0 to EnableProfile() (to avoid registration) and then make a call.
I call CreateSession() and then AddParticipant(), then I receive RTCSS_INPROGRESS with status 0 and then RTCSS_DISCONNECTED with status 0x800703EB (ERROR_CAN_NOT_COMPLETE).
Code:
ThrowIfFailed(client_->CreateSession(RTCST_PC_TO_PHONE, 0, profile_, RTCCS_FORCE_PROFILE, OUT &session_)) ;
CComBSTR other(L"sip:[email protected]") ;
CComPtr<IRTCParticipant> participant ;
ThrowIfFailed(session_->AddParticipant(other, 0, OUT &participant)) ;
Please, anyone, if you've tried this at home, tell me what am I doing wrong?
The device is in flight mode, connected via ActiveSync USB, internet is accessible.
Here is the event handling code:
Code:
HRESULT CRtcDialog::Event( RTC_EVENT RTCEvent, IDispatch *pEvent )
{
PRINTF1(_CRtcDialog, "RTCEvent = %d", RTCEvent) ;
if (RTCEvent == RTCE_REGISTRATION_STATE_CHANGE)
return HandleRegistrationStateChange(pEvent) ;
if (RTCEvent == RTCE_SESSION_STATE_CHANGE)
return HandleSessionStateChange(pEvent) ;
return S_OK ;
}
HRESULT CRtcDialog::HandleRegistrationStateChange(IDispatch *pIDispatch)
{
ThrowIfNull(pIDispatch) ;
CComPtr<IRTCRegistrationStateChangeEvent> regChangeEvent ;
ThrowIfFailed(pIDispatch->QueryInterface(IID_IRTCRegistrationStateChangeEvent, OUT (void**)&regChangeEvent)) ;
HRESULT hr ;
RTC_REGISTRATION_STATE regState ;
hr = regChangeEvent->get_State(OUT &regState) ;
CComBSTR statusText ;
hr = regChangeEvent->get_StatusText(OUT &statusText) ;
long statusCode = 0 ;
hr = regChangeEvent->get_StatusCode(OUT &statusCode) ;
PRINTF3(_CRtcDialog, "regState = %d (0x%08X: %s)", regState, statusCode, statusText) ;
return S_OK ;
}
Thanks in advance.

[Ruby] SMS Converter (from Pim Backup -> HTML)

I wanted to share a small script I wrote for those who know how to use it. It converts non-binary pim-backup message files to html files.
Usage: ruby <file> <message_file>
Code:
#-sms2html----------------------------------------------------------------#
# ChaosR (<[email protected]>) wrote this file. As long as #
# you do not touch this note and keep this note here you can do whatever #
# you want with this stuff. Also, the author(s) are not responsible for #
# whatever happens using this. #
#-------------------------------------------------------------------------#
require 'jcode' if RUBY_VERSION[0..2] == "1.8"
class SMSConverter
attr_accessor :messages, :raw, :by_folder, :by_name, :by_number
SPEC = [
:msg_id,
:sender_name,
:sender_address,
:sender_address_type,
:prefix,
:subject,
:body,
:body_type,
:folder,
:account,
:msg_class,
:content_length,
:msg_size,
:msg_flags,
:msg_status,
:modify_time,
:delivery_time,
:recipient_nbr,
:recipients,
:attachment_nbr,
:attachments
]
RECIP_SPEC = [
:id,
:name,
:phone,
:var1,
:var2,
:type
]
FOLDERS = {
"\\%MDF1" => "INBOX",
"\\%MDF2" => "OUTBOX",
"\\%MDF3" => "SENT",
"\\%MDF4" => "TRASH",
"\\%MDF5" => "DRAFTS"
}
def initialize(file)
f = File.open(file)
@raw = f.read
f.close
raw2array
clean_messages
sort_messages
end
def raw2array
messages = []
state = { :arg => 0, :escaped => false, :in_string => false }
sms = {}
@raw.each_char do |byte|
arg = SPEC[state[:arg]]
sms[arg] = "" unless sms[arg]
if byte == "\0" or byte == "\r"
next
elsif state[:escaped]
sms[arg] << byte
state[:escaped] = false
elsif state[:in_string]
if byte == "\""
state[:in_string] = false
elsif byte == "\\"
state[:escaped] = true
else
sms[arg] << byte
end
elsif byte == "\\"
state[:escaped] = true
elsif byte == "\""
state[:in_string] = true
elsif byte == ";"
state[:arg] += 1
elsif byte == "\n"
raise "Faulty conversion or corrupt file" if state[:escaped] or state[:in_string] or state[:arg] != 20
messages << sms
sms = {}
state[:arg] = 0
else
sms[arg] << byte
end
end
@messages = messages
end
def clean_messages
@messages.map! do |sms|
sms[:modify_time] = Time.local( *sms[:modify_time].split(",") )
unless sms[:delivery_time] == ""
sms[:delivery_time] = Time.local( *sms[:delivery_time].split(",") )
else
sms[:delivery_time] = sms[:modify_time]
end
sms[:recipient_nbr] = sms[:recipient_nbr].to_i
sms[:body_type] = sms[:body_type].to_i
sms[:msg_flags] = sms[:msg_flags].to_i
sms[:msg_status] = sms[:msg_status].to_i
sms[:attachment_nbr] = sms[:attachment_nbr].to_i
sms[:content_length] = sms[:content_length].to_i
sms[:msg_size] = sms[:msg_size].to_i
sms[:folder] = FOLDERS[sms[:folder]]
if sms[:recipient_nbr] > 0
recipients = {}
sms[:recipients].split(";").each_with_index { |var, index| recipients[RECIP_SPEC[index]] = var }
recipients[:id] = recipients[:id].to_i
recipients[:var1] = recipients[:var1].to_i
recipients[:var2] = recipients[:var2].to_i
sms[:recipients] = recipients
end
sms
end
end
def sort_messages
@messages = @messages.sort { |a, b| a[:delivery_time] <=> b[:delivery_time] }
@by_folder = {}
@messages.each do |sms|
@by_folder[sms[:folder]] = [] unless @by_folder[sms[:folder]]
@by_folder[sms[:folder]] << sms
end
@by_name = {}
@messages.each do |sms|
if sms[:recipient_nbr] > 0
if sms[:recipients][:name] != ""
name = sms[:recipients][:name]
else
name = sms[:recipients][:phone]
end
else
if sms[:sender_name] != ""
name = sms[:sender_name]
else
name = get_number_from_address(sms[:sender_address])
end
end
@by_name[name] = [] unless @by_name[name]
@by_name[name] << sms
end
@by_number = {}
@messages.each do |sms|
if sms[:recipient_nbr] > 0
name = sms[:recipients][:phone]
else
name = get_number_from_address(sms[:sender_address])
end
@by_number[name] = [] unless @by_number[name]
@by_number[name] << sms
end
end
def get_number_from_address(address)
if address =~ /^(\+?\d+)$/
return address
elsif address =~ /\<(\+?\d+)\>/
return $1
else
return false
end
end
end
if $0 == __FILE__
require 'fileutils'
dir = "./messages"
my_name = "yourname"
sms = SMSConverter.new(ARGV[0])
FileUtils.mkdir_p(dir)
sms.by_name.each { |name, messages|
filename = File.join(dir, "#{name}.html")
f = File.open(filename, "w")
f << "<html><body>"
messages.each { |sms|
sent = sms[:recipient_nbr] > 0
message = sms[:subject]
f << "<b>--- #{sent ? my_name : name} (#{sms[:delivery_time].strftime("%H:%M:%S, %a %d-%b-%Y")}) ---</b><br/>"
f << "<pre>#{message.strip}</pre><br/><br/>"
}
f << "</body></html>"
f.close
}
end
I'm a little new to this, but am really interested.
I installed Ruby and then created your ruby script. I then run from command prompt:
convertsms.rb pim.vol convertedsms.htm
but I get the following error. What have I done wrong?
C:\Users\mjt\Desktop>convertsms.rb pim.vol convertedsms.htm
C:/Users/mjt/Desktop/convertsms.rb:67:in `raw2array': undefined method `each_cha
r' for #<String:0x24ee9d4> (NoMethodError)
from C:/Users/mjt/Desktop/convertsms.rb:57:in `initialize'
from C:/Users/mjt/Desktop/convertsms.rb:199:in `new'
from C:/Users/mjt/Desktop/convertsms.rb:199
I'm just supposed to run it on a copy of my pim.vol correct?
Thanks!
You have to install pimbackup on your phone, make a non-binary backup. Download the backup to your computer, unzip it, and run this script on the msgs_<date>.csm file. This script will then create a folder called messages and store all the messages per user in it.
ChaosR said:
You have to install pimbackup on your phone, make a non-binary backup. Download the backup to your computer, unzip it, and run this script on the msgs_<date>.csm file. This script will then create a folder called messages and store all the messages per user in it.
Click to expand...
Click to collapse
Ok, I installed pim backup backed up the messages, copied the file to my computer, extracted the csm file and the following happened when I tried to run it.
C:\Users\mjt\Desktop>ruby convertsms.rb msgs.csm
convertsms.rb:67:in `raw2array': undefined method `each_char' for #<String:0x33e
94c> (NoMethodError)
from convertsms.rb:57:in `initialize'
from convertsms.rb:199:in `new'
from convertsms.rb:199
Thanks!
Heh, it seems on Windows you need to include jcode for each_char to work. Put the new code in. Cheers.
how to convert the binary backup to a non binary backup? other than restoring and backing up.
Relaying SMS
Would it be possible to relay the SMS to another phone when backing up, perhaps as a transfer operation, or by sending SMS via a webservice?

HD2 take only photo with 640x480 when using CameraCaptureDialog

Hi,
I have write an application for the HD2 to take a photo in my application.
But the photo has always a resolution of 640x480 even if I set
ccd.Resolution = new Size(2592, 1552);
My code:
Code:
public void OpenCamera(CameraCaptureMode mode)
{
DateTime timestamp = DateTime.Now;
CameraCaptureDialog ccd = new CameraCaptureDialog();
ccd.InitialDirectory = Config.GetString("UserImageFolder");
if (!System.IO.Directory.Exists(ccd.InitialDirectory))
System.IO.Directory.CreateDirectory(ccd.InitialDirectory);
ccd.Mode = mode;
ccd.StillQuality = CameraCaptureStillQuality.High;
ccd.Resolution = new Size(2592, 1552);
String basename = String.Format("{0:0000}-{1:00}-{2:00} {3:00}{4:00}{5:00} - ", DateTime.Now.Year, DateTime.Now.Month, DateTime.Now.Day, DateTime.Now.Hour, DateTime.Now.Minute, DateTime.Now.Second);
if (Global.SelectedCache != null)
{
basename += Global.RemoveInvalidFatChars(StringUtils.Left(Global.SelectedCache.Name, 32).Trim());
ccd.Title = Global.SelectedCache.Name;
}
String extension = (mode == CameraCaptureMode.Still) ? ".jpg" : ".mp4";
int cnt = 0;
while (System.IO.File.Exists(Config.GetString("UserImageFolder") + "\\" + basename + ((cnt > 0) ? " - " + cnt.ToString() : "") + extension))
cnt++;
ccd.DefaultFileName = basename + ((cnt > 0) ? " - " + cnt.ToString() : "") + extension;
try
{
ccd.ShowDialog();
String name = (Global.SelectedCache != null) ? Global.SelectedCache.Name : "Image";
AnnotateMedia(name, ccd.DefaultFileName, Global.Locator.LastValidPosition, timestamp);
}
catch (Exception exc)
{
#if DEBUG
Global.AddLog("Main.OpenCamera: " + exc.ToString());
#endif
MessageBox.Show("An error occured! Seems as if your device had no camera!", "Error!", MessageBoxButtons.OK, MessageBoxIcon.Exclamation, MessageBoxDefaultButton.Button1);
cameraImageButton.Enabled = false;
cameraVideoButton.Enabled = false;
}
ccd.Dispose();
}
Is anybody out here, who can tell me what I have to do, to change the resolution to the max. (2592x1552) of the HD2?
Thanks a lot and please sorry my bad english.
Andreas
I found the solution
CameraCaptureDialog accept only resolution that define in the registry.
So I modify
[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Pictures\Camera\OEM\PictureResolution\1]
the keys
Height = 1944
Width = 2592
No I can take pictures with 2592x1552 with the code modify
Code:
ccd.Resolution = new Size(2592, 1552);

Can the name of internal flashdrive programmatically found?

Hi,
I want to get out via a MortScript-routine the folder name of the internal flashdrive, e.x. \My Flash Drive. I wrote a routine that looks for all installed drives that are FAT/EXFAT formatted, but that down't help:
Code:
#TestDrivesFATFS.mscr
###########################################################################
#Searches all installed FATFS/exFAT drives except the one this script resides,
#because only those drives MioPocket can be installed on
###########################################################################
#
#Each filesystem is described in registry as
# [HKEY_LOCAL_MACHINE\System\StorageManager\Profiles\<MyProfileName>]
# "DefaultFileSystem"="<MyFileSystem>"
# "Folder"="<MyFolderName>"
Local()
#Obligatory coding as to be found in some MioPocket's scripts
Drive = "\" & Part(SystemPath("ScriptPath"), "\", 2)
#Test starts here
ExcludeDrive = Substr(Drive, 2)
DrivesFATFS = Array()
RegKey = "System\StorageManager\Profiles"
Idx = 0
#Walk the chain of profiles
ForEach variable In RegSubkeys("HKLM", RegKey)
ForEach value, contents In Regvalues("HKLM", RegKey & "\" & variable)
#Some newer CE devices know of exFAT format
If((value eq "DefaultFileSystem") AND (contents ne "FATFS") AND (contents ne "EXFAT"))
Break
EndIf
If((value eq "Folder") AND (contents ne ExcludeDrive))
Idx += 1
DrivesFATFS[Idx] = "\" & contents
EndIf
EndForEach
EndForEach
If(Debug)
ForEach drv in Array(DrivesFATFS)
Message(drv)
EndForeach
EndIf
Any help appriciated. TIA
It can be found in the Registry (at least in my WinMo 6.1... don't know if it's the same way in CE releases or other brands). Look in "HKLM\System\StorageManager\INAND" (or MMC instead of INAND...). The drive name is the "folder" string value).
Thanks for your reply. What I'm searching for is a hint how I can determine per software (MortScript), already having got ( with a piece of code as postet above ) a list of drive-names, which of those is the Storage Card and which is the Flash Drive, not by default knowing of the drive-names, because those differ from device to device.
Running the code above on my device (Medion PNA with CE 5) returns among others the names \Storage Card and/or \My Flash Disk, but this doesn't really help me a lot.
Thanks to all for your interest.
=> SOLVED IT BY MYSELF!
If you are interested in how I did it, here the code to detect the name of SD(HC), MMC, etc card:
Code:
ErrorLevel("warn")
sd = @FindSDDrives()
ForEach drv in Array(sd)
Message(drv)
EndForEach
Sub FindSDDrives()
Local()
SDProfiles = Array()
SDDrives = Array()
SDDrives2 = Array()
#All CE filesystem profiles related to Storage Cards are listet under
#[HKEY_LOCAL_MACHINE\Drivers\SDCARD\ClientDrivers\Class\******]
#E.x. MMC_Class, SDMemory_Class
idx = 0
RegKey = "Drivers\SDCARD\ClientDrivers\Class"
ForEach sdcard In RegSubkeys("HKLM", RegKey)
ForEach value, contents In RegValues("HKLM", RegKey & "\" & sdcard)
If(value eq "Profile")
idx += 1
SDProfiles[idx] = contents
EndIf
EndForEach
EndForEach
#Each CE filesystem is described in registry as
# [HKEY_LOCAL_MACHINE\System\StorageManager\Profiles\<MyProfileName>]
# "DefaultFileSystem"="<MyFileSystem>"
# "Folder"="<MyFolderName>"
# "Name"="<MyName>
idx = 0
RegKey = "System\StorageManager\Profiles"
ForEach profile in Array(SDProfiles)
ForEach value, contents In RegValues("HKLM", RegKey & "\" & profile)
If(value eq "Folder")
idx += 1
SDDrives[idx] = "\" & contents
EndIf
EndForeach
EndForEach
Clear(SDProfiles)
#Remove duplicates
idx = 0
idx2 = 0
prevdrv = ""
ForEach drv in Array(SDDrives)
idx += 1
If(SDDrives[idx] ne prevdrv)
idx2 += 1
prevdrv = SDDrives[idx]
SDDrives2[idx2] = prevdrv
EndIf
EndForEach
Clear(SDDrives)
Return(SDDrives2)
EndSub
Thanks
jwoegerbauer said:
Thanks to all for your interest.
=> SOLVED IT BY MYSELF!
If you are interested in how I did it, here the code to detect the name of SD(HC), MMC, etc card:
Click to expand...
Click to collapse
Usefull for XDA_UC build in like EnergyROMs. Don't try the German ROMs because of copying files from "Storage Crad" vs. "Speicherkarte" . Now thats solved.
Thanks.

Categories

Resources