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

Thread: HOWTO keyboard macros macro in linux

  1. #1
    Join Date
    Oct 2005
    Location
    India
    Beans
    87
    Distro
    Kubuntu 6.06

    HOWTO keyboard macros macro in linux

    Yup, its indeed possible to have system-wide application independent macros in unix! thanks to xmacros and whoever who wrote a guide somehere i don't remember.

    Step 1. Install the app
    aptitude install xmacro
    Step 2. Record the macro:
    xmacrorec -d 1400 > ~/quote
    wait...
    Step 3. xmacro isn't perfect so open ~/quote for editing, as many lines are repeated and need to be removed.
    Step 4. Replay the macro
    cat ~/quote | xmacroplay ":0.0"
    Basically xmacroplay plays the commands from a text file.The text file can be written manually or by the above recording method. Reading the examplbelow should make it all very easy.
    EXAMPLE
    Delay 1 # Always add this!!
    KeyStrPress bracketleft
    KeyStrRelease bracketleft
    String quote
    KeyStrPress bracketright
    KeyStrRelease bracketright
    KeyStrPress bracketleft
    KeyStrRelease bracketleft
    KeyStrPress slash
    KeyStrRelease slash
    String quote
    KeyStrPress bracketright
    KeyStrRelease bracketright
    Delay 1 #delay
    KeyStrRelease Left
    KeyStrPress Left
    KeyStrRelease Left
    KeyStrPress Left
    KeyStrRelease Left
    KeyStrPress Left
    KeyStrRelease Left
    KeyStrPress Left
    KeyStrRelease Left
    KeyStrPress Left
    KeyStrRelease Left
    KeyStrPress Left
    KeyStrRelease Left
    KeyStrPress Left
    KeyStrRelease Left
    KeyStrPress Lef
    The above types [ q u o t e ] [ / q u o t e ] followed by 8 'left arrow' keys so that the cursor is between [qote] & [/quote] priceless..

    Example 2
    Delay 1 #delay
    Sending a hotkey - Ctrl + g
    KeyStrPress Control_R
    KeyStrPress g KeyStrRelease g
    KeyStrRelease Control_R
    === Problems?
    1. Read the last 4 topics on http://xmacro.sourceforge.net/ for a better understanfing of the macro file. its simple btw
    2. try adding a lil delay (look in above example for how)
    3. How to play the macro?? You can use xbindkeys/khotkeys(kdeonly) to assign a shortcut for the macro.
    Last edited by grizzly; November 17th, 2006 at 11:42 PM.
    End the hassle of typing ls!!
    Get a list of files/folders of the current directory of the shell you are running !!
    VIEWGLOB! - SCREENSHOT
    -- works with bash and zsh

  2. #2
    Join Date
    Nov 2005
    Location
    Ester, AK, USA
    Beans
    162
    Distro
    Ubuntu 10.04 Lucid Lynx

    Re: HOWTO keyboard macros macro in linux

    There's a new GUI alternative I would love to see in the repos: JW_Record_Playback. How do we request such things, since it's apparently not appropriate for the backports/repository forum?
    If you torture data hard enough, they will confess to anything

  3. #3
    Join Date
    May 2006
    Location
    NH, USA
    Beans
    58
    Distro
    Ubuntu 7.04 Feisty Fawn

    Arrow Re: HOWTO keyboard macros macro in linux

    thanks for the example, but how do you stop the macrorec?

    Code:
    xmacrorec -d 1400 > ~/quote
    I see "-d 1400" is delay rec by 1.4 sec
    and "> ~/quote" is save macro file to quote

    but don't we need a quit rec key?
    I can't find this anywhere, thanks.

    PS I did get xmacroplay to replay my hand typed script into an open doc:
    Code:
    Delay 1 # Always add this!!
    String mikemason.org
    KeyStrPress Return
    KeyStrRelease Return
    String my web address
    Not much, but a test
    8.10 on Compaq Presario, P4,1.50GHz, 512 ram, Desktop, lan, HP D4160 printer

    mikemason.org + mikemason.us

  4. #4
    Join Date
    Sep 2007
    Location
    England
    Beans
    29
    Distro
    Ubuntu Studio 10.10 Maverick Meerkat

    Re: HOWTO keyboard macros macro in linux

    Would this program be useful if you wanted to have quick keyboard shortcuts to enter a string of text or character not on your keyboard?

    For example, could I use CTL-ALT-a to put a "à" into any text field in any open program? And say, CTL-ALT-SHIFT-A to put a "À" into any text field in any open program?

    Any help much appreciated !
    Last edited by James7; September 8th, 2007 at 05:57 PM.

  5. #5
    Join Date
    May 2006
    Location
    NH, USA
    Beans
    58
    Distro
    Ubuntu 7.04 Feisty Fawn

    Re: HOWTO keyboard macros macro in linux

    Not from what i see, I tried to set hotkeys (keyboard shortcuts) but they would not run the command lines needed ie: (cat testing.macro | xmacroplay -d 100 :0)

    So I have to Alt+F2 then type "cat testing.macro | xmacroplay -d 100 :0"
    8.10 on Compaq Presario, P4,1.50GHz, 512 ram, Desktop, lan, HP D4160 printer

    mikemason.org + mikemason.us

  6. #6
    Join Date
    Sep 2007
    Location
    England
    Beans
    29
    Distro
    Ubuntu Studio 10.10 Maverick Meerkat

    Re: HOWTO keyboard macros macro in linux

    Thanks, mate, this looks a bit beyond me. I was looking for a way to do what KeyText does in Windows. Perhaps there is another program out there....

  7. #7
    Join Date
    Sep 2007
    Beans
    47

    Re: HOWTO keyboard macros macro in linux

    This definately looks promising and I will definately try it out when I get my system76 laptop or my macmini back up. In the meantime, I am curious about doing dynamic thing in the macros like having a date print out for dating a note.

    i.e.

    This is a note

    type key shortcut and the date is filled in at cursor.

    2007-09-07 - This is a note

  8. #8
    Join Date
    May 2006
    Location
    NH, USA
    Beans
    58
    Distro
    Ubuntu 7.04 Feisty Fawn

    Re: HOWTO keyboard macros macro in linux

    I don't think xmacro can do that.
    8.10 on Compaq Presario, P4,1.50GHz, 512 ram, Desktop, lan, HP D4160 printer

    mikemason.org + mikemason.us

  9. #9
    Join Date
    Jul 2007
    Beans
    58
    Distro
    Ubuntu 9.04 Jaunty Jackalope

    Re: HOWTO keyboard macros macro in linux

    This is awesome!

    Here is a page of all the keys to help you write your own. Just take off the "XK_" before each one.

    In Compiz Settings, if you go to General Options, and then to the commands tab, you can fire off events on keyboard short cuts.
    For example, I have set it so that I can write my email address super-fast (for forms and stuff). So in one of the Command boxes I have written

    Code:
    cat ~/path/to/macro | xmacroplay ":0.0"
    and then in the corresponding Key Bindings box, I have "<super> apostrophe", so now when I press Super+' it'll type my email address.

    The possibilities are endless!

  10. #10
    Join Date
    Feb 2008
    Beans
    2

    Re: HOWTO keyboard macros macro in linux

    Oh man, I am finally gonna pwn at Armagetron...

Page 1 of 2 12 LastLast

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
  •