Results 1 to 12 of 12

Thread: Need help with ascii char keypress

  1. #1
    Join Date
    Oct 2014
    Posts
    30
    Mentioned
    0 Post(s)
    Quoted
    12 Post(s)

    Default Need help with ascii char keypress

    Hi everyone. I'm using Simba to automate some tasks. I need to do a PressKey with print_screen modified by ctrl.

    At first I thought doing the following would basically work
    KeyDown((ascii dec.)ctrl)
    PressKey((ascii dec.)Print_screen)
    KeyUp((ascii dec)ctrl)

    but there isn't an ascii code for ctrl since it is a modifier. I've tried looking up solutions in other languages but there really isn't much about throwing a modified keypress. Plenty on checking keyEvents thrown for a modifier though.

    Does anyone have a solution? I really want to have Simba automate a Ctrl+Print_Screen key press.

    Any help is greatly appreciated.

  2. #2
    Join Date
    Nov 2007
    Location
    46696E6C616E64
    Posts
    3,069
    Mentioned
    44 Post(s)
    Quoted
    302 Post(s)

    Default

    Simba Code:
    vk_control  17
    vk_printscreen  154
    There used to be something meaningful here.

  3. #3
    Join Date
    Oct 2014
    Location
    With ezreal~
    Posts
    295
    Mentioned
    45 Post(s)
    Quoted
    255 Post(s)

    Default

    Google searches are op ,
    If you need more than those two keys have this table:
    http://msdn.microsoft.com/en-us/libr...=vs.85%29.aspx



    It's not gay if it's efficient.

  4. #4
    Join Date
    Jan 2010
    Posts
    5,227
    Mentioned
    6 Post(s)
    Quoted
    60 Post(s)

    Default

    Quote Originally Posted by pizzapants View Post
    Google searches are op ,
    If you need more than those two keys have this table:
    http://msdn.microsoft.com/en-us/libr...=vs.85%29.aspx
    While Google is helpful, the link to the MSDN about virtual key codes isn't relevant to the question asked. Simba does not follow Microsoft's scheme for VK codes. You can't assume that either the name or hex representation is correct to use for Simba. You should use the VK_* variables for Simba.

  5. #5
    Join Date
    Feb 2011
    Location
    The Future.
    Posts
    5,600
    Mentioned
    396 Post(s)
    Quoted
    1598 Post(s)

    Default

    Quote Originally Posted by i luffs yeww View Post
    While Google is helpful, the link to the MSDN about virtual key codes isn't relevant to the question asked. Simba does not follow Microsoft's scheme for VK codes. You can't assume that either the name or hex representation is correct to use for Simba. You should use the VK_* variables for Simba.

    This is incorrect. Simba does follow the Virtual Key codes for all ASCII codes:


    http://docs.villavu.com/simba/script...d-virtual-keys compared to: http://msdn.microsoft.com/en-us/libr...=vs.85%29.aspx


    Exact same. It is SMART that does not follow all the ASCII codes: https://github.com/BenLand100/SMART/issues/7

    IIRC, it's only the enter key that is different: https://github.com/BenLand100/SMART/...Nazi.java#L431


    SRL takes care of it by using a compiler directive with key functions to determine which keys to use: https://github.com/SRL/SRL-6/blob/ma...ext.simba#L221

    So there's no confusion.

    @Olly; I'm tagging you so you can fix it.. Whoever re-wrote SRL-6 messed up one function: https://github.com/SRL/SRL-6/blob/ma...ext.simba#L251

    which uses KeyDown explicitly.. It does not use the directive and so, it won't work for the Return-Key if using SMART.
    Last edited by Brandon; 01-06-2015 at 07:57 AM.
    I am Ggzz..
    Hackintosher

  6. #6
    Join Date
    Oct 2014
    Posts
    30
    Mentioned
    0 Post(s)
    Quoted
    12 Post(s)

    Default

    Thank you everyone. I've got it working now. Lots of awesome info!

  7. #7
    Join Date
    Jan 2010
    Posts
    5,227
    Mentioned
    6 Post(s)
    Quoted
    60 Post(s)

    Default

    Quote Originally Posted by Brandon View Post
    This is incorrect. Simba does follow the Virtual Key codes for all ASCII codes:


    http://docs.villavu.com/simba/script...d-virtual-keys compared to: http://msdn.microsoft.com/en-us/libr...=vs.85%29.aspx


    Exact same. It is SMART that does not follow all the ASCII codes: https://github.com/BenLand100/SMART/issues/7

    IIRC, it's only the enter key that is different: https://github.com/BenLand100/SMART/...Nazi.java#L431


    SRL takes care of it by using a compiler directive with key functions to determine which keys to use: https://github.com/SRL/SRL-6/blob/ma...ext.simba#L221

    So there's no confusion.

    @Olly; I'm tagging you so you can fix it.. Whoever re-wrote SRL-6 messed up one function: https://github.com/SRL/SRL-6/blob/ma...ext.simba#L251

    which uses KeyDown explicitly.. It does not use the directive and so, it won't work for the Return-Key if using SMART.
    My mistake. I was going off of what Frement said was the code for print screen, but he must have had a typo. I assumed they were different because his "vk_printscreen: 154" information didn't match with what I thought it should've been. For one, there is nothing assigned to 0x9A, and there is no virtual key called "printscreen."

    Sorry.

  8. #8
    Join Date
    Feb 2011
    Location
    The Future.
    Posts
    5,600
    Mentioned
    396 Post(s)
    Quoted
    1598 Post(s)

    Default

    Quote Originally Posted by i luffs yeww View Post
    There is no virtual key called "printscreen." You should use the VK_* variables for Simba.

    Ahh just a mistake. No harm done. However:

    MSDN:
    VK_SNAPSHOT: 0x2C -> 44

    SIMBA:
    SNAPSHOT: 44 -> 0x2C

    You're right OP should use the VK keycodes instead of guessing the numbers.
    I am Ggzz..
    Hackintosher

  9. #9
    Join Date
    Jan 2010
    Posts
    5,227
    Mentioned
    6 Post(s)
    Quoted
    60 Post(s)

    Default

    Quote Originally Posted by Brandon View Post
    Ahh just a mistake. No harm done. However:

    MSDN:
    VK_SNAPSHOT: 0x2C -> 44

    SIMBA:
    SNAPSHOT: 44 -> 0x2C

    You're right OP should use the VK keycodes instead of guessing the numbers.
    I know that it's called snapshot I just meant there is literally no constant with the name "VK_PrintScreen" as suggested by Frement. I asked him about it and he told me that those are actually Java constants.

  10. #10
    Join Date
    Mar 2013
    Posts
    13
    Mentioned
    0 Post(s)
    Quoted
    2 Post(s)

    Default

    Quote Originally Posted by Brandon View Post
    This is incorrect. Simba does follow the Virtual Key codes for all ASCII codes:


    http://docs.villavu.com/simba/script...d-virtual-keys compared to: http://msdn.microsoft.com/en-us/libr...=vs.85%29.aspx


    Exact same. It is SMART that does not follow all the ASCII codes: https://github.com/BenLand100/SMART/issues/7

    IIRC, it's only the enter key that is different: https://github.com/BenLand100/SMART/...Nazi.java#L431


    SRL takes care of it by using a compiler directive with key functions to determine which keys to use: https://github.com/SRL/SRL-6/blob/ma...ext.simba#L221

    So there's no confusion.

    @Olly; I'm tagging you so you can fix it.. Whoever re-wrote SRL-6 messed up one function: https://github.com/SRL/SRL-6/blob/ma...ext.simba#L251

    which uses KeyDown explicitly.. It does not use the directive and so, it won't work for the Return-Key if using SMART.

    @Brandon Sorry for bumping this old thread but if I am doing this right, this still isn't fixed. I can't get my script to press down the enter key.. What number or word am I supposed to use in the KeyDown(); function?

    I am able to use the arrow keys so I know it's not something on my end.
    Last edited by Dmox; 05-16-2015 at 05:02 AM.

  11. #11
    Join Date
    Sep 2006
    Posts
    36
    Mentioned
    0 Post(s)
    Quoted
    13 Post(s)

    Default

    Quote Originally Posted by Dmox View Post
    @Brandon Sorry for bumping this old thread but if I am doing this right, this still isn't fixed. I can't get my script to press down the enter key.. What number or word am I supposed to use in the KeyDown(); function?

    I am able to use the arrow keys so I know it's not something on my end.
    I tried "vk_return" and it worked on a notepad.

  12. #12
    Join Date
    Mar 2013
    Posts
    13
    Mentioned
    0 Post(s)
    Quoted
    2 Post(s)

    Default

    Quote Originally Posted by woo hoo View Post
    I tried "vk_return" and it worked on a notepad.
    Yeah it is sending the key because I tested to see if it's sending the key by using "if isKeyDown(vk_return) then WriteLn('Enter is down')", but for some reason the SMART client won't receive the enter key. It will receive other keys but not the enter one..

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •