ploylitarynode Posted May 5, 2010 Share Posted May 5, 2010 Is there a way to run a script from a keystroke? Say I wanted to hit alt+ctrl+p to launch a script. How would I go about doing that? thanks, -Ploxy Link to comment Share on other sites More sharing options...
PsaltyDS Posted May 5, 2010 Share Posted May 5, 2010 (edited) You could run a script in the background with HotKeySet() to activate a function or call another script. P.S. You can also set a hot key in Windows via the properties of a shortcut. See FileCreateShortcut() in the help file. Edited May 5, 2010 by PsaltyDS Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law Link to comment Share on other sites More sharing options...
ploylitarynode Posted May 5, 2010 Author Share Posted May 5, 2010 You could run a script in the background with HotKeySet() to activate a function or call another script.I am completely new to the AU3. Is there an example of doing this? I will take a gander at some examples. In the forums. thanks for the quick response. -ploxy Link to comment Share on other sites More sharing options...
Neno Posted May 5, 2010 Share Posted May 5, 2010 I am completely new to the AU3. Is there an example of doing this? I will take a gander at some examples. In the forums. thanks for the quick response. -ploxy HotKeySet("{F1}","MyFunction") While 1 Sleep(2000) WEnd Func MyFunction() ; Some Functions EndFunc However, the script must already be loaded, but once F1 is pressed it will load that function. Link to comment Share on other sites More sharing options...
ploylitarynode Posted May 5, 2010 Author Share Posted May 5, 2010 HotKeySet("{F1}","MyFunction") While 1 Sleep(2000) WEnd Func MyFunction() ; Some Functions EndFunc However, the script must already be loaded, but once F1 is pressed it will load that function. Awesome. Thank you very much. -ploxy Link to comment Share on other sites More sharing options...
ploylitarynode Posted May 5, 2010 Author Share Posted May 5, 2010 (edited) Okay so I tried some tinkering. And now I am getting an error that says I am missing an EndFunc for _WinWaitActivate($title,$text,$timeout=0) HotKeySet("{a}{v}{p}","MyFunction") While 1 Sleep(2000) WEnd Func MyFunction() Opt("WinWaitDelay",100) Opt("WinDetectHiddenText",1) Opt("MouseCoordMode",0) _WinWaitActivate("TradeStation 8.7 - Untitled Desktop: 1 - Untitled Workspace: 1","TradeStation RadarSc") Send("{ALTDOWN}{TAB}{TAB}{ALTUP}") _WinWaitActivate("Microsoft Excel - Book1","Status Bar") MouseMove(46,249) MouseDown("left") MouseMove(40,449) MouseUp("left") Send("{CTRLDOWN}c{CTRLUP}{ALTDOWN}{TAB}{ALTUP}") _WinWaitActivate("TradeStation 8.7 - Untitled Desktop: 1 - Untitled Workspace: 1","TradeStation RadarSc") Send("{CTRLDOWN}v{CTRLUP}{ALTDOWN}{ALTUP}") Func _WinWaitActivate($title,$text,$timeout=0) WinWait($title,$text,$timeout) If Not WinActive($title,$text) Then WinActivate($title,$text) WinWaitActive($title,$text,$timeout) EndFunc EndFunc any thoughts on what I am doing wrong? -Ploxy Edited May 5, 2010 by ploylitarynode Link to comment Share on other sites More sharing options...
Rawox Posted May 5, 2010 Share Posted May 5, 2010 Remove the last EndFunc... Link to comment Share on other sites More sharing options...
AdmiralAlkex Posted May 5, 2010 Share Posted May 5, 2010 any thoughts on what I am doing wrong? You can't declare a function inside a function! .Some of my scripts: ShiftER, Codec-Control, Resolution switcher for HTC ShiftSome of my UDFs: SDL UDF, SetDefaultDllDirectories, Converting GDI+ Bitmap/Image to SDL Surface Link to comment Share on other sites More sharing options...
ploylitarynode Posted May 5, 2010 Author Share Posted May 5, 2010 You can't declare a function inside a function! hahah I am moron thanks. Been a long day / week it works! -Ploxy 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