Sign in to follow this  
Followers 0
monte

hotkey help

9 posts in this topic

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



#3 ·  Posted (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 by monte

Share this post


Link to post
Share on other sites

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+M

Better don't use the Windows Key for Hotkeys .....

Cheers

Kurt


__________________________________________________________(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

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

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

From the help file of HotKeySet():

The following hotkeys cannot be set:

Win+B,D,E,F,L,M,R,U; and Win+Shift+M

Better don't use the Windows Key for Hotkeys .....

Cheers

Kurt

Win+b = block

win+d = desktop

win+e = windows explorer

win+l = change user/lock

win+r = run

i don't know what other means :) .

i542


I can do signature me.

Share this post


Link to post
Share on other sites

i don't know what other means :) .

win + m = minimize all windows

win + 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 *

Share this post


Link to post
Share on other sites

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 account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0