Jump to content
Sign in to follow this  
corgano

Changeing keyboard function buttons

Recommended Posts

corgano

I have a keyboard that has several function buttons, such as sleep, mail, and search. How would I use autoit to change the function the buttons do?

Like what if I wanted the sleep button to launch a file I have on desktop instead, How would I do this?

*UPDATE*

I have this script, it will run the function, but it will also sleep. How do i make it run the func WITHOUT sleeping?

HotKeySet("{SLEEP}","asd")

Func asd()
    beep(3000,700)
EndFunc

While 1 
    Sleep(120)
WEnd
Edited by corgano

0x616e2069646561206973206c696b652061206d616e20776974686f7574206120626f64792c20746f206669676874206f6e6520697320746f206e657665722077696e2e2e2e2e

Share this post


Link to post
Share on other sites
colafrysen

I have a keyboard that has several function buttons, such as sleep, mail, and search. How would I use autoit to change the function the buttons do?

Like what if I wanted the sleep button to launch a file I have on desktop instead, How would I do this?

the buttons are standard buttons that you can use in _ispressed() and HotKeySet() so if you disable the default behavior. you can create your own in AutoIt

Here are the button codes (from chapter "Send Key List" in the helpfile)

{BROWSER_BACK} 2000/XP Only: Select the browser "back" button 
{BROWSER_FORWARD} 2000/XP Only: Select the browser "forward" button 
{BROWSER_REFRESH} 2000/XP Only: Select the browser "refresh" button 
{BROWSER_STOP} 2000/XP Only: Select the browser "stop" button 
{BROWSER_SEARCH} 2000/XP Only: Select the browser "search" button 
{BROWSER_FAVORITES} 2000/XP Only: Select the browser "favorites" button 
{BROWSER_HOME} 2000/XP Only: Launch the browser and go to the home page 
{VOLUME_MUTE} 2000/XP Only: Mute the volume 
{VOLUME_DOWN} 2000/XP Only: Reduce the volume 
{VOLUME_UP} 2000/XP Only: Increase the volume 
{MEDIA_NEXT} 2000/XP Only: Select next track in media player 
{MEDIA_PREV} 2000/XP Only: Select previous track in media player 
{MEDIA_STOP} 2000/XP Only: Stop media player 
{MEDIA_PLAY_PAUSE} 2000/XP Only: Play/pause media player 
{LAUNCH_MAIL} 2000/XP Only: Launch the email application 
{LAUNCH_MEDIA} 2000/XP Only: Launch media player 
{LAUNCH_APP1} 2000/XP Only: Launch user app1 
{LAUNCH_APP2} 2000/XP Only: Launch user app2

[font="Impact"]Use the helpfile, It´s one of the best exlusive features of Autoit.[/font]http://support.microsoft.com/kb/q555375ALIBI Run - a replacement for the windows run promptPC Controller - an application for controlling other PCs[size="1"]Science flies us to the moon. Religion flies us into buildings.[/size][size="1"]http://bit.ly/cAMPZV[/size]

Share this post


Link to post
Share on other sites
corgano

Why did this not work?

HotKeySet("{SLEEP}","asd")

Func asd()
    beep(3000,700)
EndFunc

0x616e2069646561206973206c696b652061206d616e20776974686f7574206120626f64792c20746f206669676874206f6e6520697320746f206e657665722077696e2e2e2e2e

Share this post


Link to post
Share on other sites
colafrysen

Why did this not work?

HotKeySet("{SLEEP}","asd")

Func asd()
    beep(3000,700)
EndFunc

First, was this the whole script? you will need a While... Wend to keep it alive.

check that first. :D


[font="Impact"]Use the helpfile, It´s one of the best exlusive features of Autoit.[/font]http://support.microsoft.com/kb/q555375ALIBI Run - a replacement for the windows run promptPC Controller - an application for controlling other PCs[size="1"]Science flies us to the moon. Religion flies us into buildings.[/size][size="1"]http://bit.ly/cAMPZV[/size]

