Can you tell me how to simulate keypress for an application on my mobile?We have keypress module and appswitch module but not sure of how to use it.We are using 3rd edition of s60 and pys60.We want to generate a keypress event,can you please help?
Can you tell me how to simulate keypress for an application on my mobile?We have keypress module and appswitch module but not sure of how to use it.We are using 3rd edition of s60 and pys60.We want to generate a keypress event,can you please help?
Hi Selvynz,
You should search the Forum for similar topics before posting...
Such answers already exists in the previous threads
Here is an example of Keypress (from a previous post)
You can find more information on appswitch in the previous threads. Search for itCode:from key_modifiers import * from key_codes import * import keypress # Display "a" keypress.simulate_key(EKey1,EKey1) # Display "1" keypress.simulate_key_mod(EKey1,EKey1,EModifierKeypad)
Best Regards
Croozeus
Pankaj Nathani
www.croozeus.com
Thank you so much.I went through the forum and got some examples already.Can you please tell as to how i can get a compliled .PYD files?
This is what i did-
*******************
1.I installed 3rd edition of symbian SDK.
2.I installed 3rd edition of python pys60 for symbian.
3.To import keypress module i donloaded and copied keypress.PYD in winscw\c\sys\bin and keymodifiers.py in winscw\c\sys\resource.
4.In ressource folder i created a keypress.py file that includes the following lines:
import e32
if e32.s60_version_info>=(3,0):
import imp
_keypress = imp.load_dynamic('_keypress', 'c:\\sys\\bin\\_keypress.pyd')
else:
import _keypress
del e32, imp #remove unnecessary names from namespace
from _keypress import *
del _keypress
Below is our code to check keypress
**********************************
from key_codes import *
import keypress
# Display "a"
keypress.simulate_key(EKey1,EKey1)
This is the code i wrote however i am not getting the expected output
'1'.
Should i add any module other than keypress module?
Hi,
I want to currently write a script to to simulate keypress.I have installed 3rd edition of s60 on my PC and third edition of pys60 on the emulator.Now python script works on the emulator.However,i need a python script that would simulate keypress in the emulator.I tried by downloading the keypress module(i.e, keypress folder) to get this done however i am unable to understand how this actually works and where to put the keypress folder.I am stuck with this please help me out.
Hi gaba,
Thank you very much for the help.I had problems in compiling the keypress.pyd and this was solved.Will keep you posted as and when i need help.
Selvyn
What caps does keypress required in order to be installed to c:/sys/bin? NONE is not an option.
Regards
Gargi Das- http://gargidas.blogsot.com
Forum Nokia Python Wiki
Learn Python at http://mobapps.org/PyS60
Hi neil.young
i forgot to give a link which can be very useful. This article at the wiki explains about capabilities in python.
Have a look at it.
Enjoy Pythoning
Gaba88
Gargi Das- http://gargidas.blogsot.com
Forum Nokia Python Wiki
Learn Python at http://mobapps.org/PyS60
Thanks. But it doesn't explain, how to put the keypress module down to a 3rd ed phone... Brainsick, all that...
So... are you having problems installing keypress? Have you tried keypress 1.06?
Not yet, but right now. Same problem. Do I have to sign it with my devcert?
Well, the version I gave the link to is unsigned so yes, you have to sign it (either with devcert or Open Signed Online).
I suggest you try the following: go to Symbian's Open Signed Online. Enter the information there (IMEI, email, all the capabilities and security code) and submit keypress. In a few moments you'll get an email asking you to confirm your request and then another one with the download link. Download and try to install the signed version.
Yes, thanks. This works.
I tried a small sample (provided by Cyke), but I'm not sure, what shall happen (it happens nothing, actually):
from key_codes import *
import keypress
# Display "a"
keypress.simulate_key(EKey1,EKey1)
# Display "1"
keypress.simulate_key_mod(EKey1,EKey1,EModifierKeypad)