Echoze Posted August 28, 2006 Share Posted August 28, 2006 hello everyone. i'm pretty much new to autoit and scripting altogether so please bear with me. i've been practicing by creating little simple scripts. my question is, is it possible to assign a hotkey to launch a script that was compiled to an .exe file? ...thanks Link to comment Share on other sites More sharing options...
amanda089 Posted August 28, 2006 Share Posted August 28, 2006 You can set a hotkey that will run a function in a script while it is running. That function might start another script or do whatever. Please explain further if that isn't enough information. Link to comment Share on other sites More sharing options...
Valuater Posted August 28, 2006 Share Posted August 28, 2006 maybe ; Press Esc to terminate script, Pause/Break to "pause" Global $Paused HotKeySet("{PAUSE}", "TogglePause") HotKeySet("{ESC}", "Terminate") HotKeySet("+!d", "ShowMessage") ;Shift-Alt-d HotKeySet("{F9}", "Run_my_Program") ;;;; Body of program would go here ;;;; While 1 Sleep(100) WEnd ;;;;;;;; Func TogglePause() $Paused = NOT $Paused While $Paused sleep(100) ToolTip('Script is "Paused"',0,0) WEnd ToolTip("") EndFunc Func Terminate() Exit 0 EndFunc Func ShowMessage() MsgBox(4096,"","This is a message.") EndFunc Func Run_my_Program() Run("notepad.exe") EndFunc based from "hotkeyset" in help 8) Link to comment Share on other sites More sharing options...
amanda089 Posted August 28, 2006 Share Posted August 28, 2006 @Valuater I like that pause function. I've been using this to pause my scripts. Func Toggle() If $isPaused Then ... ... ... $isPaused = 0 Else ... ... ... $isPaused = 1 EndIf EndFunc ;==>Toggle Link to comment Share on other sites More sharing options...
Echoze Posted August 28, 2006 Author Share Posted August 28, 2006 You can set a hotkey that will run a function in a script while it is running. That function might start another script or do whatever. Please explain further if that isn't enough information.thank you for your time and help..to be more specific..for example.. i wrote a simple little script that would do a printscreen of the any active open app. on my desktop, paste it into wordpad, set it up as landscape and print it out.. Is it possible to setup a hotkey instead of doubleclicking on the .exe icon each time i want to run the script? from what im gathering from your response is that i would have to create another script that would setup a hotkey to launch that particular script? Link to comment Share on other sites More sharing options...
Xenobiologist Posted August 28, 2006 Share Posted August 28, 2006 HI, yes possible. 1. Have another script that checks whether the hotkey is pressed then start the screenshot script 2. Haveing a while 1 sleep(100) wend loop and check itself for a hotkey. So long, Mega Scripts & functions Organize Includes Let Scite organize the include files Yahtzee The game "Yahtzee" (Kniffel, DiceLion) LoginWrapper Secure scripts by adding a query (authentication) _RunOnlyOnThis UDF Make sure that a script can only be executed on ... (Windows / HD / ...) Internet-Café Server/Client Application Open CD, Start Browser, Lock remote client, etc. MultipleFuncsWithOneHotkey Start different funcs by hitting one hotkey different times Link to comment Share on other sites More sharing options...
amanda089 Posted August 28, 2006 Share Posted August 28, 2006 HotKeySet("^{PRINTSCREEN}", "CallExternal") ; CTRL+PrintScreen While 1 Sleep(1000) WEnd Func CallExternal() Run("File_To_Run.exe", @WorkingDir, @SW_HIDE) EndFunc Link to comment Share on other sites More sharing options...
Valuater Posted August 28, 2006 Share Posted August 28, 2006 the answer is right there... just add your script in the ***** HERE **** part HotKeySet("{F9}", "Run_my_Program") While 1 Sleep(100) WEnd ;;;;;;;; Func Run_my_Program() ***** PUT YOUR SCRIPT HERE **** EndFunc 8) Link to comment Share on other sites More sharing options...
amanda089 Posted August 28, 2006 Share Posted August 28, 2006 Well there you go, 2 sample scripts that do exactly what you are asking. Valuater's script has a shorter sleep function Link to comment Share on other sites More sharing options...
Echoze Posted August 28, 2006 Author Share Posted August 28, 2006 thats great.. thank you everyone for your help... having fun with this!! 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