Share this post


Link to post
Share on other sites
corgano

First, was this the whole script? you will need a While... Wend to keep it alive.

check that first. :D

DO'H

Sorry bout that. This will beep, but then it sleeps. I want it to beep WITHOUT sleeping.

HotKeySet("{SLEEP}","asd")

Func asd()
    beep(3000,700)
EndFunc

While 1 
    Sleep(120)
WEnd

0x616e2069646561206973206c696b652061206d616e20776974686f7574206120626f64792c20746f206669676874206f6e6520697320746f206e657665722077696e2e2e2e2e

Share this post


Link to post
Share on other sites
colafrysen

Well i am afraid i cant help you beyond this point, i guess you will need to tweak the registry or something. try google

Good luck :D


[font="Impact"]Use the helpfile, It´s one of the best exlusive features of Autoit.[/font]http://support.microsoft.com/kb/q555375ALIBI Run - a replacement for the windows run promptPC Controller - an application for controlling other PCs[size="1"]Science flies us to the moon. Religion flies us into buildings.[/size][size="1"]http://bit.ly/cAMPZV[/size]

Share this post


Link to post
Share on other sites
corgano

This code will run the func then sleep. How do I make it run the code WITHOUT sleeping?

HotKeySet("{SLEEP}","asd")

Func asd()
    beep(3000,700)
EndFunc

While 1 
    Sleep(120)
WEnd

0x616e2069646561206973206c696b652061206d616e20776974686f7574206120626f64792c20746f206669676874206f6e6520697320746f206e657665722077696e2e2e2e2e

Share this post


Link to post
Share on other sites
bogQ

try beeping on any smaller time in main loop and combinate it with _Timer_Diff to stop :)


TCP server and client - Learning about TCP servers and clients connection
Au3 oIrrlicht - Irrlicht project
Au3impact - Another 3D DLL game engine for autoit. (3impact 3Drad related)



460px-Thief-4-temp-banner.jpg
There are those that believe that the perfect heist lies in the preparation.
Some say that it’s all in the timing, seizing the right opportunity. Others even say it’s the ability to leave no trace behind, be a ghost.

 

Share this post


Link to post
Share on other sites
corgano

try beeping on any smaller time in main loop and combinate it with _Timer_Diff to stop :)

That does not help me at all.

Bumping my unsolved topic. This code will run the function, but the computer still sleeps. Anyone know of a way to make the button do something else without sleeping?

HotKeySet("{SLEEP}","asd")

Func asd()
    beep(3000,700)
EndFunc

While 1 
    Sleep(120)
WEnd

0x616e2069646561206973206c696b652061206d616e20776974686f7574206120626f64792c20746f206669676874206f6e6520697320746f206e657665722077696e2e2e2e2e

Share this post


Link to post
Share on other sites
bogQ

Until the func Beep() is done i think that script is paused that is why i sugeted to try beeping on smaller time intervals in main loop multiply times with no sleep() and to limit the max beep time with timediff


TCP server and client - Learning about TCP servers and clients connection
Au3 oIrrlicht - Irrlicht project
Au3impact - Another 3D DLL game engine for autoit. (3impact 3Drad related)



460px-Thief-4-temp-banner.jpg
There are those that believe that the perfect heist lies in the preparation.
Some say that it’s all in the timing, seizing the right opportunity. Others even say it’s the ability to leave no trace behind, be a ghost.

 

Share this post


Link to post
Share on other sites
ResNullius

That does not help me at all.

Bumping my unsolved topic. This code will run the function, but the computer still sleeps. Anyone know of a way to make the button do something else without sleeping?

HotKeySet("{SLEEP}","asd")

Func asd()
    beep(3000,700)
EndFunc

While 1 
    Sleep(120)
WEnd

If this is just for your computer, and you don't need to re-enable the Sleep Action through your code, look at changing the "Change what happens when I press the Sleep button" in the Advanced section of Windows Power Options in the Control Panel.

(Try setting it to "do nothing")

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  

×