monte Posted February 2, 2007 Share 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 Link to comment Share on other sites More sharing options...
BrettF Posted February 2, 2007 Share Posted February 2, 2007 The HotkeySet should go before the while loop. 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! Link to comment Share on other sites More sharing options...
monte Posted February 2, 2007 Author Share 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 Link to comment Share on other sites More sharing options...
BrettF Posted February 2, 2007 Share Posted February 2, 2007 Try a differnt hotkey and function name.... 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! Link to comment Share on other sites More sharing options...
/dev/null Posted February 2, 2007 Share 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 __________________________________________________________(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 * Link to comment Share on other sites More sharing options...
monte Posted February 2, 2007 Author Share Posted February 2, 2007 thanks, Bert. Changing the hotkey worked...the 'm' wasn't working for some reason. Thanks so much for your help! Link to comment Share on other sites More sharing options...
monte Posted February 2, 2007 Author Share 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. Link to comment Share on other sites More sharing options...
i542 Posted February 2, 2007 Share 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 I can do signature me. Link to comment Share on other sites More sharing options...
/dev/null Posted February 2, 2007 Share Posted February 2, 2007 i don't know what other means .win + m = minimize all windowswin + shift + m = revert above action __________________________________________________________(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 * 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