ploylitarynode 0 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 Share this post Link to post Share on other sites
PsaltyDS 39 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 Share this post Link to post Share on other sites
ploylitarynode 0 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 Share this post Link to post Share on other sites
Neno 0 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. Share this post Link to post Share on other sites
ploylitarynode 0 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 Share this post Link to post Share on other sites
ploylitarynode 0 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 Share this post Link to post Share on other sites
Rawox 0 Posted May 5, 2010 Remove the last EndFunc... Share this post Link to post Share on other sites
AdmiralAlkex 125 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 Share this post Link to post Share on other sites
ploylitarynode 0 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 Share this post Link to post Share on other sites