Hello, I've just gotten OpenSuSE 11.0 installed and configured almost how I want it. I switched my secondary computer over from windows and have run into a small roadblock.

I normally use a program called AutoHotKey in windows for simple scripts & macros. Through the research I've done, xautomation seems to be the closest thing I can get to AutoHotKey, but I'm not exactly sure how to set up a script to accomplish what I want.

An example of a script I use in AutoHotKey:
Code:
#InstallKeybdHook
#InstallMouseHook
#MaxThreadsPerHotkey 3
XButton2::
#MaxThreadsPerHotkey 1
if KeepXButton2Running
{
    KeepXButton2Running := false
    return
}
; Otherwise:
KeepXButton2Running := true
Loop
{
    Send, 2
	Sleep, 5000
    if not KeepXButton2Running
        break
}
KeepXButton2Running := false
return
Basically what this does is, when I click button 5 (defined as XButton2) on my mouse, the loop will begin processing.

In this example, I'm simply sending (simulating) the 2 key (standard 2 key, not numpad 2) being pressed (and released) every 5 seconds infinitely until I press mouse button 5 (defined as XButton2) again.

I have several other scripts & macros that I need as well, but feel if I can get this one working I'll be fine getting everything else set up.

I'm very new to scripting in sh, perl, etc and have only come up with the following:
Code:
#!/bin/sh
while:
    xte "keydown 2" "keyup 2"
    sleep 5
done
I receive a few syntax errors (as expected since this is new for me) and don't know how to proceed. I should note though that I think I'm on the right track, before the script dies the 2 key is being sent twice; but only twice.

Here's the output when I run the script:
Code:
keldek:~/Documents> sh test.sh
test.sh line 3: while:: command not found
2
test.sh: line 7: syntax error near unexpected token `done'
test.sh: line 7: `done
keldek:~/Documents>2
Notice the 2 key is being sent twice, so I think (hope) I'm at least close to being on the right track lol.

Now, the script I use in autohotkey uses the input of button 5 on my mouse, to keep things simple the trigger can be a keypress instead... for instance, if I press Ctrl + F1 the loop would process until I press Ctrl + F1 again.

If this is not doable, let's say I start the loop with Ctrl + F1, and end the loop with Ctrl + F2.

I'd even settle for no trigger key, and the loop running indefinitely until I kill the script.

Any and all help on this matter is greatly appreciated, and I'm open to all suggestions and feedback.

Thanks