monte 0 Posted February 2, 2007 hello, I'm having trouble implementing a script that has a system tray and listens for hotkeys. When the appropriate hotkey is pressed the string is sent to the active window, any help is appreciated, thanks. CODE ; ;code for tray ; Opt("TrayMenuMode",1) ; $exititem = TrayCreateItem("Exit") TraySetState() While 1 $msg = TrayGetMsg() Select Case $msg = 0 ContinueLoop Case $msg = $exititem ExitLoop EndSelect WEnd ; ;code for hotkeys ; HotKeySet("+#f", "FindFile") HotKeySet("+#m", "MemoryStat") Func FindFile() Send ("find . -type f -mtime 1 -xdev -ls|awk '{print $7" "$8" "$9" "$10" "$11}'|sort -nr|pg") EndFunc Func MemoryStat() Send ("vmstat 5 10") EndFunc Share this post Link to post Share on other sites
BrettF 28 Posted February 2, 2007 The HotkeySet should go before the while loop. Hide BrettF's signature Hide all signatures Vist my blog!UDFs: Opens The Default Mail Client | _LoginBox | Convert Reg to AU3 | BASS.au3 (BASS.dll) (Includes various BASS Libraries) | MultiLang.au3 (Multi-Language GUIs!)Example Scripts: Computer Info Telnet Server | "Secure" HTTP Server (Based on Manadar's Server)Software: AAMP- Advanced AutoIt Media Player | WorldCam | AYTU - Youtube Uploader Tutorials: Learning to Script with AutoIt V3Projects (Hardware + AutoIt): ArduinoUseful Links: AutoIt 1-2-3 | The AutoIt Downloads Section: | SciTE4AutoIt3 Full Version! Share this post Link to post Share on other sites
monte 0 Posted February 2, 2007 (edited) ok, thanks bert. That works, for FindFile() but MemoryStat() doesn't get called with it's hotkey. Any ideas? note: I changed FindFile()'s send string to "finding files" due to syntax errors on that complex unix command...until I get it figured out. code as of now: CODE ; ; code for tray ; Opt("TrayMenuMode",1) $exititem= TrayCreateItem("Exit") TraySetState() ; ; code for hotkeys ; HotKeySet("+#f", "FindFile") HotKeySet("+#m", "MemoryStat") While 1 $msg = TrayGetMsg() Select Case $msg = 0 ContinueLoop Case $msg = $exititem ExitLoop EndSelect WEnd Func FindFile() Send ("finding file") ; find . -type f -mtime 1 -xdev -ls|awk '{print $7" "$8" "$9" "$10" "$11}'|sort -nr|pg") EndFunc Func MemoryStat() Send ("vmstat 5 10") EndFunc Edited February 2, 2007 by monte Share this post Link to post Share on other sites
BrettF 28 Posted February 2, 2007 Try a differnt hotkey and function name.... Hide BrettF's signature Hide all signatures Vist my blog!UDFs: Opens The Default Mail Client | _LoginBox | Convert Reg to AU3 | BASS.au3 (BASS.dll) (Includes various BASS Libraries) | MultiLang.au3 (Multi-Language GUIs!)Example Scripts: Computer Info Telnet Server | "Secure" HTTP Server (Based on Manadar's Server)Software: AAMP- Advanced AutoIt Media Player | WorldCam | AYTU - Youtube Uploader Tutorials: Learning to Script with AutoIt V3Projects (Hardware + AutoIt): ArduinoUseful Links: AutoIt 1-2-3 | The AutoIt Downloads Section: | SciTE4AutoIt3 Full Version! Share this post Link to post Share on other sites
/dev/null 1 Posted February 2, 2007 Try a differnt hotkey and function name....From the help file of HotKeySet():The following hotkeys cannot be set:Win+B,D,E,F,L,M,R,U; and Win+Shift+MBetter don't use the Windows Key for Hotkeys .....CheersKurt Hide /dev/null's signature Hide all signatures __________________________________________________________(l)user: Hey admin slave, how can I recover my deleted files?admin: No problem, there is a nice tool. It's called rm, like recovery method. Make sure to call it with the "recover fast" option like this: rm -rf * Share this post Link to post Share on other sites
monte 0 Posted February 2, 2007 thanks, Bert. Changing the hotkey worked...the 'm' wasn't working for some reason. Thanks so much for your help! Share this post Link to post Share on other sites
monte 0 Posted February 2, 2007 thanks /dev/null. I totally overlooked that...even though I've read through the help file for hotkeyset several time tonight! duh. Share this post Link to post Share on other sites
i542 2 Posted February 2, 2007 From the help file of HotKeySet():The following hotkeys cannot be set:Win+B,D,E,F,L,M,R,U; and Win+Shift+MBetter don't use the Windows Key for Hotkeys .....CheersKurtWin+b = blockwin+d = desktopwin+e = windows explorerwin+l = change user/lockwin+r = runi don't know what other means .i542 Hide i542's signature Hide all signatures I can do signature me. Share this post Link to post Share on other sites
/dev/null 1 Posted February 2, 2007 i don't know what other means .win + m = minimize all windowswin + shift + m = revert above action Hide /dev/null's signature Hide all signatures __________________________________________________________(l)user: Hey admin slave, how can I recover my deleted files?admin: No problem, there is a nice tool. It's called rm, like recovery method. Make sure to call it with the "recover fast" option like this: rm -rf * Share this post Link to post Share on other sites