Jump to content
Sign in to follow this  

Using keyboard shortcuts?

Recommended Posts


Started with AutoIt just some hours ago so please be gentle with me.

So here's the deal: I'm writing a program to control a music player. This player uses keyboard shortcuts. This brings me two problems.

  • How to "translate" certain key combinations to another set of keys (e.g alt+up = ctrl+up)
  • What key to use? ctrl, Alt and those keys are used in way to many programs already and would just cause problems.

Any suggestions?


PS: sorry for my broken english. I'm Norwegian :blink:

Share this post

Link to post
Share on other sites

Hi and Welcome to the forums!

Nice to see a neighbor here, I'm from Sweden (your English seems fine to me).

Some general tips:

The helpfile for AutoIt is ridiculously good, you can find pretty much anything there so make it your best friend. You can start it by pressing F1 (if you're in SciTE (the editor)) or by opening your start-menu and going to "AutoIt v3\AutoIt Help File".

There exists multiple tutorials to help you learn AutoIt, even video ones on Youtube! They are listed in the wiki, here.

Now for your questions:

1. The easiest would be HotKeySet() and Send(). There is an example in the helpfile for both, as with most functions.

Here's a short example that sets Shift+Up as a HotKey and Send's Ctrl+Up

#Include <Misc.au3>

HotKeySet("!{up}", "_SomeFunc")   ;Alt is not a very good key so I use Shift instead (pressing/holding Alt will activate the Menu if one is there, try it in Notepad and you'll see)

While 1

Func _SomeFunc()

2. Use some other key that you rarely use then? Like Win' or Win|. Let you imagination flow free and I'm sure it can come up with some keys you rarely use.

Edited by AdmiralAlkex

Share this post

Link to post
Share on other sites

A line like this is basically the same as hitting the 'v' key in the AIMP Music Player, but with the ControlSend command, most apps don't even need to be active..

If ProcessExists("AIMP2.exe") Then ControlSend("AIMP2", "", "TAIMPDockSkinFixed1", "v")

The AutoIt Window Info Tool (AU3Info) is invaluable.

This line will work the same, with both Winamp and AIMP, if this UDF, Winamp Library [on pure AutoIt], is used.

If ProcessExists("winamp.exe") Or ProcessExists("AIMP2.exe") Then _Winamp_Stop()

- Bruce /*somdcomputerguy */  If you change the way you look at things, the things you look at change.

Share this post

Link to post
Share on other sites

Ok. I've used the last hours just reading, trying to get a grip on this and, I got an idea!

I am thinking about using a keyboard shortcut (alt+shift+Z or something) To open a GUI then send the keyboard shortcuts.

Example: The user presses alt+shift+Z And gets a window telling them what song is playing and a list of hotkeys. This will require the window to be open to send keystrokes but, I think it would be easier this way... What do you think?

And I know this will make me sound like a moron but, could someone give me an example how to do this? 'cause I have no clue...

I'm quite new to programming in general so thanks for all help you have given and will give me

Share this post

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

  • Recently Browsing   0 members

    No registered users viewing this page.

  • Create New...