jlroper Posted September 7, 2010 Posted September 7, 2010 I'm using a program in which the <Enter> key is used to signify an end of a particular region. Since the program doesn't have the capability of using another key for the action the <Enter> key normally takes, I would like to use AutoIt to get it done. I'm a VB.NET programmer, but I'm having issues understanding how to get this done in using the scripting language AutoIt uses. Can someone tell me how (simpler the better) to reassign the <Enter> key to the <SpaceBar> key within only a certain program? Just giving the <SpaceBar> key the same functionality as the <Enter> key would be fine, too. Any help would be greatly appreciated, thank you.
JohnOne Posted September 7, 2010 Posted September 7, 2010 take a look athttp://www.autoitscript.com/forum/index.php?showtopic=90492 * You can specify a hot key, any key, including the CTRL-ALT-DEL, F12, WIN-..., etc. An exception is the only specific keys for notebooks, such as Fn. * You can associate a hot key with the specified window, ie the hot key will work only if this window is currently active. * You can disable repeat key if it holding down. * You can to disable (enable) at any time all the hot keys by calling just the one function. * You can block a call to your function, if the previous call has not yet been completed. * You can associate multiple keys with one function for the subsequent analysis of the code key. AutoIt Absolute Beginners Require a serial Pause Script Video Tutorials by Morthawt ipify Monkey's are, like, natures humans.
jlroper Posted September 7, 2010 Author Posted September 7, 2010 take a look at http://www.autoitscript.com/forum/index.php?showtopic=90492 This is the code I have: #Region ;**** Directives created by AutoIt3Wrapper_GUI **** #AutoIt3Wrapper_outfile=SendEnterForSpaceBarPress_Transcriber.exe #EndRegion ;**** Directives created by AutoIt3Wrapper_GUI **** #Include <HotKeySet.au3> HotKeySet ("{SpaceBar}","Enter") Func Enter() WinWaitActive("Transcriber 1.5.1") Send("{ENTER}") EndFunc I compiled the.AU3 as an .EXE and ran the .EXE file. I then went to the program (which has that title specified). I then hit the <SpaceBar> key, but the <Enter> key action didn't take place. Am I doing something wrong?
bogQ Posted September 8, 2010 Posted September 8, 2010 (edited) Am I doing something wrong? there isnt "{SpaceBar}" its only "{SPACE}", you dont have main loop to keep script alive HotKeySet ("{SPACE}","Enter") While 1 Sleep(10) WEnd Func Enter() If WinActive("Transcriber 1.5.1") Then Send("{ENTER}") Else HotKeySet ("{SPACE}") Send("{SPACE}") HotKeySet ("{SPACE}","Enter") EndIf EndFunc Edited September 8, 2010 by bogQ 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.
jlroper Posted September 8, 2010 Author Posted September 8, 2010 there isnt "{SpaceBar}" its only "{SPACE}", you dont have main loop to keep script alive HotKeySet ("{SPACE}","Enter") While 1 Sleep(10) WEnd Func Enter() If WinActive("Transcriber 1.5.1") Then Send("{ENTER}") Else HotKeySet ("{SPACE}") Send("{SPACE}") HotKeySet ("{SPACE}","Enter") EndIf EndFunc I tried the exact code you posted, it's still not performing an action which <Enter> took when <Space> was pushed (when ran as the compiled .EXE or the .AU3). Does anyone else have suggestions? Thank you.
picea892 Posted September 8, 2010 Posted September 8, 2010 (edited) 1) When the spacebar is pressed run the function called enter 2) If a window titled "Transcriber 1.5.1" has the focus then press the enter key.....end function 3) If the window titled "Transcriber 1.5.1" is not active then make then turnoff the hotkeyset for spacebar (so the function is not called again), press the spacebar then turn the hotkeyset back on. End function. So....Is there a window called this? Is it active? I'm guessing no. If it does exist....is it a game....don't answer that question as bots are not permitted here. But games may resist our efforts Edited September 8, 2010 by picea892
bogQ Posted September 8, 2010 Posted September 8, 2010 (edited) @picea892 Not neseceraly that its a game, your jumping too fast to conclusions @jlroper Is Transcribed 1.5.1 Mac OS X 10.3 aplication, or its for Microsoft Windows? Probably it be nice to post some more info about program that your trying to automate, and info about you OS. Edited September 8, 2010 by bogQ 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.
iamtheky Posted September 8, 2010 Posted September 8, 2010 The code works fine with transcriber 1.5.1 You can down it from sourceforge and confirm. ,-. .--. ________ .-. .-. ,---. ,-. .-. .-. .-. |(| / /\ \ |\ /| |__ __||| | | || .-' | |/ / \ \_/ )/ (_) / /__\ \ |(\ / | )| | | `-' | | `-. | | / __ \ (_) | | | __ | (_)\/ | (_) | | .-. | | .-' | | \ |__| ) ( | | | | |)| | \ / | | | | | |)| | `--. | |) \ | | `-' |_| (_) | |\/| | `-' /( (_)/( __.' |((_)-' /(_| '-' '-' (__) (__) (_) (__)
bogQ Posted September 8, 2010 Posted September 8, 2010 (edited) I did try to download it and it tells me that its "Mac OS X 10.3 or later" app :/ Nice to hear thet someone confirmed that its working Edited September 8, 2010 by bogQ 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.
jlroper Posted September 8, 2010 Author Posted September 8, 2010 The code works fine with transcriber 1.5.1You can down it from sourceforge and confirm.That's odd, I am using the exact (windows based) 'Transcriber' program from SourceForge you are, and it's not working.Can you tell me exactly how you are going thru the process? It just maybe how I think it should be implemented.Thank you.
iamtheky Posted September 8, 2010 Posted September 8, 2010 1) I copied the code that pice upped into a new file in my editor. 2) Saved it 3) hit F5 4) opened a transcriber demo 5) clicked on the first line for speaker 1 6) hit space bar and watched it behave like the {enter} key 7) stopped the execution of pice's script 8) hit space bar in transcriber and watched it go back to being a space bar ,-. .--. ________ .-. .-. ,---. ,-. .-. .-. .-. |(| / /\ \ |\ /| |__ __||| | | || .-' | |/ / \ \_/ )/ (_) / /__\ \ |(\ / | )| | | `-' | | `-. | | / __ \ (_) | | | __ | (_)\/ | (_) | | .-. | | .-' | | \ |__| ) ( | | | | |)| | \ / | | | | | |)| | `--. | |) \ | | `-' |_| (_) | |\/| | `-' /( (_)/( __.' |((_)-' /(_| '-' '-' (__) (__) (_) (__)
jlroper Posted September 8, 2010 Author Posted September 8, 2010 1) I copied the code that pice upped into a new file in my editor.2) Saved it3) hit F54) opened a transcriber demo5) clicked on the first line for speaker 16) hit space bar and watched it behave like the {enter} key7) stopped the execution of pice's script8) hit space bar in transcriber and watched it go back to being a space barInteresting, it was because I had the statement, '#Include <HotKeySet.au3>' at the top of the file. I thought it needed to be there, so it could be referenced properly. I guess not.I removed that, and it worked perfectly! I appreciate the clear steps, by the way.Thank you for your assistance.
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