Discussion Board

Page 1 of 2 12 LastLast
Results 1 to 15 of 29
  1. #1
    Registered User selvynz's Avatar
    Join Date
    Feb 2008
    Posts
    11
    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?

  2. #2
    Nokia Developer Moderator croozeus's Avatar
    Join Date
    May 2007
    Location
    21.46 N 72.11 E
    Posts
    3,650
    Quote Originally Posted by selvynz View Post
    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)

    Code:
    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)
    You can find more information on appswitch in the previous threads. Search for it

    Best Regards
    Croozeus
    Pankaj Nathani
    www.croozeus.com

  3. #3
    Registered User selvynz's Avatar
    Join Date
    Feb 2008
    Posts
    11
    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?

  4. #4
    Nokia Developer Champion gaba88's Avatar
    Join Date
    Feb 2008
    Location
    Ahmedabad, Gujarat, India
    Posts
    3,701
    Quote Originally Posted by selvynz View Post
    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 selvynz
    it will be better for all of us if u clearly mention what u want to do. then the forum will be really helpful to u?

  5. #5
    Registered User selvynz's Avatar
    Join Date
    Feb 2008
    Posts
    11
    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.

  6. #6
    Nokia Developer Champion gaba88's Avatar
    Join Date
    Feb 2008
    Location
    Ahmedabad, Gujarat, India
    Posts
    3,701
    Quote Originally Posted by selvynz View Post
    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 selvynz
    its very easy croozeus has posted the code just compile the code.
    run the file when u will press a key there will be a simulation of the key. if u again not getting the point mail me.

    gaba

  7. #7
    Registered User selvynz's Avatar
    Join Date
    Feb 2008
    Posts
    11
    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

  8. #8
    Registered User neil.young's Avatar
    Join Date
    Nov 2006
    Posts
    568
    What caps does keypress required in order to be installed to c:/sys/bin? NONE is not an option.

    Regards

  9. #9
    Nokia Developer Champion gaba88's Avatar
    Join Date
    Feb 2008
    Location
    Ahmedabad, Gujarat, India
    Posts
    3,701
    Quote Originally Posted by neil.young View Post
    What caps does keypress required in order to be installed to c:/sys/bin? NONE is not an option.

    Regards
    hi neil.young

    if i get your question i think keypress require SWevent capability to get working sucessfully.

    Enjoy Pythoning
    Gaba88

  10. #10
    Nokia Developer Champion gaba88's Avatar
    Join Date
    Feb 2008
    Location
    Ahmedabad, Gujarat, India
    Posts
    3,701
    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

  11. #11
    Registered User neil.young's Avatar
    Join Date
    Nov 2006
    Posts
    568
    Thanks. But it doesn't explain, how to put the keypress module down to a 3rd ed phone... Brainsick, all that...

  12. #12
    Nokia Developer Moderator bogdan.galiceanu's Avatar
    Join Date
    Oct 2007
    Location
    Deva, Romania
    Posts
    3,471
    Quote Originally Posted by neil.young View Post
    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?

  13. #13
    Registered User neil.young's Avatar
    Join Date
    Nov 2006
    Posts
    568
    Not yet, but right now. Same problem. Do I have to sign it with my devcert?

  14. #14
    Nokia Developer Moderator bogdan.galiceanu's Avatar
    Join Date
    Oct 2007
    Location
    Deva, Romania
    Posts
    3,471
    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.

  15. #15
    Registered User neil.young's Avatar
    Join Date
    Nov 2006
    Posts
    568
    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)

Page 1 of 2 12 LastLast

Similar Threads

  1. Replies: 8
    Last Post: 2009-07-28, 03:38
  2. Replies: 2
    Last Post: 2007-10-18, 00:02
  3. How to filter keypress belonging to foreground app
    By Donnieng in forum Symbian C++
    Replies: 1
    Last Post: 2007-07-09, 04:09
  4. about the keypress
    By yahyah_yy in forum Symbian C++
    Replies: 2
    Last Post: 2004-02-04, 16:34
  5. keypress simultaneous problem
    By lekboon in forum Mobile Java General
    Replies: 2
    Last Post: 2003-07-13, 15:57

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Nokia Developer aims to help you create apps and publish them so you can connect with users around the world.

京ICP备05048969号  © Copyright Nokia 2013 All rights reserved