corgano Posted June 21, 2009 Share Posted June 21, 2009 (edited) 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 July 22, 2009 by corgano 0x616e2069646561206973206c696b652061206d616e20776974686f7574206120626f64792c20746f206669676874206f6e6520697320746f206e657665722077696e2e2e2e2e Link to comment Share on other sites More sharing options...
colafrysen Posted June 21, 2009 Share Posted June 21, 2009 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] Link to comment Share on other sites More sharing options...
corgano Posted June 21, 2009 Author Share Posted June 21, 2009 Why did this not work? HotKeySet("{SLEEP}","asd") Func asd() beep(3000,700) EndFunc 0x616e2069646561206973206c696b652061206d616e20776974686f7574206120626f64792c20746f206669676874206f6e6520697320746f206e657665722077696e2e2e2e2e Link to comment Share on other sites More sharing options...
colafrysen Posted June 21, 2009 Share Posted June 21, 2009 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. [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] Link to comment Share on other sites More sharing options...
corgano Posted June 21, 2009 Author Share Posted June 21, 2009 First, was this the whole script? you will need a While... Wend to keep it alive. check that first. 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 Link to comment Share on other sites More sharing options...
colafrysen Posted June 21, 2009 Share Posted June 21, 2009 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 [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] Link to comment Share on other sites More sharing options...
corgano Posted July 22, 2009 Author Share Posted July 22, 2009 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 Link to comment Share on other sites More sharing options...
bogQ Posted July 23, 2009 Share Posted July 23, 2009 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 connectionAu3 oIrrlicht - Irrlicht projectAu3impact - Another 3D DLL game engine for autoit. (3impact 3Drad related) 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. Link to comment Share on other sites More sharing options...
corgano Posted October 2, 2009 Author Share Posted October 2, 2009 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 Link to comment Share on other sites More sharing options...
bogQ Posted October 3, 2009 Share Posted October 3, 2009 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 connectionAu3 oIrrlicht - Irrlicht projectAu3impact - Another 3D DLL game engine for autoit. (3impact 3Drad related) 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. Link to comment Share on other sites More sharing options...
ResNullius Posted October 3, 2009 Share Posted October 3, 2009 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") Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now