Page 1 of 2 12 LastLast
Results 1 to 10 of 12

Thread: having trouble with scripting

  1. #1
    Join Date
    Nov 2009
    Location
    Toowoomba QLD Australia.
    Beans
    71
    Distro
    Ubuntu

    having trouble with scripting

    this is just me being a total newb at linux and trying to do something that i would consider more advanced than anything ive done so far

    i'm an avid minecraft player and i play online alot, and i was hoping there would be a way for me to have a shortcut key combination (alt + home prefferably) to call a script that would emulate a set of keystrokes, (t/home <enter>), i know the basic principle of having a script and the key combination to call it, but i want to know how to actually program the script, i have absolutely no idea when it comes to scripting. if anyone could help me out by telling me what to do that would be epic.
    is it a bird? is it a plane? no it's....wait what? it's a nerd?!?

    sudo apt-get install Brain
    package not found.

  2. #2
    Join Date
    Mar 2011
    Location
    U.K.
    Beans
    Hidden!
    Distro
    Ubuntu 22.04 Jammy Jellyfish

    Re: having trouble with scripting

    Try installing autokey through Synaptic Package Manager.

    It is similar to autohotkey in windows.

  3. #3
    Join Date
    Nov 2009
    Location
    Toowoomba QLD Australia.
    Beans
    71
    Distro
    Ubuntu

    Re: having trouble with scripting

    autokey inserts the text but i cant find out how to make it emulate the <enter> keystroke.
    what i need is something that will at the touch of a button type /home and then hit enter of its own accord in the active window. unless theres a way to make autokey do this, i'm guessing i need to rely on a script of some sort.
    is it a bird? is it a plane? no it's....wait what? it's a nerd?!?

    sudo apt-get install Brain
    package not found.

  4. #4
    Join Date
    Mar 2011
    Location
    U.K.
    Beans
    Hidden!
    Distro
    Ubuntu 22.04 Jammy Jellyfish

    Re: having trouble with scripting

    Create New Script .. not .. Create New Phrase (which is for fast typing).

    It is a common mistake.

    Look at Sample Scripts .. not .. My Phrases.

  5. #5
    Join Date
    Nov 2009
    Location
    Toowoomba QLD Australia.
    Beans
    71
    Distro
    Ubuntu

    Re: having trouble with scripting

    thanks. scuse me while i pretend i know what i'm doing
    (no that wasnt sarcasm. seriously i dont have a clue about scripting, but this will help me learn. thanks )
    is it a bird? is it a plane? no it's....wait what? it's a nerd?!?

    sudo apt-get install Brain
    package not found.

  6. #6
    Join Date
    Nov 2009
    Location
    Toowoomba QLD Australia.
    Beans
    71
    Distro
    Ubuntu

    Re: having trouble with scripting

    ok i'm lost. i cannot seem to make this script work from within the minecraft game.
    it works everywhere else. the following code is my failing script. i dont understand why it would work in everything except minecraft. has anyone successfully managed to create a script that does work?

    Code:
    text = clipboard.get_selection()
    keyboard.send_keys("t/home")
    keyboard.send_key("<enter>" )
    is it a bird? is it a plane? no it's....wait what? it's a nerd?!?

    sudo apt-get install Brain
    package not found.

  7. #7
    Join Date
    Mar 2007
    Location
    South Africa
    Beans
    191

    Re: having trouble with scripting

    If it works everywhere else then maybe Minecraft captures the keyboard events so that autokey can't detect your key presses.

    Sorry I don't have a solution for you, I also haven't found one, but it would make sense to give keyboard control to games, don't you think?
    Last edited by Junkieman; June 8th, 2011 at 12:37 PM.

  8. #8
    Join Date
    Nov 2009
    Location
    Toowoomba QLD Australia.
    Beans
    71
    Distro
    Ubuntu

    Re: having trouble with scripting

    Quote Originally Posted by Junkieman View Post
    If it works everywhere else then maybe Minecraft captures the keyboard events so that autokey can't detect your key presses.

    Sorry I don't have a solution for you, I also haven't found one, but it would make sense to give keyboard control to games, don't you think?
    indeed it would. and i should point out that it does indeed type t/home in minecraft. its only the final line of the script that doesnt want to register. perhaps java has a different name for the keystroke? like instead of <enter> maybe i should try <return> or find out the keystroke id for that key?
    is it a bird? is it a plane? no it's....wait what? it's a nerd?!?

    sudo apt-get install Brain
    package not found.

  9. #9
    Join Date
    Mar 2011
    Location
    U.K.
    Beans
    Hidden!
    Distro
    Ubuntu 22.04 Jammy Jellyfish

    Re: having trouble with scripting

    Have you tried the feature "record a keyboard/mouse macro" ?

    Edit > Record Macro (or the fat red button on top panel)

    then record a minecraft session and use the script recorded?

  10. #10
    Join Date
    Nov 2009
    Location
    Toowoomba QLD Australia.
    Beans
    71
    Distro
    Ubuntu

    Re: having trouble with scripting

    recording a macro right out of the game itself...genius. epic idea. shame it gave me the same issue.
    as minecraft is a java game i'm guessing java uses a different name for the key as autokey recorded it as <enter> when i performed the action in game, yet the macro refuses point blank to work properly in the game. i have the key code for the enter key (34) as told by x event viewer.
    is there any way i can use keyboard.send_key with a code instead of a key name? there would be no way java could avoid that, especially if my suspicion is correct and it uses its own key bindings.
    is it a bird? is it a plane? no it's....wait what? it's a nerd?!?

    sudo apt-get install Brain
    package not found.

Page 1 of 2 12 LastLast

Tags for this Thread

Bookmarks

Posting Permissions

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